date: 2010-06-19 tags: - linux - htpc title: LIRC and XBMC --- Those of you who know me fairly well know that I'm a total HTPC geek. It's to the point where I outright refuse to subscribe to cable television or even hook up an antenna to my TV. This geekery combined with my affinity for Linux leads me to running XBMC on Linux on my little home theater machine. It's been a pretty smooth experience with the exception of getting my remote work with it. If you're struggling with it too, hopefully my tales will help you get it going. --- So, here's my setup. I've got an Antec Fusion 430 (a silver one with the VFD), a Logitech Harmony remote, and Ubuntu 10.04. The Antec case is pretty cool since it looks like it belongs in my home theater setup, and it even includes an IR receiver built right into the case! Cool! It should accept signals from any IR remote, right? *Wrong* In the hardware developer's infinite wisdom, they made it only work with Windows Media Center remotes instead of just making it a dumb device that passes data along. They actually put **more** effort into designing the thing just to make my life harder. Augh! Luckily, when I got this case my [then-roommate](http://benmurrell.com/) had an Xbox 360 remote which magically worked! So I eventually got a Logitech Harmony remote and told it that my HTPC was actually an Xbox 360. Step one complete. The next step was to get LIRC to accept the remote. This is a bit tricky, but luckily I had backed up my configs. If you're starting out from scratch, here's how to do it in an Ubuntu system. First of all, you need to install LIRC: sudo aptitude install lirc During the configuration phase of the install, it'll ask you for what kind of device you have. I selected *Soundgraph iMON PAD IR/VFD*, which uses the lirc_imon driver. Unfortunately, since I have the silver Antec Fusion 430 I have the VFD and not the LCD display, which has a slightly different IR receiver. You have to specify the display_type=1 when the module is loaded. You can do this by adding a file called lirc-imon.conf to /etc/modprobe.d/ with [these contents](http://nickpegg.com/stuff/lirc/modprobe.d-lirc-imon.conf). If you don't want to restart, you'll have to throw commands at the system to reload the module with the correct options. sudo service lirc stop sudo rmmod lirc_imon sudo modprobe lirc_imon display_type=1 While you have LIRC stopped, you might as well double-check that the IR receiver is actually receiving data with the following command (hit Ctrl-C to stop): sudo cat /dev/lirc0 You should see a bunch of garbage get printed to the terminal when you press buttons on your remote. If you don't, then either you have the wrong type of remote or you don't need the display_type argument to modprobe. Next, you need to setup the button config for your remote. Since I'm using a Logitech Harmony remote to emulate an Xbox 360 remote, I used the irrecord command to generate [my config](http://nickpegg.com/stuff/lirc/xbox360.conf). Luckily there's [plenty of people out there](http://www.google.com/search?&q=lirc++microsoft+remote+config) who have already done this for you for a large amount of remotes ([here's a good list](http://lirc.sourceforge.net/remotes/), for example). Once you have the remote config file downloaded or created, add an include to your [lircd.conf](http://nickpegg.com/stuff/lirc/lircd.conf) for it, fire up LIRC, and test it out with the irw command. sudo service lirc start irw When you press buttons, you should see the button commands scroll by in the terminal. *\*whew\** Almost there. Still with me? Good, because we only have one thing left, the XBMC Lircmap.xml file! I'll spare you the nitty-girtty of it and just give you [mine](http://nickpegg.com/stuff/lirc/Lircmap.xml) (right-click and save it). If you feel like making your own or need to tweak mine a bit, the XBMC wiki has some [good information](http://wiki.xbmc.org/index.php?title=Lirc_and_Lircmap.xml) on how to do it. ### For the impatient, here's all of my files associated with getting this to work: [lircd.conf](http://nickpegg.com/stuff/lirc/lircd.conf) (LIRC) [hardware.conf](http://nickpegg.com/stuff/lirc/hardware.conf) (LIRC) [xbox360.conf](http://nickpegg.com/stuff/lirc/xbox360.conf) (remote) [Lircmap.xml](http://nickpegg.com/stuff/lirc/Lircmap.xml)(XBMC)