Kodi Community Forum

Full Version: Keymap not loading
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I copied the keymap settings off this post and they aren't working.  I had the same keys mapped to those tempo functions on v18 alpha 2 before I inadvertently wrote over my install directory with v18 stable.  So I'm confident this works on my hardware setup, but not confident I used that syntax before.

Paths are a bit weird; it's a qnap nas.  I'm also unsure if my keymap.xml file is in the right directory.

Logs
It is loading, indeed it's loading twice. Once from the master profile and once from the sub-profile (you can see both in your log snippet).

Basically there are three places where you can put keymaps, the built-in default ones (the ones in special://xbmc/system/keymaps/ , which should not be edited or added to), then the ones in the master profile (the ones in special://masterprofile/keymaps/ ) and then lastly the ones in your currently loaded profile (if you are using profiles - special://profile/keymaps/).

They are loaded in that order, and within each location in alphabetical order. Any valid xml file can be used - the filename itself doesn't matter apart from the alphabetical loading order factor. What will happen is as successive maps are loaded, anything that's already existing in a previous map will be overwritten. Hence why the default maps shouldn't be edited or added to, just use one in the user profile space and that will add to or overwrite the action of the default ones.

So the keymaps themselves are being loaded, but not working which is a separate issue. Note those keys will only be active when the full screen video window or the video menu windows are open and have focus. That's the last element of the keymaps - you can set mappings for specific windows or for everything (global) with the specific window settings overwriting the global ones if both are defined.

The first question is do you have the relevant Kodi window open when you are trying to use those keys?

To be sure, if you enable debug logging (see debug log (wiki) for details of how to do so) then all keystrokes received by Kodi are logged to the debug log so you can use that log to confirm what is being received and when.
Excellent writeup, that's super helpful!  Checking debug output while playing, this line looks suspect:
Code:
ERROR: NEWADDON Unknown Video Info Key "progress"

Grepping I see that key mapped elsewhere:
html:

  <FullscreenVideo>
    <keyboard>
      <opensquarebracket>BigStepForward</opensquarebracket>
      <!-- ... -->

  <VideoMenu>
    <keyboard>
      <opensquarebracket>BigStepForward</opensquarebracket>
      <!-- ... -->

But the action doesn't match up.  Additionally, my profile's keymap.xml is loaded later, so it should be overwriting those.


I then added the same two actions inside a <Global> tag as I don't need those two keys to do anything else anywhere.  The logs indicate the keys are now mapped correctly, but it still doesn't speed up the video.
TempoUp and TempoDown will only work if 'Sync playback to display' is enabled
Got it, sort of.  I turned that on and the two keys worked as expected.

I actually wanted to get two keys on my MCE remote to activate this function.  So I fired up Keymap Editor and mapped those two keys to SmallStepBack and BigStepForward for easy identification of the key IDs in the generated XML.  The keys I want are 127058 and 258132.  So userdata/keymaps/keymap.xml now looks like this:
xml:
<keymap>
    <global>
        <keyboard>
            <key id="61622">updatelibrary(video)</key>
            <key id="127058">PlayerControl(tempoup)</key>
            <key id="258132">PlayerControl(tempodown)</key>
            <opensquarebracket>PlayerControl(tempodown)</opensquarebracket>
            <closesquarebracket>PlayerControl(tempoup)</closesquarebracket>
        </keyboard>
    </global>
</keymap>

258132 is the only one that works (ignoring 61622).  Logs show I'm still hitting the old mapping.  I did a case-insensitive grep of my opt dir for BigStepBack and there are zero occurances (save for a pair of python files, and this log).  BTW I do all edits to the XML file while Kodi is not running.
Could we please see the full log, thanks.
(2019-06-14, 07:05)allfalldown Wrote: [ -> ]I actually wanted to get two keys on my MCE remote to activate this function. 

Are you sure your MCE remote is interpreted as a 'keyboard' inside Kodi? From what I see at the kodi log:

2019-06-13 21:53:56.829 T:139919550209984 DEBUG: Keyboard: scancode: 0x24, sym: 0x000d, unicode: 0x0000, modifier: 0x0
2019-06-13 21:53:56.829 T:139919550209984 DEBUG: HandleKey: return (0xf00d) pressed, action is Select

Are those from the keyboard or from the remote? I would guess those are from the keyboard.

I don´t see "258132" being pressed at the log above at all.

Be aware, that if those presses from the remote are handled as presses from a remote inside Kodi (some remotes are interpreted as a keyboard....those from Wetek devices or if a Flirc dongle is in use for example), the keymap has to refer to a remote:

xml:

<keymap>
    <global>
        <remote>
            <key id="whatever_id_is_correct">some action what kodi should do</key>
        </remote>
    </global>
</keymap>

(2019-06-14, 10:37)DaVu Wrote: [ -> ]Are you sure your MCE remote is interpreted as a 'keyboard' inside Kodi? From what I see at the kodi log: 
Yes.  I tried moving the <key id="... sections inside a <remote> tag and the keys went back to their "default" functions, one of which brings up Live TV and the other I think is videos.  They're the red and yellow buttons on this remote.
(2019-06-14, 10:37)DaVu Wrote: [ -> ]I don´t see "258132" being pressed at the log above at all.
Yeah me either, hence the confusion.  Though to be completely accurate it's 0x1f052 and 0x3f054 that we're looking for.

Here are full logs, and the sequence of key presses from launch:
  1. Remote right
  2. Remote down
  3. Remote OK (enter)
  4. Keyboard closesquarebracket
  5. Keyboard opensquarebracket
  6. Remote yellow
  7. Remote red
  8. Remote stop