Wednesday, July 18, 2012

Mini Howto XBMC : Install an MCE remote control to take over your Linux XBMC Box

The Goal: 

The better and easiest way to control your XBMC box is naturally a remote control. (moreover for the rest of the family ^^) 

If your HTPC wasn't provided with one or if you want to change, that's my opinion but my advise would be to buy an MCE remote, also called Microsoft remote control.

They will easily work in any Linux installation and will work without any suffering effort in XBMC !

What you need:

  • A functional XBMC Linux installation
  • An MCE remote control associated with its IR receiver. (prefer an external USB IR receiver)
For my personal installation, i bought this one (french link):

It works perfectly in Linux and XBMC and comes with a great IR USB reveiver.
The remote itself has a good quality, nothing to regret.

You may also look for one on ebay, you'll easily find a lot of MCE remotes that will work with no issues in XBMC and Linux.

Step 1: Install and configure LIRC

Plug the IR and check kernel messages:

First plug the IR receiver and check kernel messages, you should find such a message telling your the IR receiver has been detected and installed:

[   11.560051] input: MCE IR Keyboard/Mouse (mceusb) as /devices/virtual/input/input9                                                       
[   11.563329] IR MCE Keyboard/mouse protocol handler initialized                                                                           
[   11.572910] lirc_dev: IR Remote Control driver registered, major 249                                                                     
[   11.574374] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0                                                      
[   11.574382] IR LIRC bridge handler initialized
[   11.624101] mceusb 4-2:1.0: Registered Topseed Technology Corp. eHome Infrared Transceiver with mce emulator interface version 1         
[   11.624110] mceusb 4-2:1.0: 2 tx ports (0x0 cabled) and 2 rx sensors (0x1 active)      

Here you can see Linux recognized the IR device has an "mceusb", the driver will be loaded directly by the kernel itself.

Install and configure LIRC:

If LIRC is already installed in your system, my advise is to completely uninstall it, you could use "dpkg-reconfigure lirc" but it my case it was not completely working as expected.

Moreover, in Ubuntu 12.04 there seems to be problem identiying a kernel directory when installing LIRC, if you have any issue starting LIRC, the workaround is:

$ sudo ln -s /lib/modules/3.2.0-26-generic/kernel/drivers/staging/media/lirc /lib/modules/3.2.0-26-generic/kernel/drivers/staging/lirc

NB: Replace with your kernel version (eg. 3.2.X-XX-....), use the command "uname -a" if you don't know it

So backup your config files if required (in directory "/etc/lirc") and:

sudo apt-get remove --purge lirc

Install LIRC:

sudo apt-get install lirc

Accept the installation and when requested in first configuration screen, choose the "Windows Media Center Transceivers/Remotes [all]" :

And choose none for the second screen and valid.

Step 2: Test

use the LIRC provided tool to test your remote control:

$ irw

Press some randoms remote keys, if your MCE remote works, you will get keys signals.
If you don't have nothing, you might have a problem with LIRC or with your configuration:

  • double check that LIRC is started, in case of and to check messages restart it (sudo /etc/init.d/lirc restart)
  • If LIRC is failing to start, check the workaround at the beginning of this article, a kernel directory location change seems to break LIRC!
  • check your receiver, on various IR receivers you'll get a red light when pressing a remote key
  • perhaps your remote control will need a other driver, ask Google :-)

Step 3: XBMC Test

Restart XBMC and test your remote control, in my case (and in general with an MCE remote) you absolutely have nothing more to configure ^^

And you're done, enjoy :-)