Notice to wiki editors only: Database corruption lead to all accounts being reset. You'll have to re-register. Sorry for the inconvenience. Normal XBMC users can ignore this message.
|This page or section may require cleanup, updating, spellchecking, reformatting and/or updated images. Please improve this page if you can. The discussion page may contain suggestions.|
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.
1 Download and install Lirc
First you have to download and install Lirc. If you're 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.
2 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 stores 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.
2.1 Learning Commands
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.
2.2 Testing the new lirc configuration
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:
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.
2.3 Make the changes to lirc
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.
3 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 the file named Lircmap.xml, which is usually located 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
4 It works :)
remember order to use lirc on xbmc (generic for ubuntu) first install modules then compiling lirc then setting remote
5 Changes in Linux IR
With kernel 2.6.35 some changes began to be made in the way Linux handles infrared remotes. What used to be a job just for LIRC is now partly done by the Linux kernel. Some distributions 'backport' changes to the kernel, so even though your kernel is older than 2.6.35 it might affect you.
The drivers for several remotes have been moved into the kernel and this means that many of them should 'Just Work' out of the box. Unfortunately LIRC, the LIRC configuration tools, the distribution setup scripts for LIRC and most of the documentation available has not yet (as of February 2011) been updated to reflect these changes. If you are experiencing problems, your remotedriver may have been moved to the kernel. In this case, try to setup LIRC with 'devinput' as the driver (and something like /dev/input/event3 as the device). Further reading: Linux 2.6.35+ Remote Control Overview What’s new in IR? Linux input layer driver