Solved Add missing scancodes to XBMC ?
#1
Few of the scancodes of the media keys on my rf remote aren't included in XBMC (FastForward, Rewind, Play and Record).

I wouldn't bother to ask adding misc scancodes to XBMC but it looks like these are known scancodes and in both Windows and Gnome-Linux these keys recognized and working pretty well (except Record).

On all platforms Record isn't recognize in XBMC.
On OpenELEC Xorg (Generic) FF, RR and Record doesn't work.
On OpenELEC Raspberry Pi (Generic) FF, RR, Play and Record doesn't work.

As FF, RR and Play does work on Windows and Gnome-Linux I'm guessing there's a standard to these scancodes and that the system key mapping preceed XBMC so XBMC doesn't get the original scancode but another that it does recognize.
I must admit that I've failed to find where these are re-mapped on Gnome-Linux (maybe lirc ?).

If there is such standard I didn't found any resource on it but I did found similar users' posts with the same scancodes (and more scancodes of different buttons) so it may worth to add these to XBMC.
https://github.com/OpenELEC/OpenELEC.tv/issues/1312
http://ubuntuforums.org/showthread.php?t=1890156

OpenELEC Xorg (Generic) v3.1.5
Code:
RR
20:36:25 T:139738803738432   DEBUG: Keyboard: scancode: b0, sym: 0153, unicode: 0000, modifier: 0
20:36:25 T:139738803738432   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
FF
20:36:29 T:139738803738432   DEBUG: Keyboard: scancode: d8, sym: 0157, unicode: 0000, modifier: 0
20:36:29 T:139738803738432   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
Play
20:36:27 T:139738803738432   DEBUG: Keyboard: scancode: d7, sym: 0155, unicode: 0000, modifier: 0
20:36:27 T:139738803738432   DEBUG: OnKey: play_pause (f0bd) pressed, action is Play
Record
20:36:30 T:139738803738432   DEBUG: Keyboard: scancode: af, sym: 0152, unicode: 0000, modifier: 0
20:36:30 T:139738803738432   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200

OpenELEC Raspberry Pi, Rbej Gotham build
Code:
RR
00:10:06 T:3070140416   DEBUG: Keyboard: scancode: 0xa8, sym: 0x0153, unicode: 0x0000, modifier: 0x0
00:10:06 T:3070140416   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
FF
00:10:26 T:3070140416   DEBUG: Keyboard: scancode: 0xd0, sym: 0x0157, unicode: 0x0000, modifier: 0x0
00:10:26 T:3070140416   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
Play
00:09:39 T:3070140416   DEBUG: Keyboard: scancode: 0xcf, sym: 0x0155, unicode: 0x0000, modifier: 0x0
00:09:39 T:3070140416   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
Record
00:10:40 T:3070140416   DEBUG: Keyboard: scancode: 0xa7, sym: 0x0152, unicode: 0x0000, modifier: 0x0
00:10:40 T:3070140416   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200

Linux-Gnome, XBMC 12.2
Code:
RR
  Keyboard: scancode: b0, sym: 0072, unicode: 0000, modifier: 1000
  OnKey: r (f052) pressed, action is Rewind
FF
  Keyboard: scancode: d8, sym: 0066, unicode: 0000, modifier: 1000
  OnKey: f (f046) pressed, action is FastForward
Play
  Keyboard: scancode: d7, sym: 00b3, unicode: 0000, modifier: 1000
  OnKey: play_pause (f0bd) pressed, action is Pause
Record
  Keyboard: scancode: af, sym: 0000, unicode: 0000, modifier: 1000
  GetActionCode: Trying Hardy keycode for 0xf200

Windows, Gotham alpha6
Code:
RR
20:50:22 T:4620   DEBUG: WinEventsWin32.cpp: APPCOMMAND 50
20:50:22 T:4620   DEBUG: CApplication::OnAppCommand: appcommand 50, trying action Rewind
FF
20:50:25 T:4620   DEBUG: WinEventsWin32.cpp: APPCOMMAND 49
20:50:25 T:4620   DEBUG: CApplication::OnAppCommand: appcommand 49, trying action FastForward
Play
20:50:23 T:4620   DEBUG: WinEventsWin32.cpp: APPCOMMAND 46
20:50:23 T:4620   DEBUG: CApplication::OnAppCommand: appcommand 46, trying action Play
Record
20:50:26 T:4620   DEBUG: WinEventsWin32.cpp: APPCOMMAND 48
20:50:26 T:4620   DEBUG: CApplication::OnAppCommand: unknown appcommand 48
Reply
#2
AFAIK you can't detect those media keys with scancodes only. OE is lacking an input method. As a result XOpenIM fails and it creates no input context which is required for detecting those keys.
I think if OE adds required modules to Linux, it should work.
Reply
#3
Thanks FernetMenta, I guess I'll bug OpenELEC dev's.

What about the Record button ?

It isn't recognize by XBMC on Windows (although the APPCOMMAND 48 isn't special).

On Gnome-Linux the button isn't recognize by XBMC but looks like it does mapped to the proper keycode by the system,
here's the output of xev:

Code:
KeyPress event, serial 33, synthetic NO, window 0x2200001,
    root 0x2b8, subw 0x2200002, time 49111771, (62,58), root:(772,494),
    state 0x10, keycode 175 (keysym 0x1008ff1c, XF86AudioRecord), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2200001,
    root 0x2b8, subw 0x2200002, time 49111931, (62,58), root:(772,494),
    state 0x10, keycode 175 (keysym 0x1008ff1c, XF86AudioRecord), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
Reply
#4
OE and XBMC mainline differ in this case. OE already uses new interface to X11, mainline still the old SDL lib.

I have mapped audio record:
https://github.com/FernetMenta/xbmc/blob...1.cpp#L152

could you try this version: http://forum.xbmc.org/showthread.php?tid=116996 or compile my master branch. If those keys do not work, I can fix it.
Reply
#5
FernetMenta, I've compiled from your master branch on Arch Linux x86_64, Gnome 3.8 and it looks like RR, FF and Record aren't recognized in XBMC (so it the same as OpenELEC Xorg (Generic) ).

Code:
RR
14:26:28 T:140350372415424   DEBUG: Keyboard: scancode: 0xb0, sym: 0x0153, unicode: 0x0000, modifier: 0x0
14:26:28 T:140350372415424   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200

FF
14:26:32 T:140350372415424   DEBUG: Keyboard: scancode: 0xd8, sym: 0x0157, unicode: 0x0000, modifier: 0x0
14:26:32 T:140350372415424   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200

Play
14:26:29 T:140350372415424   DEBUG: Keyboard: scancode: 0xd7, sym: 0x0155, unicode: 0x0000, modifier: 0x0
14:26:29 T:140350372415424   DEBUG: OnKey: play_pause (0xf0bd) pressed, action is Play

Record
14:26:32 T:140350372415424   DEBUG: Keyboard: scancode: 0xaf, sym: 0x0152, unicode: 0x0000, modifier: 0x0
14:26:32 T:140350372415424   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200

Edit:

This XBMC build also doesn't differentiate between regular number keys to numpad number keys.

Code:
Zero
14:55:07 T:139898341554112   DEBUG: Keyboard: scancode: 0x13, sym: 0x0030, unicode: 0x0030, modifier: 0x0
14:55:07 T:139898341554112   DEBUG: OnKey: zero (0xf030) pressed, action is Number0
Numpad Zero
14:55:08 T:139898341554112   DEBUG: Keyboard: scancode: 0x5a, sym: 0xff9e, unicode: 0x0030, modifier: 0x0
14:55:08 T:139898341554112   DEBUG: OnKey: zero (0xf030) pressed, action is Number0


Edit 2:

1. So this is a general issue with the move from SDL to X11 ?
2. These scancodes aren't known to X11 (not set in XF86keysym.h) so this means one need to create xmodmap to be able to use such media keys ?
3. Why the numpad number keys are recognized as regular number keys in XBMC ?
4. What about the Rasbperry Pi that don't use X11 ?
Reply
#6
can you try this? https://github.com/FernetMenta/xbmc/comm...1aadcd0a7e

at least it fixes mumbad keys.

1.) nope,
2.) i would be interest if the fix changes anything to those keysymx not known
4.) on Linux there are various ways to determine key presses. AFAIK rpi uses evdev. the advantage of X11 is that it allows that a user remaps keys.

EDIT: this should fix it for OE (X11): https://github.com/FernetMenta/xbmc/comm...2df907fcf6
Reply
#7
Thanks FernetMenta, I've tried the first commit and it does fix the numpads but the FF, RR and Record still aren't recognized.

I'll recompile XBMC with the second commit and try again.
Reply
#8
I don't have a multi media keyboard and can't try myself. you could try inserting this: XLookupString(&xevent.xkey, NULL, 0, &xkeysym, NULL);
instead of the deleted line in https://github.com/FernetMenta/xbmc/comm...1aadcd0a7e

for some reason translation of scancode to keysym does not work for those.
Reply
#9
I changed this commit to: https://github.com/FernetMenta/xbmc/comm...05fe87e9d4

looking at the code of xev they do the same thing.
Reply
#10
I've compile XBMC with the last commit and I'm not sure what is going on.

If I map the RR button (keycode 176 == 0xb0) with xmodmap to XF86AudioPlay it does recognized by XBMC.
If I map the RR button to XF86AudioRewind it doesn't recognized by XBMC.

Same goes to Record and FF.
Reply
#11
I can reproduce by mapping some key to XF86AudioRewind. will investigate.
Reply
#12
the problem is deeper in XBMC, there is a special treatment for Windows but none for the other platforms. here is a fix:
https://github.com/FernetMenta/xbmc/comm...ba044aacc3
Reply
#13
Thanks FernetMenta, this is working great on Gnome 3.8 - Arch Linux x86_64.

Probably need to bug a Windows' dev to add support for the Record button on Windows (that's "APPCOMMAND 48").
Maybe adding "APPCOMMAND_MEDIA_RECORD" in ButtonTranslator.cpp ?
Reply
#14
I would drop the entire appcommand handling in ButtonTranslator. This should be moved to windowing. The various platforms should send XMBCK_* events to application like I do in this new X11 implementation.
Reply
#15
FernetMenta,
Are you planning to add your changes to XBMC mainline as fixes or much later on as one PR that will move XBMC from SDL to use X11 ?
(I hope I'm not mixing up).
Reply

Logout Mark Read Team Forum Stats Members Help
Add missing scancodes to XBMC ?0