Kodi Community Forum

Full Version: Keyboard.xml -- Modifying Your Keyboard Mapping
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've been reading some Wiki articles (HOW-TO:Modify keyboard.xml and Keymap) on modifying how XBMC responds to keyboard input. So far I've learned that:

1. There can be two copies of keyboard.xml on every installation. One is in the Userdata folder and the other is in... I don't know where, actually.

2. Users only need to (and should only) edit the keyboard.xml that is in the Userdata folder. (Which must be created on first use, as it doesn't not exist by default).

3. XBMC first reads the /Userdata/Keyboard.xml (if it exists at all) for any given keypress and if there's an entry for that keypress, it looks no further. But if there is no entry in /Userdata/Keyboard.xml, then it looks in the other keyboard.xml file (the default file) and executes accordingly.

I plan to write a custom keyboard.xml for my Android devices, but I want to look at the default one first. Does anyone know where it is on an Android system? The Wiki says, "The keymap configuration files that ship with xbmc are stored in the "/system/keymaps/" folder within the xbmc root directory. On an Windows 7 system that would be \program files(x86)\XBMC\, but where is the equivalent folder for Android?
I would imagine it is in /data/data/org.xbmc.xbmc on android. You'll need root to get to that location though.

Better yet: keyboardmap.xml in the XBMC sources: https://github.com/xbmc/xbmc/blob/master...yboard.xml
How can I change and edit files for remote control in android? Have a harmony touch remote so I can add any device there, but need to get android and xbmc to respond to the device I add right? Android uses /etc/remote.conf I think? And then remote.xml that matches in user data? Tried with pivos remote.conf but only direction keys, OK and exit worked. No stop, play, pause buttons
Enable debugging for the debug log (wiki) and then press various keys. XBMC.log should record something if XBMC is able to get the signal at that point. If XBMC isn't getting the signal at that point, then... hmm, actually, I'm not sure how one would enable other IR remotes in Android. Maybe someone else can fill in that bit?
Ok, Ill try to see what I can find in the debug.log. What kind of lines should I look for in the log?
I have confirmed that this works. It takes some trickery with checking the debug log and finding what key xbmc is interpreting your input as. Once you have this, you can edit the keyboard.xml file in userdata to match the key found in the logs. Worked great for me, successfully mapped my backspace and escape keys to back and previousdir. XBMC was actually seeing backspace as delete and escape was unknown. FYI, numbers in debug log are in hex. Look for something along the lines of:

DEBUG: *what xbmc sees as key* (0x*number*) ..., actions is...

The 0x*number is what you are interested in when mapping in your keyboard.xml.
(2013-03-19, 18:34)tprins228 Wrote: [ -> ]I have confirmed that this works. It takes some trickery with checking the debug log and finding what key xbmc is interpreting your input as. Once you have this, you can edit the keyboard.xml file in userdata to match the key found in the logs. Worked great for me, successfully mapped my backspace and escape keys to back and previousdir. XBMC was actually seeing backspace as delete and escape was unknown. FYI, numbers in debug log are in hex. Look for something along the lines of:

DEBUG: *what xbmc sees as key* (0x*number*) ..., actions is...

The 0x*number is what you are interested in when mapping in your keyboard.xml.

@tprins228

What model keyboard are you using? What Android device are you using? Would you mind terribly sharing your modified keyboard.xml file, please?
Here is my keyboard.xml. I used KeyMapEdit to adjust it. Keep in mind, THIS XML MAY NOT WORK FOR YOU!!!! I used debugging to find my specific keys and changed the xml accordingly.

keyboard.xml
Code:
<!-- This file contains the mapping of keys (gamepad, remote, and keyboard) to actions within XBMC -->
<!-- The <global> section is a fall through - they will only be used if the button is not          -->
<!-- used in the current window's section.  Note that there is only handling                       -->
<!-- for a single action per button at this stage.                                                 -->
<!-- For joystick/gamepad configuration under linux/win32, see below as it differs from xbox       -->
<!-- gamepads.                                                                                     -->
<!-- The format is:                      -->
<!--    <device>                         -->
<!--      <button>action</button>        -->
<!--    </device>                        -->
<!-- To map keys from other remotes using the RCA protocol, you may add <universalremote> blocks -->
<!-- In this case, the tags used are <obc#> where # is the original button code (OBC) of the key -->
<!-- You set it up by adding a <universalremote> block to the window or <global> section:       -->
<!--    <universalremote>             -->
<!--       <obc45>Stop</obc45>         -->
<!--    </universalremote>            -->
<!-- Note that the action can be a built-in function.                 -->
<!--  eg <B>XBMC.ActivateWindow(MyMusic)</B>                         -->
<!-- would automatically go to My Music on the press of the B button. -->
<!-- Joysticks / Gamepads:                                                                    -->
<!--   See the sample PS3 controller configuration below for the format.                      -->
<!--                                                                                          -->
<!--  Joystick Name:                                                                          -->
<!--   Do 'cat /proc/bus/input/devices' or see your xbmc log file  to find the names of       -->
<!--   detected joysticks. The name used in the configuration should match the detected name. -->
<!--                                                                                          -->
<!--  Button Ids:                                                                             -->
<!--   'id' is the button ID used by SDL. Joystick button ids of connected joysticks appear   -->
<!--   in xbmc.log when they are pressed. Use your log to map custom buttons to actions.      -->
<!--                                                                                          -->
<!--  Axis Ids / Analog Controls                                                              -->
<!--   Coming soon.                                                                           -->
<keymap>
  <global>
    <keyboard>
      <p>Play</p>
      <q>Queue</q>
      <f>FastForward</f>
      <r>Rewind</r>
      <left>Left</left>
      <right>Right</right>
      <up>Up</up>
      <down>Down</down>
      <left mod="ctrl">analogseekback</left>
      <right mod="ctrl">analogseekforward</right>
      <pageup>PageUp</pageup>
      <pagedown>PageDown</pagedown>
      <return>Select</return>
      <enter>Select</enter>
      <delete>Back</delete>
      <backspace>Back</backspace>
      <key id="65446">Back</key>
      <m>ActivateWindow(PlayerControls)</m>
      <s>ActivateWindow(shutdownmenu)</s>
      <escape>PreviousMenu</escape>
      <key id="61952">parentdir</key>
      <i>Info</i>
      <menu>ContextMenu</menu>
      <c>ContextMenu</c>
      <space>Pause</space>
      <x>Stop</x>
      <period>SkipNext</period>
      <comma>SkipPrevious</comma>
      <tab>FullScreen</tab>
      <printscreen>Screenshot</printscreen>
      <s mod="ctrl">Screenshot</s>
      <minus>VolumeDown</minus>
      <plus>VolumeUp</plus>
      <equals>VolumeUp</equals>
      <zero>Number0</zero>
      <one>Number1</one>
      <two>Number2</two>
      <three>Number3</three>
      <four>Number4</four>
      <five>Number5</five>
      <six>Number6</six>
      <seven>Number7</seven>
      <eight>Number8</eight>
      <nine>Number9</nine>
      <numpadminus>VolumeDown</numpadminus>
      <numpadplus>VolumeUp</numpadplus>
      <numpadzero>Number0</numpadzero>
      <numpadone>Number1</numpadone>
      <numpadtwo>Number2</numpadtwo>
      <numpadthree>Number3</numpadthree>
      <numpadfour>Number4</numpadfour>
      <numpadfive>Number5</numpadfive>
      <numpadsix>Number6</numpadsix>
      <numpadseven>Number7</numpadseven>
      <numpadeight>Number8</numpadeight>
      <numpadnine>Number9</numpadnine>
      <backslash>ToggleFullScreen</backslash>
      <home>FirstPage</home>
      <end>LastPage</end>
      <!-- Multimedia keyboard keys -->
      <browser_back>Back</browser_back>
      <browser_forward></browser_forward>
      <browser_refresh></browser_refresh>
      <browser_stop></browser_stop>
      <browser_search></browser_search>
      <browser_favorites>ActivateWindow(Favourites)</browser_favorites>
      <browser_home>XBMC.ActivateWindow(Home)</browser_home>
      <volume_mute>Mute</volume_mute>
      <volume_down>VolumeDown</volume_down>
      <volume_up>VolumeUp</volume_up>
      <next_track>SkipNext</next_track>
      <prev_track>SkipPrevious</prev_track>
      <stop>Stop</stop>
      <play_pause>Pause</play_pause>
      <launch_mail></launch_mail>
      <launch_media_select>XBMC.ActivateWindow(MyMusic)</launch_media_select>
      <launch_app1_pc_icon>ActivateWindow(MyPrograms)</launch_app1_pc_icon>
      <launch_app2_pc_icon>ActivateWindow(MyPrograms)</launch_app2_pc_icon>
      <launch_file_browser></launch_file_browser>
      <launch_media_center></launch_media_center>
      <!-- ****************************************************** -->
      <!-- MS Media Center keyboard shortcuts sent by MCE remotes -->
      <!-- See http://msdn.microsoft.com/en-us/library/bb189249.aspx -->
      <p mod="ctrl,shift">Play</p>
      <!-- Play -->
      <s mod="ctrl,shift">Stop</s>
      <!-- Stop -->
      <p mod="ctrl">Pause</p>
      <!-- Pause -->
      <f mod="ctrl,shift">FastForward</f>
      <!-- Fwd -->
      <b mod="ctrl,shift">Rewind</b>
      <!-- Rew -->
      <f mod="ctrl">SkipNext</f>
      <!-- Skip -->
      <b mod="ctrl">SkipPrevious</b>
      <!-- Replay -->
      <d mod="ctrl">Info</d>
      <!-- MCE Details -->
      <f10>VolumeUp</f10>
      <!-- MCE Vol up -->
      <f9>VolumeDown</f9>
      <!-- MCE Vol down -->
      <f8>Mute</f8>
      <!-- MCE mute -->
      <g mod="ctrl">OSD</g>
      <!-- MCE Guide -->
      <m mod="ctrl">ActivateWindow(music)</m>
      <!-- MCE My music -->
      <i mod="ctrl">ActivateWindow(pictures)</i>
      <!-- MCE My pictures -->
      <e mod="ctrl">ActivateWindow(video)</e>
      <!-- MCE videos -->
      <m mod="ctrl,shift">PlayerControl(ShowVideoMenu)</m>
      <!-- MCE DVD menu -->
      <!-- MCE keypresses without an obvious use in XBMC -->
      <o mod="ctrl">Notification(MCEKeypress, Recorded TV, 3)</o>
      <t mod="ctrl">Notification(MCEKeypress, Live TV, 3)</t>
      <t mod="ctrl,shift">Notification(MCEKeypress, My TV, 3)</t>
      <a mod="ctrl">Notification(MCEKeypress, Radio, 3)</a>
      <u mod="ctrl">Notification(MCEKeypress, DVD subtitle, 3)</u>
      <a mod="ctrl,shift">Notification(MCEKeypress, DVD audio, 3)</a>
    </keyboard>
  </global>
  <loginscreen>
    <keyboard>
      <end>XBMC.ShutDown()</end>
    </keyboard>
  </loginscreen>
  <home>
    <keyboard>
      <i>info</i>
      <end>XBMC.ShutDown()</end>
    </keyboard>
  </home>
  <virtualkeyboard>
    <keyboard>
      <backspace>Backspace</backspace>
    </keyboard>
  </virtualkeyboard>
</keymap>
It's not that simple... it works only if you remote driver (the one in the kernel) can associate the hex code from the remote to a linux key input constant, in that case the key event is fired up and you get your info in debug. if not the driver simply ignore the input. Or at least this is how it works in minix neo x5. If lircd could work as service in android then that's another story, but you'll need lirc_dev compiled in kernel or as module.
it should be noted too that the keymap.xml file you need can/should go into android/data/org.xbmc.pl/files/.xbmc/userdata/keymaps folder (or close to that I did that from memory) NOT the data/data folder as yes you need root access for that and those are the defaults. The data/data is akin to the xbmc in program files and the android/data is akin to the users/appdata/
(2013-03-19, 18:34)tprins228 Wrote: [ -> ]I have confirmed that this works. It takes some trickery with checking the debug log and finding what key xbmc is interpreting your input as. Once you have this, you can edit the keyboard.xml file in userdata to match the key found in the logs. Worked great for me, successfully mapped my backspace and escape keys to back and previousdir. XBMC was actually seeing backspace as delete and escape was unknown. FYI, numbers in debug log are in hex. Look for something along the lines of:

DEBUG: *what xbmc sees as key* (0x*number*) ..., actions is...

The 0x*number is what you are interested in when mapping in your keyboard.xml.

i want to sort out my escape button on my wireless keyboard. my escape button works fine in android but does nothing in xbmc. I have looked at my xbmc log file and here is what it says when i press the escape button:

14:12:48 T:1513030896 DEBUG: Keyboard: scancode: 6f, sym: 0000, unicode: 0000, modifier: 0
14:12:48 T:1513030896 DEBUG: : Trying Hardy keycode for 0xf200

anyone know what i should put in my keyboard.xml to get my escape key working in xbmc?
My problem: when in the on-screen keyboard I the backspace key on my logitech wireless keyboard does nothing.

So I've been working with the xml posted here. I found my poured over my logs and was able to get a key id from the line "delete (0xf087) pressed, trying keyboard action 61575" which is wierd cause 0xf087 = 61575, so I guess that means it recognized the key but it was bound as something else....

When I changed the global bind for backspace <backspace>back<backspace/> and the corresponding keyid bind below <key id="65446">Back</key> as well as deleting the <delete>back</delete> I was able to make the backspace key delete (destroy the text in front of the cursor but not behind it). This was the case when only backspace was bound to back and when delete was bound to back.

I've read in the documentation that context specific binds are present and I saw a wad of them in the default keyboard.xml in the wiki.

I've discovered upon further cleaning of my keybaord.xml that the backspace key is bound to the back button on my keyboard (right click).

No matter what I bind in my keyboard.xml I end up with rightclick for backspace and backspace as delete.

Thanks in advance
Is it possible to map the VOLUME AMPLIFICATION instead of the default volume control? I see that I can control this in my OUYA... If I could map this it would give some volume control'esk feature.
Hello guys,

I've been reading this thread with interest as I'm about to put xbmc on an android box when it arrives, but the tests Ive just done on xbmc running on my nexus 10 is that the wireless keyboard that works so brilliantly with xbmc on win8, has some major issues with android.

Did you manage to map the keyboard to work, particularly the "back" command seems most noticeably missing.

Cheers,
Mark.
Firstly, I dont knkw what your keyboard is.

2nd, I have had no luck with keyboard.xml in android

3rd, I did find a way to change something called the Generic.kl which allowd me to choose/dictate what each button did. Sadly, I cant link to the guide I made on a different website.

I'm sure if you search this forum you will find the details needed. Good Luck
Pages: 1 2