Custom remote buttons

Hi. I have set up a remote with the raspberry pi and it works great.
I’m trying to figure out if I can do the following.

  • Assign buttons to skip through channel groups in the EPG
  • Assign a button to the search function in the EPG

On the Kodi remote app I can switch channel groups with “nextchannelgroup” and “previouschannelgroup”. Not sure if I can assign them to buttons though? I couldn’t find any search functions.

Any help is appreciated,
Chris

The first place to start is with the keymap editor add-on. If you nave need to move beyond the functions provided there then you would have to manually edit a keymap file.

Thanks for the reply.
I had a play today but I cant get the buttons working.
I am trying to map the KEY_NEXT and KEY_PREVIOUS buttons to next and previous channel group but while in the EPG the buttons still skip froward and backwards in the current channel group.
Am I having issues because they are already mapped by Kodi?

Something else I was wondering.
The Kodi remote app home button takes you to the home screen. Mapping a button to KEY_HOME kind of does the same thing, but while watching TV, it doesn’t.

Chris

There can be more than one keymap file and they are processed in alphabetical order with I believe later ones superseding entries in earlier files. Additional to that certain maps supercede others. For example if I have a key mapped in global I can use that same key to do something else in fullscreen video.

I have to be doing something wrong. My gen.xml that gets created by the keymap addon is the only keymap in /home/osmc/.kodi/userdata/keymaps/

Here are the xml files I tried

<keymap>
   <MyPVRGuide>
  <keyboard>
     <key id="221">previouschannelgroup</key>
     <key id="223">nextchannelgroup</key>
  </keyboard>
   </MyPVRGuide>
</keymap>

And

  <keymap>
   <MyPVRGuide>
  <remote>
     <Next">previouschannelgroup</Next>
     <Previous>nextchannelgroup</Previous>
  </remote>
   </MyPVRGuide>
</keymap>

I added the “MyPVRGuide.xml” because from what I can see that is the correct name for the GUI I am trying to map the button in. Using “kodi-send --action=Skin.ToggleDebug”

Chris

You would probably find someone much more knowledgeable on the Kodi forum but I think where your getting tripped up is in the Window ID. I would think that <pvrchannelguide> would be the Window ID.

The superseding I was talking about works like the following…

<keymap>
<global>
<keyboard>
<key id="216">back</key>
</keyboard>
</global>
<fullscreenvideo>
<keyboard>
<key id="216">stop</key>
</keyboard>
</fullscreenvideo>
</keymap>

In this example the key I use for “back” acts as a “stop” button only when I am in a full screen video.

Unfortunately that didn’t work either.
Thanks anyways.
I will try on the Kodi forums.

If you added a file called “MyPVRGuide.xml” to your keymaps folder then any individual commands in that will override the same commands in “gen.xml” because like I said they are processed in alphabetical order. You can either do your edits in the “MyPVRGuide.xml” file or delete that and keep working working in “gen.xml”.

Also you will need to figure out if your remote is working as a remote or keyboard and make your edits appropriately. If you map some key in keymap editor the commands it makes in “gen.xml” would be the ones you would need to use.

OK I think I was doing something wrong.
Now it looks like this

osmc@osmc:~/.kodi/userdata/keymaps$ ls 
MyPVRGuide.xml

MyPVRGuide.xml

<keymap>
   <pvrchannelguide>
      <keyboard>
         <key id="221">PreviousChannelGroup</key>
         <key id="223">NextChannelGroup</key>
      </keyboard>
   </pvrchannelguide>
</keymap>

It seems the keymap addon either uses the incorrect names or I am selecting the wrong options so I just take this part from it

  <keyboard>
     <key id="221">previouschannelgroup</key>
     <key id="223">nextchannelgroup</key>
  </keyboard>

So is that working now?

No no I was just making sure people knew what I have.

Did you reboot Kodi after you made the changes? You don’t have to do that with keymap editor as it automatically reloads when you save, but when you manually edit you need to reboot.

I have not been. I have been running this

kodi-send --action=reloadkeymaps

I have figured it out.
I was going through all of the window ID’s and it turns out the correct one is “tvguide”

So this is correct for me

<keymap>
   <tvguide>
      <keyboard>
         <key id="221">PreviousChannelGroup</key>
         <key id="223">NextChannelGroup</key>
      </keyboard>
   </tvguide>
</keymap>

Thanks for all the help

Do you know if its possible to map a button the the slide out menu? The one that slides from the left in videos and epg.

Glad to hear it. I have never tried it but in the wiki it looks like your looking for

Menu Focus the menu control (e.g. sidebar in confluence) which is specified by the skin in different windows (e.g. Movies, Music, PVR etc.)

It is not “KEY_MENU”
“KEY_MENU” is the same as pressing the “C” key on a keyboard in Windows.
“KEY_TITLE” appears to be the same as “KEY_MENU”.
I need to figure out which “KEY_” is the same as “M” in Windows.

<menu> isn’t it?

BTW you can see the three functions the “M” key map to here.

Ye that is what I was looking at.
It doesn’t make much sense.
I think maybe its a mistake either with Kodi or OSMC?
I cant imagine the same action on two different keys is intentional?
I’d expect “KEY_MENU” to do what I am trying to do and “KEY_CONTEXT_MENU” to do what it is currently doing. “KEY_TITLE” seems to be the legacy name for “KEY_MENU”?

Just to clarify this is whats happening…

KEY_MENU = Context Menu
KEY_TITLE = Context Menu
KEY_CONTEXT_MENU = Nothing

<key id="xxx">menu</key> does what?

EDIT: I just tested this and it is working for me with the confluence skin. I put it in “global” and when I am in any screen that has a menu that slides out from the side that key brings it up.