[UPDATE] I’ve aborted this effort after a rework on the home network. I’ve ultimately opted for a Raspberry Pi Complete Starter Kit, with Noobs and Raspbmc. It worked with the remote out of the box and now I’m up and running.
I use kodi (formerly xbmc) as a home media system. It was setup working nicely with a Harmony One remote control. For a few reasons, I updated some packages on the Ubuntu 12.04 system and ended up on Ubuntu 14.10. As part of this upgrade xbmc became kodi.
Unfortunately now, kodi recognizes only some of the remote commands. Left, right, up and down and play work well. Others (OK, Back, etc) don’t. Debugging and resolving this has proven to be a much bigger challenge than it has been in the past, where i have worked things out without too many hoops. Unfortunately both Linux and kodi have changed quite a bit over the years and a lot of the online documentation, blog posts and so on are out of date.
My modus operandi is less about hacking things heavily and more about the simplest path to get things working. I’d rather remove a package than heavily configure and customize a set of files. This is my way of looking at if I can get things to “Just Work”.
This blog post is intended to be both a narrative on how to get things going, but also serve as a current reference for people out there who run into this sort of problem. Read on for more details on what I have done. This post will carry a lot of questions as I resolve issues, and will be updated over time.
Out of the box, we have a remote that does up/down/left/right/pause work. However the OK, back and other buttons don’t work.
The hardware is fairly simple, a USB IR receiver, a Harmony 1 remote connected to a Zoran HTPC.
Validating the Kernel Driver
Given that the USB IR receiver is taken from a Windows Media Center Edition, the theory would be that it hotplugs and should just work. Looking at dmesg, it appears as though that is happening.
[ 2.924069] usb 3-1: new full-speed USB device number 2 using uhci_hcd [ 3.082726] usb 3-1: config 1 interface 0 altsetting 0 endpoint 0x1 has an invalid bInterval 0, changing to 32 [ 3.082734] usb 3-1: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 0, changing to 32 [ 3.116723] usb 3-1: New USB device found, idVendor=1784, idProduct=0006 [ 3.116731] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 3.116736] usb 3-1: Product: eHome Infrared Transceiver [ 3.116742] usb 3-1: Manufacturer: TopSeed Technology Corp. [ 3.116747] usb 3-1: SerialNumber: TS002xJQ
The device is enumerated, great.
[ 44.904282] Registered IR keymap rc-rc6-mce [ 44.904776] input: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/rc/rc0/input13 [ 44.905040] rc0: Media Center Ed. eHome Infrared Remote Transceiver (1784:0006) as /devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/rc/rc0 [ 44.933574] IR NEC protocol handler initialized [ 44.956091] IR RC5(x) protocol handler initialized [ 44.959520] IR RC6 protocol handler initialized [ 44.960089] IR JVC protocol handler initialized [ 44.986188] IR Sony protocol handler initialized [ 44.988310] IR Sharp protocol handler initialized [ 44.989179] IR MCE Keyboard/mouse protocol handler initialized [ 44.992953] input: MCE IR Keyboard/Mouse (mceusb) as /devices/virtual/input/input14 [ 45.005148] IR SANYO protocol handler initialized [ 45.021973] lirc_dev: IR Remote Control driver registered, major 250 [ 45.040142] rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0 [ 45.040153] IR LIRC bridge handler initialized [ 45.224075] mceusb 3-1:1.0: Registered TopSeed Technology Corp. eHome Infrared Transceiver with mce emulator interface version 1 [ 45.224084] mceusb 3-1:1.0: 2 tx ports (0x0 cabled) and 2 rx sensors (0x1 active) [ 45.224207] usbcore: registered new interface driver mceusb
And it loads the mceusb input driver too, great. We seem to have the IR system up and running.
Verifying IR is being received
A lot of references suggest using irw as a test utility. However that requires lirc to be running. As far as I can tell kodi supports running without lirc. I’ve opted to use that model. I use the command ir-keytable to determine if the kernel driver is reporting keys input correctly. So the first thing we need to do is determine which USB device is the IR receiver – highlighted below in bold.
$ lsusb Bus 001 Device 008: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 006: ID 2341:0001 Arduino SA Uno (CDC ACM) Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 003: ID 1058:1110 Western Digital Technologies, Inc. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 002: ID 05a4:1700 Ortek Technology, Inc. Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 002: ID 1784:0006 TopSeed Technology Corp. eHome Infrared Transceiver Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
So now to see if the receiver is working. To make things easy, I’m going to use the input device by-id, this will be consistent boot-for-boot without any issues if new devices are added or removed. Running the command and then clicking up and then down on the remote.
$ sudo ir-keytable -t --device=/dev/input/by-id/usb-TopSeed_Technology_Corp._eHome_Infrared_Transceiver_TS002xJQ-event-if00 Testing events. Please, press CTRL-C to abort. 1416721016.336835: event type EV_MSC(0x04): scancode = 0x800f041e 1416721016.336835: event type EV_KEY(0x01) key_down: KEY_UP(0x0001) 1416721016.336835: event type EV_SYN(0x00). 1416721016.442765: event type EV_MSC(0x04): scancode = 0x800f041e 1416721016.442765: event type EV_SYN(0x00). 1416721016.577793: event type EV_MSC(0x04): scancode = 0x800f041e 1416721016.577793: event type EV_SYN(0x00). 1416721016.830056: event type EV_KEY(0x01) key_up: KEY_UP(0x0001) 1416721016.830056: event type EV_SYN(0x00). 1416721018.363549: event type EV_MSC(0x04): scancode = 0x800f041f 1416721018.363549: event type EV_KEY(0x01) key_down: KEY_DOWN(0x0001) 1416721018.363549: event type EV_SYN(0x00). 1416721018.469504: event type EV_MSC(0x04): scancode = 0x800f041f 1416721018.469504: event type EV_SYN(0x00). 1416721018.603565: event type EV_MSC(0x04): scancode = 0x800f041f 1416721018.603565: event type EV_SYN(0x00). 1416721018.854012: event type EV_KEY(0x01) key_up: KEY_DOWN(0x0001) 1416721018.854012: event type EV_SYN(0x00).
So we can confirm that the remote is sending commands and that the kernel is receiving these as keystrokes.