Home > MythTV > Making a MCE Reciever work with Generic RC5 Remote (Kernel 2.6.35+)

Making a MCE Reciever work with Generic RC5 Remote (Kernel 2.6.35+)

November 6th, 2011

LIRC (Linux Infra-Red Remote Control) has recently undergone some major upheavals for the better as they are now part of the main stream kernel. So for some a kernel upgrade is breaking the remote controls, especially for custom setups.

This left me without a working remote, as I utilise a standard USB Microsoft Receiver (MCE Receiver), but not necessarily with the remote that belongs to it.

There a number of IR protocols that are all in the same Hz bandwidth the receiver is capable of receiving. Basically anything except B&O thats 400Hz. So there is no reason why it should not work with *nearly all* remotes.

Firstly, install some software. Namely Lirc0.9.1 and v4l-utils (which gives ir-keytable)

Then we can go and see if the kernel is accepting the RC. Plug in the device and it should report in /var/log/messages something on these lines

Nov  6 18:57:58 jblaptop kernel: [10199.956078] usb 8-2: new full speed USB device number 9 using uhci_hcd
Nov  6 18:57:58 jblaptop kernel: [10200.113069] usb 8-2: New USB device found, idVendor=0471, idProduct=0815
Nov  6 18:57:58 jblaptop kernel: [10200.113076] usb 8-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov  6 18:57:58 jblaptop kernel: [10200.113081] usb 8-2: Product: eHome Infrared Transceiver
Nov  6 18:57:58 jblaptop kernel: [10200.113085] usb 8-2: Manufacturer: Philips
Nov  6 18:57:58 jblaptop kernel: [10200.113089] usb 8-2: SerialNumber: PH00SUJT
Nov  6 18:57:58 jblaptop kernel: [10200.120051] Registered IR keymap rc-rc6-mce
Nov  6 18:57:58 jblaptop kernel: [10200.120232] input: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) as /devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0/rc/rc7/input18
Nov  6 18:57:58 jblaptop kernel: [10200.120340] rc7: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) as /devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0/rc/rc7
Nov  6 18:57:58 jblaptop kernel: [10200.121188] rc rc7: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0
Nov  6 18:57:58 jblaptop kernel: [10200.121217] mceusb 8-2:1.0: Registered Philips eHome Infrared Transceiver on usb8:9
Nov  6 18:57:58 jblaptop mtp-probe: checking bus 8, device 9: "/sys/devices/pci0000:00/0000:00:1d.2/usb8/8-2"
Nov  6 18:57:59 jblaptop mtp-probe: bus: 8, device: 9 was not an MTP device

Now if we run ir-keytable, we get the following information

[root@jblaptop log]# ir-keytable
Found /sys/class/rc/rc7/ (/dev/input/event11) with:
Driver mceusb, table rc-rc6-mce
Supported protocols: NEC RC-5 RC-6 JVC SONY LIRC
Enabled protocols: RC-6
Repeat delay = 500 ms, repeat period = 125 ms

So there was my first issue, it was only receiving RC6 protocol. So to start with I enabled RC5 (Hauppauge A415 remote) as follows

[root@jblaptop log]# ir-keytable -p RC5 -s rc7
Protocols changed to RC-5

Now we have the receiver working on RC5, we can identify the keycodes the remote generates by running the command

evtest /dev/input/event11

Which will generate an unrecognised keymap as follows (this example is OK button)

Event: time 1320606374.418311, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1e25

Go through them all writing down the values and then generate a file, lets call it /etc/rc_keymaps/custom

0x1e17 KEY_RIGHT
0x1e25 KEY_OK
0x1e1f KEY_EXIT

Note in my case I was lucky, there already was an /etc/rc_keymaps/hauppauge for my remote… so check through first before major work.

As we now have a keymap file, we want to override the one the kernel uses by default. Luckily for us, there is a new file called /etc/rc_maps.cfg which takes what the kernel is asking for and provides a filename accordingly. I backed up the file and created the following rc_maps.cfg. The kernel requested table can be identified from running ir-keytables

#Driver         Kernel Requested Table   File Provided (from /etc/rc_keymaps)
*               rc-rc6-mce               custom

For me it changes the protocol from RC6 to RC5 automatically.

This now gets a kernel key event from your remote, but we need to convert that kernel key event to a lirc key event. To do this a standard file is available from lirc. Put it into /etc/lirc

cd /etc/lirc
wget http://lirc.sourceforge.net/remotes/devinput/lircd.conf.devinput
mv lircd.conf.devinput lircd.conf

We can now startup lircd. I recommend to look in /dev/input/by-id so that your device name remains persistent across reboots. My lircd startup looks like this.

/usr/sbin/lircd --driver=devinput --device=/dev/input/by-id/usb-Philips_eHome_Infrared_Transceiver_PH00SUJT-event-if00

Try it, run irw and see that the key presses are being received from devinput by lircd and being translated correctly. Once done killall lirc and move on below.

So now for getting that into MythTV? Well presumably you have a lircrc file from before, it will look something like this, with entries for mapping a RC Key to a real Key(board). Watch out for KEY1_NUMERIC which now via devinput are KEY_1

begin
prog = mythtv
button = KEY_OK
config = Enter
end

Ensure mythtv is looking at the lircd stream on /var/run/lircd/lircd and ensure Myth starts AFTER lirc is running.

Nearly there…. but you will want lirc to start automatically. First edit /etc/sysconfig/lirc and add the driver and device (Fedora)

systemctl enable lirc
systemctl start lirc

One more thing… to prevent Xorg Display grabbing the events and causing double events, my xorg.conf needed the following adding

Section "InputClass"
     Identifier    "Remote"
     MatchProduct  "Media Center Ed. eHome Infrared Remote Transceiver"
     Option        "Ignore" "True"
EndSection

Good Luck.

Comments are closed.