KEY_STOP not resolving to keyname stop
#1
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!)
Code:
[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
Code:
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
Code:
#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
Code:
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
Code:
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':
Code:
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)
Code:
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...rdStat.cpp, but i'm not clear how.


Keeping in mind my example has
Code:
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):
Code:
// 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
Code:
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?
Reply
#2
I am having the exact same problem trying to get the stop key to work on my remote. I tried mapping it to KEY_X, KEY_STOP, and KEY_STOPCD. As with you ir-keytable shows that these mappings are working but Kodi reports a key value of 0 for all.

Did you ever solve this?

EDIT: I was not able to directly solve this issue. However, as a workaround I used the Keymap Editor add-on (under Program Addons in the Kodi repository). Via this tool was able to directly link the stop button on my remote to the Stop function in Kodi. The default setting for Stop was "s", and when pressing the button on my remote it was changed to "61952". If you did not want to use this program add-on you might want to try mapping your Stop button to "KEY_S".


(2017-01-28, 05:26)thenextdon13 Wrote: 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!)
[
....

What am i missing here?
Reply
#3
I similarly worked around by assigning my remote keycode to something other than 'Stop'.. i think, similarly to you, I coded it to be a keypress such as "KEY_S"

c
Reply

Logout Mark Read Team Forum Stats Members Help
KEY_STOP not resolving to keyname stop0