0

As the current kernel no longer supports lirc-rpi I had to switch to gpio-ir

Therefore I changed the line in /boot/config.txt to

dtoverlay=gpio-ir,gpio_pin=25

Using ir-keytable I found out that my remote uses nec protocol and I created a custom remote profile I placed in /etc/rc_keymaps/ and load it on every reboot via rc.local:

/usr/bin/ir-keytable -c -w /etc/rc_keymaps/lg

For handling the IR commands I replaced lirc with inputlirc (configured via /etc/lirc/lircrc) which works for all rc-keys except the number keys. Those keys are correctly recognized by ir-keytable:

ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1558891160.930963: event type EV_MSC(0x04): scancode = 0x101041
1558891160.930963: event type EV_KEY(0x01) key_down: KEY_1(0x0002)
1558891160.930963: event type EV_SYN(0x00).
1558891160.990956: event type EV_MSC(0x04): scancode = 0x101041
1558891160.990956: event type EV_SYN(0x00).
1558891161.120881: event type EV_KEY(0x01) key_up: KEY_1(0x0002)
1558891161.120881: event type EV_SYN(0x00).

Also if I stop inputlirc service and use instead sudo evtest /dev/input/event0 the number keys are correctly recognized:

Event: time 1558891363.890958, type 4 (EV_MSC), code 4 (MSC_SCAN), value 101041
Event: time 1558891363.890958, type 1 (EV_KEY), code 2 (KEY_1), value 1
Event: time 1558891363.890958, -------------- SYN_REPORT ------------
Event: time 1558891363.960945, type 4 (EV_MSC), code 4 (MSC_SCAN), value 101041

From my perspective I would assume that a KEY_1 of ir-keytable is not the same as a KEY_1 of inputlirc. How can the one or the other be configured in a way so that they agree on the same value for KEY_1 and the other numeric keys?

Robert
  • 338
  • 2
  • 3
  • 11

1 Answers1

0

I found the reason for this behavior:

By default inputlirc filters out all keys that have a key code of less than 88. This seems to some sort of security restriction:

Minimum keycode to send to LIRC clients. Keycodes lower than this number are filtered out. The default is 88, this filters out the alphanumeric section and the keypad section of normal keyboards, but allows all extended keys. The rationale is that clients should not be able to grab normal keypresses, this could be a security risk. (from inputlircd man page)

Therefore the following keys are by default disabled in inputlirc:

KEY_ESC KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_0 KEY_MINUS KEY_EQUAL KEY_BACKSPACE KEY_TAB KEY_Q KEY_W KEY_E KEY_R KEY_T KEY_Y KEY_U KEY_I KEY_O KEY_P KEY_LEFTBRACE KEY_RIGHTBRACE KEY_ENTER KEY_LEFTCTRL KEY_A KEY_S KEY_D KEY_F KEY_G KEY_H KEY_J KEY_K KEY_L KEY_SEMICOLON KEY_APOSTROPHE KEY_GRAVE KEY_LEFTSHIFT KEY_BACKSLASH KEY_Z KEY_X KEY_C KEY_V KEY_B KEY_N KEY_M KEY_COMMA KEY_DOT KEY_SLASH KEY_RIGHTSHIFT KEY_KPASTERISK KEY_LEFTALT KEY_SPACE KEY_CAPSLOCK KEY_F1 KEY_F2 KEY_F3 KEY_F4 KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_F10 KEY_NUMLOCK KEY_SCROLLLOCK KEY_KP7 KEY_KP8 KEY_KP9 KEY_KPMINUS KEY_KP4 KEY_KP5 KEY_KP6 KEY_KPPLUS KEY_KP1 KEY_KP2 KEY_KP3 KEY_KP0 KEY_KPDOT KEY_ZENKAKUHANKAKU KEY_102ND KEY_F11 KEY_F12

In the end I had to edit the file /etc/default/inputlirc and set the OPTIONS line to:

OPTIONS=" -m 0 "
Robert
  • 338
  • 2
  • 3
  • 11