Can't create a keymap for a remote control button which is "connected" by lircd

Hi there!

I’d need some help with setting up some remote control keymappings in keyboard.xml.

I have recorded a custom lircd.conf for my universal remote (One For All URC 7955) which basically seems to work just fine. All keys are correctly shown when running the command irw /var/run/lirc/lircd-lirc0.

Next step would be to create some keyboard mappings for all “non standard” keys but some things simply don’t work the way I’d have expected them to.

Here’s my concrete problem

My remote is having an EXIT button which is “bound” to KEY_ROOT_MENU in lircd.conf.

This button doesn’t seem to do anything by default so I’d like to map it to the action ActivateWindow(home).

I’ve tried using the following in ~/.kodi/userdata/keymaps/keyboard.xml:


Unfortunately, the button is still doing nothing and pressing it doesn’t add any entry to ~/.kodi/temp/kodi.log at all.

I reloaded the keymap using kodi-send -a ReloadKeymaps and irw shows me the correct 000000037ff07bd8 00 KEY_ROOT_MENU /home/osmc/lircd.conf when pressing the button.

I also tried to create a keymap using the keymap editor add-on but that doesn’t seem to be able to “catch” the button either. At least it doesn’t do anything in the “Press the key you want to assign” step but seems to timeout when I press the EXIT button.

Also, I’d like to understand what’s going on here so using the keymap editor would only be a workaround.

Thanks & best regards, I’d really appreciate some help with this!

What device are you using?

Outside of a couple keys/buttons that are blocked for obvious reasons (exit and back come to mind) if keymap editor isn’t picking up the key it isn’t going to work doing it manually. Since your using a universal remote I think you may find programing it match one of the preexisting lircd configs in the My OSMC add-on would be much less problematic than starting from scratch.


I’m on a RPi 3, Model B. Do you need anything more specific?


Could you elaborate a little on what you mean by “blocked for obvious reasons”? I don’t really see any obvious reasons here.

Here’s how I’d understand it:

I have the remote set up to be working on a “physical” & “base configuration” level.
irw tells me, that each key (KEY_XYZ) is recognized by the OS.

At this point I’d have expected the mapping mechanism to allow me to map each of those “hardware keys” to any arbitrary “program function” (ActivateWindow etc.).

What am I missing?

Either way, I’ll try to somehow make use of the pre-existing configs even though I’m not completely sure how I’ll go about this. I’ll let you know once I tested this.

By “device” I think Sam meant what device you had your universal remote programed to emulate.

The back button cancels to key recording so that would be blocked from being able to be recorded. There are a couple keys that do this, don’t recall off hand which, I think OK may be another (normally not a key you would want to accidently loose the use of). I don’t think that this is your issue, just something to keep in mind.

Just because the OS can pick up the key does not mean Kodi can use it. I don’t claim to have much of an understanding of how lircd works but I do know that there is a limited set of input Kodi will accept. There already exists configuration files that can be selected in My OSMC and they are tested and working. So what one normally would do is something like program their remote to control (for example) an Xbox 360 and then select the Xbox 360 remote in the My OSMC add-on. You should then have a working remote that you can tweak the keymap of without an issue. If for some reason that profile isn’t working well repeat with something else like programing the remote as Microsoft MCE and select rc6-mce-lircd in My OSMC and see if you get better results with that.

Thanks for all this input! After a lot of “fiddling” around and trying to understand what’s really going on here, I finally figured out how to use my created lircd.conf and be able to map the keys the way I want.

In the end my solution was to not use key names in the mapping file keyboard.xml but use key IDs instead. This is also what the keymap editor add-on does “under the hood”.

This way I was able to also map my KEY_EXIT to some other command using the following mapping:

      <!-- ... -->
      <key id="216">ActivateWindow(home)</key> <!-- KEY_EXIT -->
      <!-- ... -->

How to get & use the ID

  • The ID 216 used above is decimal representation of the hexadecimal value 0xD8
  • The hex value can be found using the following method:
    • Connect using SSH or open terminal on Kodi device
    • Run command tail -F /home/osmc/.kodi/temp/kodi.log | grep HandleKey
    • Press the key on the remote
    • Output should be something like this and contains the Hex value in brackets:

      “DEBUG: HandleKey: menu (0xd8) pressed, action is Back”

  • Use google or some calculator to translate the hex value into decimal
  • Important: Use the keyboard tag instead of remote inside keyboard.xml. Otherwise IDs don’t seem to be working :man_shrugging:

I’m confused as that key id is set to act with a “back” action by default. That is the same id used for CEC input and well as MCE remotes for the ‘exit’ button. Above you said the key did nothing.

Just a couple points of clarification. Kodi does not care what the keymap file name is and you can have both remote mapping and keyboard mapping in the same file. The only issue is if you try to map as a remote but using a device that is being picked up as keyboard or vice versa. If you expanded your filter an extra line you should be able to see if it is picking up a remote, keyboard, or CEC (which gets mapped as a keyboard).

Also to use that command and have it work you need debug logging enabled. I normally open two ssh windows. The first I run…

tail -f ~/.kodi/temp/kodi.log | grep -B 1 'HandleKey'

and in the second I turn on/off debug with

kodi-send -a toggledebug

and to apply my edits without rebooting anything

kodi-send -a reloadkeymaps