Making the Most of Media Centre Remotes: Installation and Custom Mapping

Have you ever wanted to get more out of your remote in Linux? I sure did. I spend a lot of time setting up and programming for media centres. One thing that I have found with Linux is that many of the remotes that are “obsolete” in Windows Vista/7 actually are still well supported in Linux. This makes it easy to get great remotes cheaply.

With enough work, you can make that remote do whatever it is you want, be it run a script or launch a program. This guide is constructed around Mythbuntu, but the principles are the same regardless of your distribution. How you install and control lirc may change slightly but the irexec coding stays the same.

Objective: Push a button on your remote and have it launch a program or execute a command

You need: lirc, irexec and possibly lirc-modules-source

You need to know: where the program/script you want to run is located; how to edit a text file.

Step 1: Plug in your remote, wait several seconds then find out if and how Linux is detecting it by using:

As you can see I have an mceusb2. This is important for the next step:

Step 2: Install what you need:

$sudo apt-get install lirc irexec lirc-modules-source

Select your model of remote when prompted by lirc

Step 3: Type:

$ irw

And start pushing buttons on your remote to test to see if your remote is working. If it’s working, as you push buttons it will spit out jibberish in response to the keypress (well it’s actually not jibberish, but you get the drift)

Step 4: Run the following command:

$ mythbuntu-lirc-generator

This will generate .lircrc and .lirc/ files/folders. As a brief explanation, the .lircrc is a file which, in this case, points to the lirc folder. Inside the lirc folder you will see individual files, each defining how a program responds to your remote.

Step 5: Create a link inside the .lircrc file it should look something like this:

$ ~/.lirc/irexec

This should not be too difficult because if you have used the generator, there will be links to other files controlling the media programs (vlc, mplayer, elissa etc) that will look similar.

Test your buttons. If it works, great – you’re pretty much done, you just need to add irexec to your startup as this process does not startup by default with the computer. (Please note that this step may change depending upon your distribution)

For Gnome:

System->Preferences->Startup Applications

For Xfce:

Applications->Settings->Sessions and Startup

There you have it!

You have successfully installed, configured lirc and mapped a button. If you have the same remote, Xbox Media Centre installed and followed this guide, every time you press the Record TV button it will launch the media centre.

Hopefully this will smooth out your experience with Linux and media centres.