Kodi Community Forum

Full Version: "record" button on keyboard not recognised by xbmc
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I have a MS Wireless Entertainment Desktop keyboard hooked up to my XBMC PC.

Most of the buttons work just fine (play/pause, ff, rw, volume) but the keyboard lacks a stop button. Instead, I've been trying to map the Record button to be the stop button.

The problem: I can't get XBMC to see it.

Here's what I've done in Keymap.xml:

<keymap>
<global>
<keyboard>
<record>Stop</record>
</keyboard>
<remote>
<record>Stop</record>
</remote>
</global>
</keymap>

When I start XBMC I get this:
Code:
01:48:02 T:1261738000 M:1581006848    INFO: Loading special://xbmc/system/Keymap.xml
01:48:02 T:1261738000 M:1581006848    INFO: Loading special://profile/Keymap.xml
01:48:02 T:1261738000 M:1581006848   ERROR: Keyboard Translator: Can't find button record

So it seems like XBMC isn't programmed to recognise this button.

If I press play/pause followed by record, I have:

Code:
01:49:58 T:1261738000 M:1558769664   DEBUG: SDLKeyboard: scancode: 172, sym: 0, unicode: 0, modifier: 0
01:49:58 T:1261738000 M:1558769664   DEBUG: GetActionCode: Trying Hardy keycode for 0xffb3
01:49:58 T:1261738000 M:1558769664   DEBUG: GetActionCode: Trying Hardy keycode for 0xffb3
01:49:58 T:1261738000 M:1558769664   DEBUG: OnKey: 65459 pressed, action is 79
01:49:59 T:1261738000 M:1558773760   DEBUG: HAL: Device (/org/freedesktop/Hal/devices/usb_device_45e_717_0017FAD028BE_if0_logicaldev_input) Condition ButtonPressed | play-pause
01:50:00 T:1261738000 M:1558773760   DEBUG: SDLKeyboard: scancode: 175, sym: 0, unicode: 0, modifier: 0
01:50:00 T:1261738000 M:1558773760   DEBUG: HAL: Device (/org/freedesktop/Hal/devices/usb_device_45e_717_0017FAD028BE_if0_logicaldev_input) Condition ButtonPressed | record

Is it significant that there is no OnKey line for record?

Thanks for any pointers.

H

Edit: I should add I'm running Xubuntu 9.04 + latest XBMC from the team-xbmc ppa.
try <key id="65405">Stop</key> i *think* that should work
No good. Can I ask how you arrived at that code? Perhaps I can do some research in that direction.
ehrr, math error ;P

0xFF00 + keycode
Sorry, this isn't making sense to me *looks sheepish*

keycode = scancode?

FF00 = 65280, + 172 (the SC for play/pause) = 65452 = 0xFFAC

but according to the log
Code:
02:34:13 T:1388501008 M:1511378944   DEBUG: SDLKeyboard: scancode: 172, sym: 0, unicode: 0, modifier: 0
02:34:13 T:1388501008 M:1511378944   DEBUG: GetActionCode: Trying Hardy keycode for 0xffb3
02:34:13 T:1388501008 M:1511378944   DEBUG: OnKey: 65459 pressed, action is 79

What am I missing?
Code:
#ifdef _LINUX
  // Some buttoncodes changed in Hardy
  if (wAction == 0 && (wKey & KEY_VKEY) == KEY_VKEY && (wKey & (DWORD)0x0F00)) {
    CLog::Log(LOGDEBUG, "%s: Trying Hardy keycode for %#04x", __FUNCTION__, wKey);
    wKey &= ~(DWORD)0x0F00;
    buttonMap::iterator it2 = (*it).second.find(wKey);
    while (it2 != (*it).second.end())
    {
      wAction = (*it2).second.wID;
      strAction = (*it2).second.strID;
      it2 = (*it).second.end();
    }
  }
#endif

i'm too tired to think straight atm, that is from ButtonTranslator.cpp (dunno if you speak c)
okay, i couldn't quite give up ;P

from SDLKeyboard.cpp
Code:
// based on the evdev mapped scancodes in /user/share/X11/xkb/keycodes
with that info i found

Code:
playpause = 172 -> 164 = b3 -> 0xffb3 (0xFF00 + 0x00B3)

hence record should be
Code:
record = 179 -> 167 = b6 -> 0xFFB6
alas, still no luck Smile but you've given me some stuff to think about so I'll do some more research.

The thing that gets me a little bit is, yeah this makes total sense for these buttons, but look at volume_up:

Code:
03:15:50 T:3005671440 M:1577381888   DEBUG: SDLKeyboard: scancode: 123, sym: 0, unicode: 0, modifier: 0
03:15:50 T:3005671440 M:1577381888   DEBUG: GetActionCode: Trying Hardy keycode for 0xffaf
03:15:50 T:3005671440 M:1577381888   DEBUG: GetActionCode: Trying Hardy keycode for 0xffaf
03:15:50 T:3005671440 M:1577381888   DEBUG: GetActionCode: Trying Hardy keycode for 0xffaf
03:15:50 T:3005671440 M:1577381888   DEBUG: GetActionCode: Trying Hardy keycode for 0xffaf
03:15:50 T:3005671440 M:1577381888   DEBUG: OnKey: 65455 pressed, action is 88
03:15:51 T:3005671440 M:1577381888   DEBUG: HAL: Device (/org/freedesktop/Hal/devices/usb_device_45e_717_0017FAD028BE_if0_logicaldev_input) Condition ButtonPressed | volume-up

scancode 123 -> keycode AF (175). That's not in evdev.

* hjbotha wanders off to have a look at SDLKeyboard.cpp

Edit:
Oh btw, that snippet of ButtonTranslator you posted was interesting for this bit:
Code:
if (wAction == 0 && (wKey & KEY_VKEY) == KEY_VKEY && (wKey & (DWORD)0x0F00)) {
    CLog::Log(LOGDEBUG, "%s: Trying Hardy keycode for %#04x", __FUNCTION__, wKey);

I never get that Hardy message for this button, whereas I do get it for others, so that if statement is returning false. Again, I don't know how relevant this is, but if that part is really important then no way any of this will make any difference. Smile
Quick update...

In SDLKeyboard.cpp there's this line
Code:
//else if (m_keyEvent.key.keysym.scancode == 167) m_VKey = 0xb3; // Record

Note that it's commented in the source.

I've changed it to
Code:
else if (m_keyEvent.key.keysym.scancode == 175) m_VKey = 0xb6; // Record

but unfortunately I'm having some instability on this system at the moment so I can't recompile to test. I'll post here once I manage it.
Success \o/

xbmc/ButtonTranslator.cpp:
Code:
else if (strKey.Equals("record")) wButtonCode = 0xF0B7;

guilib/common/SDLKeyboard.cpp
Code:
else if (m_keyEvent.key.keysym.scancode == 175) m_VKey = 0xb7; // Record

and in ~/.xbmc/userdata/Keymap.xml:
Code:
<keymap>
  <global>
    <keyboard>
      <record>Stop</record>
    </keyboard>
  </global>
</keymap>

I probably could have just put the line into SDLKeyboard.cpp and that would have let me assign an action to the key ID, but by also putting it in ButtonTranslator I could assign it to "record".

Thanks spiff

H