Hello,
I’ve been poking around the source code trying to figure out what is going on here.
Not using LIRC (note, i couldn’t type the real command in this case because cloudflare was marking it as an attack!)
[kodiuser@kodiarch ~]$ pee-ess aux | grep lirc
kodiuser 786 0.0 0.0 10756 2216 pts/4 S+ 17:38 0:00 grep lirc
[kodiuser@kodiarch ~]$
Have keymap loaded, button press is seen as KEY_STOP by both ir-keytable -t and showkeys
sudo ir-keytable -t
Testing events. Please, press CTRL-C to abort.
1485567603.504710: event type EV_MSC(0x04): scancode = 0x84747c
1485567603.504710: event type EV_KEY(0x01) key_down: KEY_STOP(0x0080)
1485567603.504710: event type EV_SYN(0x00).
...
...
[kodiuser@kodiarch ~]$ sudo showkey
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 128 press
keycode 128 release
[kodiuser@kodiarch ~]$
This looks correct based on https://git.kernel.org/cgit/linux/kernel…/v4.10-rc5
#define KEY_STOP 128 /* AC Stop */
In Kodi, it seems that there are two look up tables, one to go from linux key to xbmc key (sym, i think?), here: https://github.com/xbmc/xbmc/blob/master…evices.cpp
xbmc/input/linux/LinuxInputDevices.cpp: { KEY_STOP , XBMCK_MEDIA_STOP },
and then one to take the xbmc key (sym) and translate it into a ‘keyname’ here https://github.com/xbmc/xbmc/blob/master…ytable.cpp
xbmc/input/XBMC_keytable.cpp:, { XBMCK_MEDIA_STOP, 0, 0, XBMCVK_MEDIA_STOP, "stop" }
However, the lookup doesn’t appear to complete successfully- the assigned keyname shown in Kodi log is ‘0’:
17:54:21 T:140491042502144 DEBUG: Keyboard: scancode: 0x88, sym: 0xff69, unicode: 0x0000, modifier: 0x0
17:54:21 T:140491042502144 DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
17:54:21 T:140491042502144 DEBUG: Previous line repeats 3 times.
17:54:21 T:140491042502144 DEBUG: OnKey: 0 (0xf200) pressed, action is
vs a working button (KEY_PLAY)
17:57:26 T:140491042502144 DEBUG: Keyboard: scancode: 0xd7, sym: 0x0155, unicode: 0x0000, modifier: 0x0
17:57:26 T:140491042502144 DEBUG: OnKey: play_pause (0xf0bd) pressed, action is PlayPause
I think this has to be happening (or, not happening) in TranslateKey, in https://github.com/xbmc/xbmc/blob/master…dStat.cpp, but i’m not clear how.
Keeping in mind my example has
17:54:21 T:140491042502144 DEBUG: Keyboard: scancode: 0x88, sym: 0xff69, unicode: 0x0000, modifier: 0x0
This lookup i think should find something (from KeyboardStat.cpp):
// Continue by trying to match both the sym and unicode. This will identify
// the majority of keypresses
else if (KeyTableLookupSymAndUnicode(keysym.sym, keysym.unicode, &keytable))
{
vkey = keytable.vkey;
ascii = keytable.ascii;
}
Which using this lookup from https://github.com/xbmc/xbmc/blob/master…ytable.cpp
bool KeyTableLookupSymAndUnicode(uint16_t sym, uint16_t unicode, XBMCKEYTABLE* keytable)
{
// If the sym being searched for is zero there will be no match (the
// unicode can be zero if the sym is non-zero)
if (sym == 0)
return false;
// Look up the sym and unicode in XBMCKeyTable
for (int i = 0; i < XBMCKeyTableSize; i++)
{ if (sym == XBMCKeyTable[i].sym && unicode == XBMCKeyTable[i].unicode)
{ *keytable = XBMCKeyTable[i];
return true;
}
}
My unicode is zero, but have non-zero sym (0xff69)
This is where I get really confused, because the format of the sym in XBMCKeyTable seems to be like XBMCK_STOP, XBMCK_PAUSE, XBMCK_REWIND, but in the log the sym are 0xff69, 0x0013, and 0x0153 respectively.
What am i missing here?