Software, electronics and anything else

On IR remotes

In the process of trying out MythTV, Kodi and the like, I’ve discovered that IR remotes are really irritating on Linux with an enormous amount of out of date documentation. Some of the useful breakdowns or guides I found are:

From that, you can see that ir-keytable is the best and really only tool to use. It can list all IR receivers:

pvr@pvr:~$ sudo ir-keytable
Found /sys/class/rc/rc0/ with:
        Name: ITE8708 CIR transceiver
        Driver: ite-cir
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event7
        LIRC device: /dev/lirc0
        Attached BPF protocols: Operation not supported
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
        Enabled kernel protocols: lirc rc-5
        bus: 25, vendor/product: 1283:0000, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms

And it can help you determine if your remote is detected:

pvr@pvr:~$ sudo ir-keytable -t
Testing events. Please, press CTRL-C to abort.
809.329593: lirc protocol(rc5): scancode = 0x1e0b toggle=1
809.329616: event type EV_MSC(0x04): scancode = 0x1e0b
809.329616: event type EV_KEY(0x01) key_down: KEY_RED(0x018e)
809.329616: event type EV_SYN(0x00).
809.443478: lirc protocol(rc5): scancode = 0x1e0b toggle=1
809.443494: event type EV_MSC(0x04): scancode = 0x1e0b
809.443494: event type EV_SYN(0x00).
809.580103: event type EV_KEY(0x01) key_up: KEY_RED(0x018e)
809.580103: event type EV_SYN(0x00).

On Linux Mint, and I assume Ubuntu and Debian due to their shared base, it loads a default keymap on boot based on the name of the driver of the IR device you are using. That means that if like me you’re using some random remote, you need to change this default device. The mapping is specified in /etc/rc_maps.cfg, and by running ir-keytable directly you can see what it’s doing. In my case:

pvr@pvr:~$ sudo ir-keytable -a /etc/rc_maps.cfg -v
Found device /sys/class/rc/rc0/
....
Parsing uevent /sys/class/rc/rc0/uevent
/sys/class/rc/rc0/uevent uevent NAME=rc-rc6-mce
/sys/class/rc/rc0/uevent uevent DRV_NAME=ite-cir
/sys/class/rc/rc0/uevent uevent DEV_NAME=ITE8708 CIR transceiver
...
Keymap for ite-cir, rc-rc6-mce is on rc6_mce.toml file.

I cut out a lot of the less important lines to show only the important ones. In particular, you can see that the device is named rc-rc6-mce and it’s mapping to the rc6_mce.toml file. If you open up /etc/rc_maps.cfg, you can see the link:

*      rc-rc6-mce               rc6_mce.toml

So, if like me you have a random remote, you only need to find the appropriate remote file in /lib/udev/rc_keymaps/ and change the line to refer to your file. In my case:

*       rc-rc6-mce               hauppauge.toml

Leave a Reply

Your email address will not be published. Required fields are marked *