OSMC Remote - Long Press Keymap Guide

Introduction

This guide is intended to serve as a reference for users who want to modify the button behavior of their OSMC remote controls. This is not intended as a general guide on key mapping in Kodi, or a thread for general keymap questions. If you need to familiarize yourself with keymaps, or what things you can do with them your first step should be Kodi’s wiki on the subject.

OSMC Legacy Behaviour

The first two generations of the OSMC remote using OSMC prior to the March 2020 update implemented support via eventlircd maps. This method does not support long-press behavior with these remotes. If you want to modify any behavior with this system the easiest method is to install the ‘Keymap Editor’ Kodi add-on. If you find yourself confused on the mass of choices presented there I would direct you to read the first part of Kodi’s keymap wiki which will make understanding how to use the add-on much easier.

Third generation OSMC remotes started shipping in the beginning of 2020. An eventlircd map was never implemented as our intention was to always support long-press functions. We have since decided to support long press functionality on all generations of OSMC remotes.

OSMC Long press update

With the OSMC March 2020 update there have been significant changes to how the OSMC remote interacts with the operating system and Kodi. To address incompatibilities with some keyboard languages and the layouts they use, as well as to simplify support, we have modified the underlying keymapping and how these key presses are delivered to Kodi. This allows for a unified layout for all remotes. We also utilise Kodi’s peripheral input system to allow more flexibility and customisation of the remote’s operation.

Long-press action List

If you have the OSMC custom keymap enabled the most notable long-press actions are listed below along with some deviations of the stock short-press actions. Please note that these are subject to change as this is still a work in progress.

Global Fallback Actions*

  • (Home) Go to home screen
  • (Home Long-press) Toggle fullscreen audio/video playback
  • (Back Long-press) Go to home screen
  • (Menu Long-press) Slideout menu

Home Screen

  • (Home) Send CEC activate source**
  • (Home Long-press) Send CEC standby**
  • (Back Long-press) Power menu
  • (OK Long-press) Reload skin (refreshes db sync for MySQL)
  • (Play Long-press) Update video library

On Screen Keyboard

  • (Up Long-press) Shift
  • (Down Long-press) Symbols
  • (OK Long-press) Enter
  • (Back Long-press) Previous menu

File Manager

  • (Right Long-press) Highlight
  • (Left Long-press) Highlight

Fullscreen Video (Except Live TV)

  • (Home) Bookmarks
  • (Home Long-press) playerdebug overlay
  • (Info Long-press) playerprocessinfo dialog
  • (OK Long-press) Video playlist
  • (Up Long-press) Next item in video playlist***
  • (Down Long-press) Previous item in video playlist***
  • (Left Long-press) Audio delay adjustment
  • (Right Long-press) Subtitle delay adjustment
  • (Back Long-press) Stop
  • (Menu) Video settings
  • (Menu Long-press) Audio settings
  • (Play Long-press) Turn subtitles on/off
  • (Stop Long-press) Subtitle settings

Picture Slideshow

  • (Play) Pause
  • (Up Long-press) Zoom in
  • (Down Long-press) Zoom out
  • (OK Long-press) Zoom normal

Movies and TV Shows Screens

  • (OK Long-press) Toggle view between unwatched and all videos
  • (Play Long-press) Toggle watched status of selected item

Fullscreen Live TV

  • (Left Long-press) Audio delay adjustment
  • (Right Long-press) Subtitle delay adjustment
  • (OK Long-press) Record
  • (Play Long-press) Toggle subtitles
  • (Stop Long-press) Toggle teletext

TV Guide

  • (OK Long-press) Record

Visualisation (Fullscreen Music Playback)

  • (Left Long-press) Rewind
  • (Right Long-press) Fast Forward

*Global fallback actions are what happens when a button doesn’t have a different window specific function assigned to it. For example the (home) button normally takes you to the home screen, but this changes to bringing up chapters/bookmarks during full screen playback.
**CEC actions will only work when they are enabled in Settings>System>Input>Peripherals>CEC Adapter>
***Only works for videos without chapters/bookmarks. If chapters/bookmarks are present (up/down long-press) will provide the same function as (up/down short-press). To go to a previous video playlist item the first (down long-press) will take you to the start of the currently playing video and requires a second (down long-press) immediately after to actually switch to the previous video playlist item. This behavior is due to current Kodi limitations.

My remote works different and I prefer the old behavior

You can turn off the new keymap by going to Settings>System>Input>Peripherals>OSMC RF Remote>Don’t use the custom keymap for this device> [enable] and then reboot Kodi. This will fall back to a keymap that is very close to the old behavior.

My keyboard or secondary controller acts different

Because the OSMC remotes are seen by Kodi as keyboards they share a single keymap with all devices that are also seen as a keyboard. This means that in order to fully customize how our remote acts, we necessarily impact secondary controllers that are sharing the same keyboard keys.

If this poses a minor problem for you then it would probably be best fixed by putting a custom keymap in ~/.kodi/userdata/keymaps that returns the behavior of the key/s at issue.

You can alternatively disable the custom keymap entirely by going to Settings>System>Input>Peripherals>OSMC RF Remote>Don’t use the custom keymap for this device>[enable] and then reboot Kodi.

My custom keys stopped working with the update

Unfortunately there was no way around this. The remotes using eventlircd mappings are keymapped as <remote> whereas in the new system they are <keyboard>. In addition to that, some of the key names used for the remotes with eventlircd are different than what is available for keyboard input.

Hopefully the enhanced function the new setup provides outweighs the inconvenience of remaking any customisations.

How do I customize my keymap (GUI, short-press only)

The simplest method to customizing a keymap is to install the ‘Keymap Editor’ Kodi add-on. This can be found in add-ons>install from repository>Program add-ons. If you find yourself confused on the mass of choices presented there I would direct you to read the first part of Kodi’s keymap wiki which will make understanding how to use the add-on much easier.

A simple explanation of how it works is that you must first choose where you want the button to do something. If you program a button to “global" it becomes the behavior everywhere except where it is already specified to have a different action in a particular screen. If you assign a button to anywhere other than global then that action overrides what is set in global, but it only performs that action when that specific screen is active. Once you find the section and button you want to change simply click on it and you will be presented with an option to select the key you want to map.

Keymap Editor does not support long-press. If you hold down some of the buttons during recording they will come back with an erroneous key id that will not function. If it displays more than five digits, then try again without holding the key down. Additionally, if you manually add any long-press modifiers (and many other action not supported by keymap editor), to the .kodi/userdata/keymaps/gen.xml keymap it creates, they will be lost the next time you open keymap editor (that is not a typo, it happens when you open the add-on, and it happens even if you don’t tell it to save the file). If you want to add unsupported options to a keymap that won’t be affected by this, you should follow the instruction in the next section.

How do I customize my keymap long-press (advanced)

Currently long-press actions can only be mapped by manually creating/editing an xml file. For more novice users I would recommend starting by mapping with keymap editor (as explained in the previous section) which will provide most of the text you need. Map the buttons you want as long-presses temporarily as short-presses. Once you have saved your file in keymap editor it will have made a file called gen.xml in ~/.kodi/userdata/keymaps/. You will then need to make a subfolder called “osmc" and move the gen.xml file into that folder. This can be done via ssh by

cd ~/.kodi/userdata/keymaps/
mkdir osmc
mv gen.xml osmc

You would then need to edit that xml file to add the long-press modifier. To do this you would add mod="longpress" to the opening tags for every action you want it to apply to.

For example

<key id="61624">action</key>

would get changed to

<key id="61624" mod="longpress">action</key>

If you were planning on expanding in the future and wanted it a bit easier to read you can swap out the key id for the key name so it would become

<volume_down mod="longpress">action</volume_down>

The key names are found in the technical section of this guide. To edit via ssh you could type in

nano ~/.kodi/userdata/keymaps/osmc/gen.xml

The preceding only works if you have the remotes custom map enabled. If you want the custom keymap disabled but retain the ability to have a second keymap for long-press that does not get affected by keymap editor, then you would need to go to Settings>System>Input>Peripherals>OSMC RF Remote> and set Don’t use the custom keymap for this device [disable] and then change Keymap to use for this device to something other than “osmc". The name you choose dictates the folder name you will use instead of ~/.kodi/userdata/keymaps/osmc/ A reboot is required for this setting to take effect.

Other operating systems

There are plans to eventually move the peripheral input and its custom keymap from OSMC to Kodi. This would allow the second generation and newer remotes to (mostly) behave the same regardless of where they are being used. The “mostly" part is because there are issues with Kodi language support when the operating system is set to some non-English keyboard layouts. We have worked around this problem in OSMC at the operating system level, but full keyboard language compatibility will remain an issue on other systems absent some update to how Kodi works.

The mapping for this to work has already been included with the custom keymap we’re using in OSMC, but no testing has been done as of the time i’m writing this. If anyone would like to test the OSMC remote on any other operating system please send me a pm.

Technical

All versions of the OSMC remote will map as follows if being used in OSMC running March 2020 update or newer…

Home  = escape        (key id="61467")
Info  = leftbracket   (key id="61480")
Up    = up            (key id="61568")
Down  = down          (key id="61569")
Left  = left          (key id="61570")
Right = right         (key id="61571")
OK    = return        (key id="61453")
Back  = browser_back  (key id="61616")
Menu  = rightbracket  (key id="61481")
Play  = play_pause    (key id="61629")
Stop  = stop          (key id="61628")
Vol-  = volume_down   (key id="61624")
Vol+  = volume_up     (key id="61625")

In other operating system where they have not been setup to run through LIRC, they will appear as a keyboard and can be mapped in Kodi using the following key names.

First generation on other operating systems

Home  = home
Info  = N/A*
Up    = up
Down  = down
Left  = left
Right = right
OK    = return
Back  = browser_back
Menu  = N/A*
Play  = play_pause
Stop  = stop
RW    = rewind
FF    = fastforward
*Key unmappable due to Kodi limitation 

Second generation on other operating systems

Home  = home
Info  = i
Up    = up
Down  = down
Left  = left
Right = right
OK    = return
Back  = browser_back
Menu  = c
Play  = play_pause
Stop  = stop
Vol-  = minus
Vol+  = equals

Third generation on other operating systems

Home  = escape
Info  = i
Up    = up
Down  = down
Left  = left
Right = right
OK    = return
Back  = browser_back
Menu  = c
Play  = play_pause
Stop  = stop
Vol-  = minus
Vol+  = equals

Keymap examples

Map first generation rewind/fast forward buttons to control volume
<keymap>
	<global>
		<keyboard>
			<rewind>volume_down</rewind>
			<fastforward>volume_up</fastforward>
		</keyboard>
	</global>
</keymap>
Replace home button long-press CEC power off at home screen with fullscreen action
<keymap>
	<Home>
		<keyboard>
			<escape mod="longpress">fullscreen</escape>
		</keyboard>
	</Home>
</keymap>
Disable low battery notification
<keymap>
	<global>
		<keyboard>
			<f2>noop</f2>
		</keyboard>
	</global>
</keymap>
Make home button dedicated to CEC power control
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
	<global>
		<keyboard>
			<escape>CECActivateSource</escape>
			<escape mod="longpress">CECStandby</escape>
		</keyboard>
	</global>
	<FullscreenVideo>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</FullscreenVideo>
	<FullscreenGame>
		<keyboard>
			<escape/>
		</keyboard>
	</FullscreenGame>
	<Visualisation>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</Visualisation>
	<MusicOSD>
		<keyboard>
			<escape/>
		</keyboard>
	</MusicOSD>
	<slideshow>
		<keyboard>
			<escape/>
		</keyboard>
	</slideshow>
	<VideoOSD>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoOSD>
	<VideoMenu>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoMenu>
	<VideoBookmarks>
		<keyboard>
			<escape/>
		</keyboard>
	</VideoBookmarks>
	<Videos>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</Videos>
	<VideoPlaylist>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</VideoPlaylist>
	<MusicInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</MusicInformation>
	<MusicPlaylist>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</MusicPlaylist>
	<SongInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</SongInformation>
	<MovieInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</MovieInformation>
	<PictureInfo>
		<keyboard>
			<escape/>
		</keyboard>
	</PictureInfo>
	<PVROSDChannels>
		<keyboard>
			<escape/>
		</keyboard>
	</PVROSDChannels>
	<PVRChannelGuide>
		<keyboard>
			<escape/>
		</keyboard>
	</PVRChannelGuide>
	<AddonInformation>
		<keyboard>
			<escape/>
		</keyboard>
	</AddonInformation>
	<yesnodialog>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</yesnodialog>
	<selectdialog>
		<keyboard>
			<escape/>
		</keyboard>
	</selectdialog>
	<contextmenu>
		<keyboard>
			<escape/>
		</keyboard>
	</contextmenu>
	<addonsettings>
		<keyboard>
			<escape/>
		</keyboard>
	</addonsettings>
	<addonbrowser>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</addonbrowser>
	<filemanager>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</filemanager>
	<interfacesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</interfacesettings>
	<systeminfo>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</systeminfo>
	<eventlog>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</eventlog>
	<playersettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</playersettings>
	<mediasettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</mediasettings>
	<pvrsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</pvrsettings>
	<servicesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</servicesettings>
	<gamesettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</gamesettings>
	<profiles>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</profiles>
	<systemsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</systemsettings>
	<music>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</music>
	<pictures>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</pictures>
	<skinsettings>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</skinsettings>
	<musicplaylisteditor>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</musicplaylisteditor>
	<games>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</games>
	<programs>
		<keyboard>
			<escape/>
			<escape mod="longpress"/>
		</keyboard>
	</programs>
</keymap>
9 Likes

Reserved

The new long press functionality that came with the March 2020 Update, opens up some great options.

I have had a custom remote configuration since I bought my Vero 2. (I even had it back in the Apple TV days)

The configuration that I set up when i bought my Vero 2, was to replace up/down, when in “Fullscreen Video”, with volume up and down. I want to keep this.

The great new “long press” functionality, has a default configuration that assigns long press actions to up/down, when in full screen video mode.
By definition, setting a long-press action disables key repeat.
I need key repeat for volume up/down to work the way i want.

If you’re trying to make a custom keymap where you want to get rid of an existing long-press action, you simply need to make a keymap entry with a blank action .

Here is an keymap example, that assigns the up/down buttons on my Vero 2 remote, to volume up/down, when in fullscreen video playback.

One entry assigns the single click function and the second entry overrides the default long press function.

<keymap>
    <fullscreenvideo>
      <keyboard>
        <up>volumeup</up>
        <up mod="longpress"></up>
        <down>volumedown</down>
        <down mod="longpress"></down>
      </keyboard>
    </fullscreenvideo>
</keymap>

I’ve got some different keys back from my OSMC Remote are there any changes? My Remote is from March 2020.

from kodi.log

HandleKey: escape (0xf01b) pressed, window 10025, action is ActivateWindow(Home)
HandleKey: i (0xf049) pressed, window 10000, action is info
HandleKey: up (0xf080) pressed, window 10000, action is Up
HandleKey: down (0xf081) pressed, window 10016, action is Down
HandleKey: left (0xf082) pressed, window 10000, action is Left
HandleKey: right (0xf083) pressed, window 10000, action is Right
HandleKey: return (0xf00d) pressed, window 10000, action is Selec
HandleKey: browser_back (0xf0b0) pressed, window 12000, action is Back
HandleKey: c (0xf043) pressed, window 10000, action is ContextMenu
HandleKey: play_pause (0xf0bd) pressed, window 12005, action is PlayPause
HandleKey: stop (0xf0bc) pressed, window 10106, action is Stop
HandleKey: minus (0xf02d) pressed, window 10016, action is VolumeDown
HandleKey: equals (0xf03d) pressed, window 10016, action is VolumeUp

My OSMC Remote March 2020 hex dec
Home = escape (key id=61467) f01b 61467
Info = leftbracket (key id=61480) f049 61513
Up = up (key id=61568) f080 61568
Down = down (key id=61569) f081 61569
Left = left (key id=61570) f082 61570
Right = right (key id=61571) f083 61571
OK = return (key id=61453) f00d 61453
Back = browser_back (key id=61616) f0b0 61616
Menu = rightbracket (key id=61481) f043 61507
Play = play_pause (key id=61629) f0bd 61629
Stop = stop (key id=61628) f0bc 61628
Vol- = volume_down (key id=61624) f02d 61485
Vol+ = volume_up (key id=61625) f03d 61501

Info, Menu, Vol- and Vol+ are different

What operating system are you using? Can you give me a link to a full log?

Raspberry Pi OS Bookworm on Pi5 graplogs is a bit stubborn, I need to debug it first to send a log

If your using RPi OS then I don’t think you have an issue. We have a hwdb that we add to OSMC and LibreELEC to make keymapping uniform and to overcome issues that happen when someone changes their keyboard language to certain non-english language layouts. As such what your seeing is the expected behavior of the keys that Kodi is actually sending out. If you look in the technical section above you will see that I have listed what the keys get output for both the remapped and non-remapped situations.

What exactly is the problem your running into? If your using Kodi on RPi OS then it should still be covered as we have upstreamed our keymap, updated to cover both original or remapped, such that if Kodi see’s that remote it will load up our custom keymap. Additionally we have provided a method in Kodi’s input settings to turn this keymap off as well.

Hi darwindesign,

there is no certain problem at all, I was just wondering why that I have different keys back from my Remote and I had no idea.

I really like the old Remote with the skip buttons so I refactor it to work like that with my gen.xml below, with “skip” inside the Videos but nothing outside.

<keymap>
	<fullscreenvideo>
		<keyboard>
			<key id="61485">chapterorbigstepback</key>
			<key id="61501">chapterorbigstepforward</key>
		</keyboard>
	</fullscreenvideo>
	<global>
		<keyboard>
			<key id="61485">noop</key>
			<key id="61501">noop</key>
		</keyboard>
	</global>
</keymap>

don’t get me wrong the Remote is more than worth it’s money, but the Keymap example did not work also my first version with the key id from the March 2020 OSMC Remote so I identify the keys with the debug log from Kodi, it was a bit odd that I get the Remote working as usual but with different key id's something that was never mentoned anywhere. This is all somewhere off the road but I think it’s something that would help others too.

Ah, I understand now. I assume my previous post made that a bit more clear. It has been a few years since I’d read what I put in this guide and I see some room for improvement and some updated information that could be helpful. To be honest, support requests for operating systems other than OSMC have been pretty few and far between so I hadn’t really given much thought to adding more details.

You do realize that standard Kodi keymapping already has those actions set to direction up/down which seems to pair well with the standard mappings of small skipsteps with left/right don’t you? Obviously your free to tweak it as you wish, but this seems to me to be a bit less optimal button placement. Also, although I only provided keyid’s in the guide for the tweaked layout in OSMC and LE, I did provide the key names for all of them which normally is what someone would use if they are manually making a keymap (CEC excluded) since “<key id="61485">noop</key>” is less readable than “<minus>noop</minus>” and they are interchangeable.

Thanks for the feedback. I’ll look at updating the guide in the near future.