keymap.xml "key id" help
#1
Hi Guys,
I want to map my multimedia keys (play/next etc) to the XBMC Keymap.xml file. I saw this line:

Quote: <launch_mail></launch_mail>
<key id="61620"></key> <!-- same as above, launch_mail, but using button code (based on vkey id) -->

But when I test "launch mail" key in PassMark Keyboard Test, it sais that the key id is 180 (0xb4). So my question is - where did the 61620 value came from? and how can I tell which is the value for the other MM keys?

I have tried to search the forums for the vkey_id list but didn't find any helpful info.

Any help will be appreciated Smile
Reply
#2
I am on the same quest. Even though I have been unable to get it to work using the key id, below is the topic that explains where the number comes from.

Post #14
http://forum.xbmc.org/showthread.php?tid=26796&page=2

And I did find another way of getting the Dell Media buttons(I have a Vostro 1500) to work in the below topic. I haven't tested it yet.
http://forum.xbmc.org/showthread.php?tid=39189

If you do get it to work directly using only the keymap.xml, please post instructions.

Also, I actually have XBMC run on a Windows XP Pro PC behind the TV. I use Synergy2 to control it using my laptop keyboard and mouse. Synergy does allow me to map my Media Keys to the correct keys (Media Stop maps to "x") without editing the keymap.xml file. As long as I'm connected using Synergy, my media keys are remapped on the Synergy client XBMC server.

Hope some of this was helpful.
Reply
#3
OK, I found a way to get the correct key id for use in XBMC. I couldn't get them to work earlier because for some reason XBMC is coming up with different key code's than other programs, i.e. my "Play/Pause" shows as" XBMC=186 / All Other programs=179. So of course I had to use the key id XBMC came up with. Still haven't figured out why XBMC comes up with different key code.

First, go to "Settings". Then go to "System". Click "Enable Debug Logging". Now exit XBMC.

Now go to "%userprofile%\Application Data\XBMC"(C:\Documents and Settings\yourusername\Application Data\XBMC), you will find the debug log named "xbmc.log".
That is where I got the key id codes that XBMC would register when I pressed my media keys.

Open XBMC. With the window focused, press the media key you want a key id for. For example, I would press my "Play/Pause" button say ten times in a row so it was easy to find in the log. It would show as the following, but of course ten times in a row:

Code:
DEBUG: CApplication::OnKey: 61626 pressed, action is 0

Then enter that key id in the global "Keyboard" section of keymap.xml like shown:

Code:
<keymap>
  <global>
    <keyboard>
      -rest of the global preset keyboard keys here-
      <key id="61626">Pause</key>
    </keyboard>
  </global>


For me, the only two that registered was my "Play/Pause" and my "Volume Up" button. The rest showed as something similar to:

Code:
DEBUG: SDLKeyboard found something unknown (unicode <> printable ASCII): scancode: 36, sym: 106, unicode: 0, modifier: 0


So those are not working since XBMC can't get a key id. From what I get that means that the "key" hasn't been programed into XBMC and so it doesn't know what it is. I'm still researching that. I will post if I find anything.


Dell Vostro 1500 XP Pro w/ Front Media Keys
Reply
#4
Hello! Did you find any solution for this? Smile
Reply
#5
I need to know this as well.
Reply
#6
@mehturt: the XBMC world has moved on since July 2009. If you grab mceremote.zip from http://xbmcmce.sourceforge.net/ it includes an app called ShowKey that identified keypresses and tells you what to add to keyboard.xml to support them.

JR
Reply
#7
I'm on Linux
Reply
#8
That's not helping with me. XBMC is also coming up with different IDs to ShowKey. I've tried both, neither work.

Code:
<keymap>
  <global>
    <keyboard>
      <key id="124">XBMC.ActivateWindow(MyPictures)</key id="124"> <!-- F13 -->
      <key id="125">XBMC.ActivateWindow(MyVideos)</key id="125"> <!-- F14 -->
      <key id="126">XBMC.ActivateWindow(MyMusic)</key id="126"> <!-- F15 -->
    </keyboard>
  </global>
</keymap>

I can just map them to F10-12, but i'd prefer something not on the keyboard as it's a remote sending them.
Reply
#9
Hmm, checking on the MS web site the key codes for F13 - 15 are:

Code:
#define VK_F13            0x7C
#define VK_F14            0x7D
#define VK_F15            0x7E

and this is what XBMC uses. Is the <key id="124">etc what ShowKey suggested for the keyboard.xml entry?

Aha! Just spotted the beginners error :-) Your keyboard.xml should be:

Code:
<keymap>
  <global>
    <keyboard>
      <key id="124">XBMC.ActivateWindow(MyPictures)</key> <!-- F13 -->
      <key id="125">XBMC.ActivateWindow(MyVideos)</key> <!-- F14 -->
      <key id="126">XBMC.ActivateWindow(MyMusic)</key> <!-- F15 -->
    </keyboard>
  </global>
</keymap>

The </key id="124"> etc will be causing your keyboard.xml to fail to load. If you turn debug logging on and start XBMC you'll see the error message in xbmc.log.

Actually I think you can use:

Code:
<keymap>
  <global>
    <keyboard>
      <f13>XBMC.ActivateWindow(MyPictures)</f13>
      <f14>XBMC.ActivateWindow(MyVideos)</f14>
      <f15>XBMC.ActivateWindow(MyMusic)</f15>
    </keyboard>
  </global>
</keymap>

JR
Reply
#10
Quote:and this is what XBMC uses. Is the <key id="124">etc what ShowKey suggested for the keyboard.xml entry?
Yes.

Quote:The </key id="124"> etc will be causing your keyboard.xml to fail to load. If you turn debug logging on and start XBMC you'll see the error message in xbmc.log
It was </key> in the xml. I probably didn't copy it again after editing. (ShowKey puts </key id="124">)

Quote:Actually I think you can use:

Code:
<keymap>
  <global>
    <keyboard>
      <f13>XBMC.ActivateWindow(MyPictures)</f13>
      <f14>XBMC.ActivateWindow(MyVideos)</f14>
      <f15>XBMC.ActivateWindow(MyMusic)</f15>
    </keyboard>
  </global>
</keymap>

Tried that first. I get unknown key f13 or something like that.
Reply
#11
jfgi Wrote:It was </key> in the xml. I probably didn't copy it again after editing. (ShowKey puts </key id="124">)

Oops, that's a bug in ShowKey.

Try:

<key id="61563">Notification(Key, f12, 3)</key> <!-- F12 -->
<key id="61564">Notification(Key, f13, 3)</key> <!-- F13 -->
<key id="61565">Notification(Key, f14, 3)</key> <!-- F14 -->
<key id="61566">Notification(Key, f15, 3)</key> <!-- F15 -->

I've included F12 because I don't have F13 upwards on my keyboard but pressing F12 does display the notification.

The mysterious numbers are the key codes ORd with 0xF000. Internally XBMC ORs all key codes with 0xF000 for reasons that escape me. I didn't think you needed to OR codes entered using the <key id="nnn"> syntax, but obviously you do. I'll have a grub around in the code to see why.

JR
Reply
#12
jhsrennie Wrote:Internally XBMC ORs all key codes with 0xF000 for reasons that escape me.
This is what I read somewhere on the web as well.. But looking at XBMC logs this was not true for some keys..
Reply

Logout Mark Read Team Forum Stats Members Help
keymap.xml "key id" help0