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

Add Your Comments

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:

$dmesg | tail

sample output: lsusb

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 1784:0008 TopSeed Technology Corp.
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

sample output: dmesg

$dmesg | tail
[6.646188] lirc_mceusb2: Philips eHome USB IR Transceiver and Microsoft MCE 2005 Remote Control driver for LIRC $Revision: 1.44 $
[6.646191] lirc_mceusb2: Daniel Melander , Martin Blatter
[6.938644] lirc_mceusb2[2]: Topseed Technology Corp. eHome Infrared Transceiver on usb3:2
[6.938671] usbcore: registered new interface driver lirc_mceusb2

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.

Step 6: Create the file .lirc/irexec (choose your favorite editor… I like nano):

$ sudo nano ~/.lirc/irexec

Step 7: Insert the code into the irexec file, save and exit. The code format looks like this:

remote = mceusb
prog = irexec
button = RecTV
config = /usr/bin/xbmc
repeat = 0
delay = 0

Where remote is the remote which you have and the config line is the action you want the computer to execute on button press.

Step 8: Next you need to restart lirc and manually start irexec:

$ sudo /etc/init.d/lirc restart
$ /usr/bin/irexec -d /home/$USER/.lirc/irexec[/code]

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.


Leave a Reply

Your email address will not be published. Required fields are marked *