Remapping keys: keymap.xml vs. gen.xml
#1
I'm running Kodi v16 / OpenElec on a Raspberry Pi 3 using a VRC-1100 remote, and I'm trying to disable the power button on my remote by remapping it to a NOOP as per Michiel van Baak's instructions. Michiel advises to include the following code in /storage/.kodi/userdata/keymaps/remote.xml:

Code:
<keymap>
    <global>
        <remote>
            <power>NOOP</power>
        </remote>
    </global>
</keymap>

Which, according to his March 2016 post, should work.

However, on my Pi the keymap seems to live in /storage/.kodi/userdata/keymaps/gen.xml and there is no remote.xml in that directory. That might be because I have installed (and used) the Keymap Editor add-on.

The contents of this file are un-indented, and the NOOP is converted into lower case. Currently the contents of my /storage/.kodi/userdata/keymaps/gen.xml are:

Code:
<keymap><global><keyboard><key id="power">noop</key><key id="247">osd</key></keyboard></global><videos><keyboard><key id="221">chapterorbigstepback</key><key id="37">contextmenu</key><key id="49">fullscreen</key></keyboard></videos></keymap>

Which, reformatted for proper indentation and multiple lines for readability, would be:

Code:
<keymap>
  <global>
    <keyboard>
      <key id="power">noop</key>
      <key id="247">osd</key>
    </keyboard>
  </global>
  <videos>
    <keyboard>
      <key id="221">chapterorbigstepback</key>
      <key id="37">contextmenu</key>
      <key id="49">fullscreen</key>
    </keyboard>
  </videos>
</keymap>

While the other key remappings work, the power button remain unaffected. Also, the keys that I did remap using the keymap editor add-on (the gray keys below the red and green ones on the remote) do work (bring up the OSD and toggle full screen video, respectively, during video playback) but they also still bring up the PVR manager.

So. Questions:
  1. Why is keyboard.xml now gen.xml on my RPi and can this be what causes Michiel's power button remapping not to work?
  2. While manually editing the keymap to change noop back to NOOP had no effect, might case be an issue here? I'm assuming that the syntax change from <power> to <key id="power"> won't be (at least it shouldn't).
  3. Why does the PVR manager still come up on the remapped keys and how do I get around that? I have disabled TV in the settings so the PVR function itself should not be doing anything at all; the PVR manager justly complains that no PVR clients have been started yet.

Note: symlinking gen.xml to remote.xml had no effect, and the keymap editor addon renames the link to a backup (keymap.xml.bak.0) as soon as it saves its changes.

All suggestions would be greatly appreciated!!

// FvW
Reply
#2
1. It doesn't matter what the file is called, as long as it's something.xml. It's the <keyboard> tag within the file that defines the device to which the mappings apply.
2. It's got nothing to do with upper or lower case. I don't believe you can override/configure the mapping of the Power button on the VRC-1100
3. The following will map the 4 grey buttons to noop:
Code:
<keymap>
  <global>
    <keyboard>
      <key id="24">noop</key> <!-- grey button below yellow -->
      <key id="229">noop</key> <!-- grey button below blue -->
      <key id="49">noop</key> <!-- grey button below green -->
      <key id="247">noop</key> <!-- grey button below red -->
    </keyboard>
  </global>
</keymap>
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#3
(2016-10-09, 14:24)Milhouse Wrote: 1. It doesn't matter what the file is called, as long as it's something.xml. It's the <keyboard> tag within the file that defines the device to which the mappings apply.
Not 100% true. The .xml files are read alphabetically first from the system keymap folder then from the userdata keymap folder and the last mapping found is used so gen.xml would be read before keymap.xml so the mappings in keymap would overwrite the ones in gen if they map the same key/button. A file named VRC1100.xml in userdata would stand a good chance of being read last.
If I have been of help, please add to my reputation as a way of saying thanks, it's free.
Reply
#4
(2016-10-09, 14:24)Milhouse Wrote: 1. It doesn't matter what the file is called, as long as it's something.xml. It's the <keyboard> tag within the file that defines the device to which the mappings apply.
(2016-10-09, 14:53)Dilligaf Wrote: Not 100% true. The .xml files are read alphabetically first from the system keymap folder then from the userdata keymap folder and the last mapping found is used so gen.xml would be read before keymap.xml so the mappings in keymap would overwrite the ones in gen if they map the same key/button. A file named VRC1100.xml in userdata would stand a good chance of being read last.

OK. That answers that question. Thanks, guys! On that note, is there a file that overrides OpenElec's default appcommand.xml file?

(2016-10-09, 14:24)Milhouse Wrote: 2. It's got nothing to do with upper or lower case. I don't believe you can override/configure the mapping of the Power button on the VRC-1100
Apparently with the Harmony it works but with the VRC-1100 the power button is one of the ones that doesn't make it to Kodi but gets captured at the OS level. It should be possible to do the trick in OpenElec as per this post: http://openelec.tv/forum/134-usage/49334...rpi#116185 but perhaps (haven't had a chance to try it yet) this needs to be done in appcommand.xml (which lives somewhere in the bowels of OpenElec under /usr).

(2016-10-09, 14:24)Milhouse Wrote: 3. The following will map the 4 grey buttons to noop:
Code:
<keymap>
  <global>
    <keyboard>
      <key id="24">noop</key> <!-- grey button below yellow -->
      <key id="229">noop</key> <!-- grey button below blue -->
      <key id="49">noop</key> <!-- grey button below green -->
      <key id="247">noop</key> <!-- grey button below red -->
    </keyboard>
  </global>
</keymap>
That is helpful, thank you. Can the color buttons themselves be captured in the same way? I can't seem to find the key codes for them.

Tnx!

// FvW
Reply
#5
(2016-10-11, 12:44)frankvw Wrote: Can the color buttons themselves be captured in the same way?

Yes, with a bit of effort.

Currently the yellow button generates KEY_VCR which isn't mapped to anything in /usr/share/kodi/system/Lircmap.xml, so it's basically a dead key (you can see the key code a button generates by running "irw")

To fix this, paste the following into /storage/.kodi/userdata/Lircmap.xml (create it, as it won't exist):
Code:
<lircmap>
  <remote device="devinput">
    <mytv>KEY_VCR</mytv>
    <red>KEY_WWW</red>
  </remote>
</lircmap>

This maps KEY_VCR to the "mytv" action. It also maps the WWW button (left of the power button) to the "red" action, in case you fancy using this button (otherwise it too is dead).

You can then map the yellow, blue, red, green and www buttons as follows:
Code:
<keymap>
  <global>
    <remote>
      <mytv>XBMC.ActivateWindow(Videos,TVShowTitles)</mytv>
      <mymusic>XBMC.ActivateWindow(Music,Albums)</mymusic>
      <mypictures>XBMC.ActivateWindow(Pictures)</mypictures>
      <myvideo>XBMC.ActivateWindow(Videos,MovieTitles)</myvideo>
      <red>XBMC.RunAddon(plugin.video.youtube)</red>
    </remote>
  </global>
</keymap>

Note also that, contrary to my previous comment, it should be possible to map <power> to noop with:
Code:
<keymap>
  <global>
    <remote>
      <power>noop</power>
    </remote>
  </global>
</keymap>
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply



Logout Mark Read Team Forum Stats Members Help
Remapping keys: keymap.xml vs. gen.xml0
This forum uses Lukasz Tkacz MyBB addons.