Kodi Community Forum

Full Version: IR Remote / ir-table help -- no EV-KEY event
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm a noob trying to get an IR remote (Xbox 360 HD-DVD remote lying around) to work with Kodi. I'm running Kodi from RetroPie and I have a USB IR receiver. The USB IR receiver seems to work fine (the raspberry pi detects it with the mceusb driver. It's seemingly paired with the remote okay as well.

I'm trying to follow this guide

I'm able to create the file with the remote scancodes, but the remote doesn't work in Kodi or RetroPie. I think the problem might be related to the EV_KEY event type not showing up. When I press a button on my remote, I see an EV_MSC and an EV_SYN event, but no EV_KEY.

Any ideas why EV_KEY isn't showing up? It seems fundamental but I have no idea what the issue might be.

I'm very new to this so it's possible I did something dumb. I haven't tried LIRC. I just stumbled on the ir-table guide first so I tried that. Should I try using lirc? It's currently not installed. I also have inputlirc uninstalled.
I don't think you need LIRC - the only time I got into using that was with an IR detector plugged into the GPIO connector. If using the usb connector, the device is seen as a mouse or keyboard
Run "ir-keytable -r" and see check if the correct keysyms are loaded and if "rc-6" is listed under enabled protocols. You can also check for enabled and supported protocols by running ir-keytable without any options.

If rc-6 is supported (most but not all USB IR receivers support it) but not enabled you can enabled it with "ir-keytable -p rc-6".

In LibreELEC we are using this keymap for the XBOX 360 remote (haven't tested it myself as I don't have such a remote):

Code:
# table xbox_360, type: RC6
0x800f7400 KEY_NUMERIC_0
0x800f7401 KEY_NUMERIC_1
0x800f7402 KEY_NUMERIC_2
0x800f7403 KEY_NUMERIC_3
0x800f7404 KEY_NUMERIC_4
0x800f7405 KEY_NUMERIC_5
0x800f7406 KEY_NUMERIC_6
0x800f7407 KEY_NUMERIC_7
0x800f7408 KEY_NUMERIC_8
0x800f7409 KEY_NUMERIC_9
0x800f740a KEY_DELETE
0x800f740b KEY_ENTER
0x800f740c KEY_SLEEP
0x800f740d KEY_MEDIA
0x800f7464 KEY_MEDIA
0x800f740e KEY_MUTE
0x800f740f KEY_INFO
0x800f7410 KEY_VOLUMEUP
0x800f7411 KEY_VOLUMEDOWN
0x800f7412 KEY_CHANNELUP
0x800f746C KEY_CHANNELUP
0x800f7413 KEY_CHANNELDOWN
0x800f746D KEY_CHANNELDOWN
0x800f7414 KEY_FASTFORWARD
0x800f7415 KEY_REWIND
0x800f7416 KEY_PLAY
0x800f7417 KEY_RECORD
0x800f7418 KEY_PAUSE
0x800f7419 KEY_STOP
0x800f741a KEY_NEXT
0x800f741b KEY_PREVIOUS
0x800f741c KEY_NUMERIC_POUND
0x800f741d KEY_NUMERIC_STAR
0x800f741e KEY_UP
0x800f741f KEY_DOWN
0x800f7420 KEY_LEFT
0x800f7421 KEY_RIGHT
0x800f7422 KEY_OK
0x800f7423 KEY_EXIT
0x800f7424 KEY_DVD
0x800f744f KEY_EPG
0x800f7427 KEY_ZOOM
0x800f7432 KEY_MODE
0x800f7433 KEY_PRESENTATION
0x800f7428 KEY_EJECTCD
0x800f743a KEY_BRIGHTNESSUP
0x800f7446 KEY_TV
0x800f7447 KEY_AUDIO
0x800f7448 KEY_PVR
0x800f7449 KEY_CAMERA
0x800f744a KEY_VIDEO
0x800f744c KEY_LANGUAGE
0x800f7451 KEY_TITLE
0x800f744e KEY_PRINT
0x800f7450 KEY_RADIO
0x800f745a KEY_SUBTITLE
0x800f7425 KEY_RED
0x800f7466 KEY_GREEN
0x800f7426 KEY_YELLOW
0x800f7468 KEY_BLUE
0x800f7465 KEY_POWER2
0x800f746e KEY_PLAYPAUSE
0x800f746f KEY_PLAYER
0x800f7480 KEY_BRIGHTNESSDOWN
0x800f7481 KEY_PLAYPAUSE

so long,

Hias
(2017-03-19, 08:51)dandnsmith Wrote: [ -> ]I don't think you need LIRC - the only time I got into using that was with an IR detector plugged into the GPIO connector. If using the usb connector, the device is seen as a mouse or keyboard

Some IR receivers (FLIRC?) follow that model and don't require LIRC to be running. However other IR solutions, including RC6 MCE IR receivers - which are popular with Kodi users, do require LIRC to be correctly configured.

IME MCE RC6 remotes and USB receivers work OOTB with most LibreElec installs - though in some cases you have to copy the right config file across.

On a Pi you can solder a suitable £0.99 or less TSOP - nothing else required - to three pins on the GPIO header, and that will give you IR reception in LibreElec. (I have done this with a Zero W)
(2017-03-20, 14:33)noggin Wrote: [ -> ]However other IR solutions, including RC6 MCE IR receivers - which are popular with Kodi users, do require LIRC to be correctly configured.
This is no longer 100% true. Most IR receivers and remotes are now supported by the kernel rc framework which means decoding is done inside the kernel and you no longer need to configure and run userspace lircd.

This even works on RPi with an IR receiver connected to GPIO, just use the gpio-ir overlay instead of lirc-rpi and an MCE remote will work out of the box (for other remotes add the rc-map-name option and/or configure the via ir-keytable or rc_maps.cfg):
Code:
dtoverlay=gpio-ir,gpio_pin=18,gpio_pull=1

Userspace lircd is still useful for remotes using odd protocols that are not supported via in-kernel decoding. So it's not completely obsolete but in most cases you no longer need it. And IMO in-kernel decoding is a lot easier to configure and use compared to lircd, so if you have the choice you should use it Smile

BTW: The next LibreELEC release 8.0.1 will include a bunch of improvements in this area, for example support for user-configurable rc_maps.cfg.

so long,

Hias
(2017-03-20, 19:36)HiassofT Wrote: [ -> ]
(2017-03-20, 14:33)noggin Wrote: [ -> ]However other IR solutions, including RC6 MCE IR receivers - which are popular with Kodi users, do require LIRC to be correctly configured.
This is no longer 100% true. Most IR receivers and remotes are now supported by the kernel rc framework which means decoding is done inside the kernel and you no longer need to configure and run userspace lircd.

This even works on RPi with an IR receiver connected to GPIO, just use the gpio-ir overlay instead of lirc-rpi and an MCE remote will work out of the box (for other remotes add the rc-map-name option and/or configure the via ir-keytable or rc_maps.cfg):
Code:
dtoverlay=gpio-ir,gpio_pin=18,gpio_pull=1

Userspace lircd is still useful for remotes using odd protocols that are not supported via in-kernel decoding. So it's not completely obsolete but in most cases you no longer need it. And IMO in-kernel decoding is a lot easier to configure and use compared to lircd, so if you have the choice you should use it Smile

BTW: The next LibreELEC release 8.0.1 will include a bunch of improvements in this area, for example support for user-configurable rc_maps.cfg.

so long,

Hias

Happy to stand corrected Smile
Thank you so much for the replies! I'm double-checking to make sure the receiver is actually detecting my remote right now. Windows appears to detect it (EventGhost is logging inputs), but Kodi for Windows doesn't work with the remote out of the box. I don't know if I need to use the advanced MCE remote mapper or not, but I haven't had time to try that.

(2017-03-20, 14:33)noggin Wrote: [ -> ]
(2017-03-19, 08:51)dandnsmith Wrote: [ -> ]I don't think you need LIRC - the only time I got into using that was with an IR detector plugged into the GPIO connector. If using the usb connector, the device is seen as a mouse or keyboard

Some IR receivers (FLIRC?) follow that model and don't require LIRC to be running. However other IR solutions, including RC6 MCE IR receivers - which are popular with Kodi users, do require LIRC to be correctly configured.

IME MCE RC6 remotes and USB receivers work OOTB with most LibreElec installs - though in some cases you have to copy the right config file across.

On a Pi you can solder a suitable £0.99 or less TSOP - nothing else required - to three pins on the GPIO header, and that will give you IR reception in LibreElec. (I have done this with a Zero W)

Thanks, I briefly saw some examples of that. Can you configure what each remote button does even doing that?


(2017-03-19, 22:32)HiassofT Wrote: [ -> ]Run "ir-keytable -r" and see check if the correct keysyms are loaded and if "rc-6" is listed under enabled protocols. You can also check for enabled and supported protocols by running ir-keytable without any options.

If rc-6 is supported (most but not all USB IR receivers support it) but not enabled you can enabled it with "ir-keytable -p rc-6".
.
In LibreELEC we are using this keymap for the XBOX 360 remote (haven't tested it myself as I don't have such a remote):

Code:
# table xbox_360, type: RC6
0x800f7400 KEY_NUMERIC_0
...
0x800f7481 KEY_PLAYPAUSE

so long,

Hias

Thanks, RC-6 is definitebly enabled on the USB IR receiver.

(2017-03-20, 19:36)HiassofT Wrote: [ -> ]
(2017-03-20, 14:33)noggin Wrote: [ -> ]However other IR solutions, including RC6 MCE IR receivers - which are popular with Kodi users, do require LIRC to be correctly configured.
This is no longer 100% true. Most IR receivers and remotes are now supported by the kernel rc framework which means decoding is done inside the kernel and you no longer need to configure and run userspace lircd.

This even works on RPi with an IR receiver connected to GPIO, just use the gpio-ir overlay instead of lirc-rpi and an MCE remote will work out of the box (for other remotes add the rc-map-name option and/or configure the via ir-keytable or rc_maps.cfg):
Code:
dtoverlay=gpio-ir,gpio_pin=18,gpio_pull=1

Userspace lircd is still useful for remotes using odd protocols that are not supported via in-kernel decoding. So it's not completely obsolete but in most cases you no longer need it. And IMO in-kernel decoding is a lot easier to configure and use compared to lircd, so if you have the choice you should use it Smile

BTW: The next LibreELEC release 8.0.1 will include a bunch of improvements in this area, for example support for user-configurable rc_maps.cfg.

so long,

Hias

Thanks, is there a difference between running Kodi from LibreELEC or from RetroPie?

It seems like trying the GPIO method is the way to go if I want to avoid this USB hassle...
The TL;DR read seems to be :

GPIO IR can now be used two ways - kernel based and LIRC user-space based. Which is used will partially be influenced by the dtoverlay you use in config.txt.

If the Kernel supports your IR remote control then it is probably better. If your remote isn't supported by in-kernel drivers, then LIRC is the way to go.

(In my case I usually use RC6 IR USB receivers and remotes - Maplin had them on eBay for £3.99 at one point - but for the Pi Zero W I wanted to avoid using the single USB port - so used a GPIO solution with a small Hauppauge remote I had from an old USB DVB-T tuner. I use lirc for this with LibreElec.)
If you are seeing MSC events with scancode then most probably your keytable wasn't loaded (via rc_maps.cfg).

Try to load the keytable manually:
Code:
ir-keytable -c -p rc-6 -w path/to/xbox_360

The output should look like this (testing here with an rc-5 remote):
Code:
# ir-keytable -c -p rc-5 -w rc_keymaps/justboom
Read justboom table
Old keytable cleared
Wrote 12 keycode(s) to driver
Protocols changed to rc-5

Then run ir-keytable -t. You should now see the KEY events:
Code:
# ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1490117664.994119: event type EV_MSC(0x04): scancode = 0x101a
1490117664.994119: event type EV_KEY(0x01) key_down: KEY_UP(0x0001)
1490117664.994119: event type EV_SYN(0x00).
1490117665.108030: event type EV_MSC(0x04): scancode = 0x101a
1490117665.108030: event type EV_SYN(0x00).
1490117665.256126: event type EV_MSC(0x04): scancode = 0x101a
1490117665.256126: event type EV_SYN(0x00).
1490117665.502753: event type EV_KEY(0x01) key_down: KEY_UP(0x0001)
1490117665.502753: event type EV_SYN(0x00).
1490117665.529420: event type EV_KEY(0x01) key_up: KEY_UP(0x0001)
1490117665.529420: event type EV_SYN(0x00).

If you still don't get KEY events post the scancodes of a few keys and/or compare them with the scancodes in your keytable. I used the following keytable for my remote:
Code:
# table justboom, type: RC5
0x101a KEY_UP
0x101b KEY_DOWN
0x1013 KEY_LEFT
0x1014 KEY_RIGHT
0x1015 KEY_OK
0x1010 KEY_HOME
0x1012 KEY_MUTE
0x1011 KEY_POWER
0x1016 KEY_MENU
0x1017 KEY_BACK
0x1018 KEY_VOLUMEDOWN
0x1014 KEY_VOLUMEUP

If it worked so far, manually check if autoloading via /etc/rc_maps.cfg works:
Code:
ir-keytable -a /etc/rc_maps.cfg -s rc0

It should look like this (testing here on LibreELEC with slightly different paths):
Code:
# ir-keytable -a rc_maps.cfg -s rc0
Old keytable cleared
Wrote 12 keycode(s) to driver
Protocols changed to rc-5
Note that the "Wrote XX keycodes to driver" should be the same as in ir-keytable -w. If your keymap contains a header (commented first line with table and type) you'll also see the "protocol changed to...".

If you get no output at all or if you get an error like "can't load table ...." check your rc_maps.cfg file.

so long,

Hias
I seem to have taken a couple steps backwards. I tried starting over and deleting ir-keytable and reinstalling it. Now when I go to "sudo ir-keytable --test --device=/dev/input/event4", nothing gets detected. Is it possible that the remote does not have the right code for the receiver? Does the code on the remote matter? Are there random cfg files I may need to delete? I deleted the config file in /etc/rc_keymaps/

Thanks

(2017-03-21, 19:55)HiassofT Wrote: [ -> ]If you are seeing MSC events with scancode then most probably your keytable wasn't loaded (via rc_maps.cfg).

Try to load the keytable manually:
Code:
ir-keytable -c -p rc-6 -w path/to/xbox_360

The output should look like this (testing here with an rc-5 remote):
Code:
# ir-keytable -c -p rc-5 -w rc_keymaps/justboom
Read justboom table
Old keytable cleared
Wrote 12 keycode(s) to driver
Protocols changed to rc-5

Then run ir-keytable -t. You should now see the KEY events:
Code:
# ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1490117664.994119: event type EV_MSC(0x04): scancode = 0x101a
1490117664.994119: event type EV_KEY(0x01) key_down: KEY_UP(0x0001)
1490117664.994119: event type EV_SYN(0x00).
1490117665.108030: event type EV_MSC(0x04): scancode = 0x101a
1490117665.108030: event type EV_SYN(0x00).
1490117665.256126: event type EV_MSC(0x04): scancode = 0x101a
1490117665.256126: event type EV_SYN(0x00).
1490117665.502753: event type EV_KEY(0x01) key_down: KEY_UP(0x0001)
1490117665.502753: event type EV_SYN(0x00).
1490117665.529420: event type EV_KEY(0x01) key_up: KEY_UP(0x0001)
1490117665.529420: event type EV_SYN(0x00).

If you still don't get KEY events post the scancodes of a few keys and/or compare them with the scancodes in your keytable. I used the following keytable for my remote:
Code:
# table justboom, type: RC5
0x101a KEY_UP
0x101b KEY_DOWN
0x1013 KEY_LEFT
0x1014 KEY_RIGHT
0x1015 KEY_OK
0x1010 KEY_HOME
0x1012 KEY_MUTE
0x1011 KEY_POWER
0x1016 KEY_MENU
0x1017 KEY_BACK
0x1018 KEY_VOLUMEDOWN
0x1014 KEY_VOLUMEUP

If it worked so far, manually check if autoloading via /etc/rc_maps.cfg works:
Code:
ir-keytable -a /etc/rc_maps.cfg -s rc0

It should look like this (testing here on LibreELEC with slightly different paths):
Code:
# ir-keytable -a rc_maps.cfg -s rc0
Old keytable cleared
Wrote 12 keycode(s) to driver
Protocols changed to rc-5
Note that the "Wrote XX keycodes to driver" should be the same as in ir-keytable -w. If your keymap contains a header (commented first line with table and type) you'll also see the "protocol changed to...".

If you get no output at all or if you get an error like "can't load table ...." check your rc_maps.cfg file.

so long,

Hias
(2017-03-28, 07:07)mister_eff Wrote: [ -> ]I seem to have taken a couple steps backwards. I tried starting over and deleting ir-keytable and reinstalling it. Now when I go to "sudo ir-keytable --test --device=/dev/input/event4", nothing gets detected. Is it possible that the remote does not have the right code for the receiver? Does the code on the remote matter? Are there random cfg files I may need to delete? I deleted the config file in /etc/rc_keymaps/
Short answer: all of it matters. If you have the wrong protocol configured none of your IR signals will be decoded. And if you have a wrong or no keytable loaded the decoded scancodes can't be translated into keycodes.

You shouldn't delete any files, if you setup rc_maps.cfg correctly only the one matching your IR receiver will be loaded.

BTW: better run ir-keytable without the --device parameter, the input/event number can change. If you have more than 1 IR receiver you can use -s rc0 or -s rc1 ... to select the correct rc device.

so long,

Hias