Since the remote is supported by the kernel it's best to create an ir-keytable file instead of using userspace lircd.
First stop eventlircd and kodi so they don't interfere:
systemctl stop kodi
systemctl stop eventlircd
Then we need to find out which protocol the remote is using. To do that we need some info about the IR receiver which we can get with "ir-keytable". The output should look like this:
LibreELEC:~ # ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event1) with:
Driver (null), table rc-dib0700-rc5
Supported protocols: rc-5 nec rc-6
Enabled protocols: rc-5
Name: IR-receiver inside an USB DVB re
bus: 3, vendor/product: 2040:7060, version: 0x0100
Repeat delay = 500 ms, repeat period = 125 ms
The important things are the supported and enabled protocols. Since you already got scancode output from "ir-keytable -t" you only need to test within the "Enabled protocols", otherwise you'd need to go through all "Supported protocols" (except "lirc", which isn't a real protocol).
Now test with each protocol if you get scancode output. Run the following command (change the protocol after "-p") and press buttons on your remote.
If you get no event output try the next protocol.
If you set the correct protocol the output should look like this - note the EV_MSC events with "scancode = ..."
LibreELEC:~ # ir-keytable -p nec -t
Protocols changed to nec
Testing events. Please, press CTRL-C to abort.
1491293447.763188: event type EV_MSC(0x04): scancode = 0x847908
1491293447.763188: event type EV_SYN(0x00).
1491293448.029412: event type EV_MSC(0x04): scancode = 0x847908
1491293448.029412: event type EV_SYN(0x00).
1491293448.351181: event type EV_MSC(0x04): scancode = 0x847908
1491293448.351181: event type EV_SYN(0x00).
(BTW: the output above is with a WDTV live remote which I happened to have sitting in a box)
Now that we have determined the protocol we can create a keytable file for the remote in /storage/.config/rc_keymaps/ - let's name it "wdtv-live". Open another ssh session and start an editor (keep "ir-keytable -t" running in the other session, we need that to get the scancodes).
nano /storage/.config/rc_keymaps/wdtv-live
In the very first line we have to put a header with the name of the table (the actual name is not important, better avoid blanks in it but you can name it anything you like) and the protocol (after "type: "). The protocol is the important thing here. The header should look like this:
# table wdtv-live, type: NEC
Now we have to map the buttons. Press a button on the remote, record the scancode you got from ir-keytable (the 0x... code after "scancode = ...") and add it to the keytable file together with the key name. Note: you have to use the official linux keynames as listed in linux/include/uapi/linux/input-event-codes.h - Elixir - Free Electrons
When you're done the keytable file should look like this:
# table wdtv-live, type: nec
0x847905 KEY_UP
0x847900 KEY_DOWN
0x847907 KEY_LEFT
0x847909 KEY_RIGHT
0x847908 KEY_OK
0x84791b KEY_BACK
CTRL+O to save and CTRL+X to exit when done
Save the file, stop "ir-keytable -t" and test if the keytable file is correct. Run the following command (it clears the current kernel keytable, loads your newly created one and then starts test mode) and press keys on the remote. Note that you should now also see EV_KEY events with the keycodes:
LibreELEC:~ # ir-keytable -c -w /storage/.config/rc_keymaps/wdtv-live -t
Read wdtv-live table
Old keytable cleared
Wrote 6 keycode(s) to driver
Protocols changed to nec
Testing events. Please, press CTRL-C to abort.
1491296520.391503: event type EV_MSC(0x04): scancode = 0x847907
1491296520.391503: event type EV_KEY(0x01) key_down: KEY_LEFT(0x0001)
1491296520.391503: event type EV_SYN(0x00).
1491296520.644387: event type EV_KEY(0x01) key_up: KEY_LEFT(0x0001)
1491296520.644387: event type EV_SYN(0x00).
1491296522.156906: event type EV_MSC(0x04): scancode = 0x847908
1491296522.156906: event type EV_KEY(0x01) key_down: KEY_OK(0x0001)
1491296522.156906: event type EV_SYN(0x00).
1491296522.431047: event type EV_KEY(0x01) key_up: KEY_OK(0x0001)
1491296522.431047: event type EV_SYN(0x00).
Display More
To make this permanent create a rc_maps.cfg file in /storage/.config/
nano /storage/.config/rc_maps.cfg
Insert the following line to automatically load your keymap (on any ir receiver with any kernel default keymap):
Save the file, then run the following command to test if everything's setup correctly:
LibreELEC:~ # ir-keytable -a /storage/.config/rc_maps.cfg
Old keytable cleared
Wrote 6 keycode(s) to driver
Protocols changed to nec
systemctl start kodi allows starting kodi and testing.
so long,
Hias