HOW-TO:Set up LIRC
What is this guide for?
This guide explains how to set up xbmc to understand a universal remote's commands (so not the standard MCE remotes that work out of the box). You obviously need some hardware device for this that reads infrared commands. I'm using a cheap (+- 10 euro) device called the IRMan. You can find a list of supported devices here.
Download and install Lirc
First you have to download and install Lirc. If your using Ubuntu or Debian you can just type apt-get install lirc. If you don't have a lirc package in you distribution or (in my case) a buggy version, it's pretty easy to compile lirc from source:
user@computer:~$ wget http://prdownloads.sourceforge.net/lirc/lirc-0.8.4a.tar.bz2 user@computer:~$ tar -jxf lirc-0.8.4a.tar.bz2 user@computer:~$ cd lirc-0.8.4a user@computer:~/lirc-0.8.4a$ aclocal && autoheader && autoconf user@computer:~/lirc-0.8.4a$ ./configure --with-x --with-driver=irman (or whatever remote you are using, check ./configure --help for supported ones - for homebrew serial IR use --driver=serial) user@computer:~/lirc-0.8.4a$ make && sudo make install
Next comes the interesting part.
Configure Lirc to understand your remote's commands
You have downloaded and installed Lirc and are now ready to set it up. First, check if your IR receiver is already preconfigured. Ubuntu stored the configuration files in /usr/share/lirc/remotes but you can also find them in the source tree in the remotes directory. If you can find you remote, copy the config file to /etc/lirc/lircd.conf and open the file with a text editor. Delete the lines between begin codes and end codes.
Now we're going to learn commands. Fire up irrecord with the following command:
user@computer:~$ sudo -s ## you have to be root for this part [sudo] password for user: root@computer:~# cd /etc/lirc root@computer:/etc/lirc# irrecord --driver=irman --device=/dev/ttyS0 MyRemote ## use the driver that you chose in the previous part. /dev/ttyS0 = first com port
You'll get a wall of text and are asked to press enter. Next you'll see a prompt
Hold down an arbitrary button.
Just hold down any button on your remote until the next prompt.
Found gap length: 215947 Now enter the names for the buttons.
Now you have to learn all buttons. Enter a name, press enter, hold down the button you are learning and repeat. When you're done, press enter. Press one button on your remote as fast as possible but DO NOT hold it down.
Next we're going to test the config file we just created. Start lirc with the following command:
root@computer:/etc/lirc# lircd --driver=irman --device=/dev/ttyS0 /etc/lirc/MyRemote
You can test your config by starting irw:
root@computer:/etc/lirc# irw
Press the buttons on your remote you just learned and see if they match. Press ctrl+c to quit irw. If there's a problem, stop lirc with
root@computer:/etc/lirc# killall lircd
delete the file we just created
root@computer:/etc/lirc# rm -f MyRemote
and repeat the whole learning process back from the top. If it still doesn't work, have a look at this site or ask on the forums.
If irw gave the right output, stop lirc with
root@computer:/etc/lirc# killall lircd
and move the file we created to lircd.conf
root@computer:/etc/lirc# mv MyRemote lircd.conf
Finally start up lirc with
root@computer:/etc/lirc# /etc/init.d/lircd start
You can now leave your root shell.
Configure XBMC to understand Lirc's commands
So now that you configured lirc and irw gives the expected output, it's time to let lirc talk to XBMC. Start your text editor and open all file named Lircmap.xml. usually palced in $home$/.xbmc/userdata/ and the generic is on /usr/share/xbmc/system/. There are some remotes in there by default. Copy the part between
<remote device="mceusb"> ... </remote>
and paste it in the file. Change the new mceusb to MyRemote (or whatever name you picked for your remote in the lirc configuration) and change the values of the tags to the names of the buttons. If you forgot them, they are in /etc/lirc/lircd.conf.
The Lircmap.xml configuration is explained in more detail in this forum post
It works :)
remember order to use lirc on xbmc (generic for ubuntu) first install modules then compiling lirc then setting remote