LG TV how to configure CEC jump keys step size?

I have installed the Keymap Editor and tried to use it on my LG Smart-TV remote connected by HDMI to OSMC running on an RPi2.
I want to set the color button to jump back and forward, and the jumps I found in the editor are Small and Big jump Forward and Back. So that matches my 4 color buttons.
The problem is that the small jump is about 15 seconds whereas the big jump is 600 seconds!
I don’t need the small size jump since the direction keys < and > do that small jump of 15 s
How can I adjust the size of the jump so that small is say 60 s and big is 3-4 min?
I have updated the system last week via MyOSMC to the latest version. I previously used an IR remote on this system but since a year (when I got the LG TV) I use the TV remote instead by enabling the CEC in settings.

https://kodi.wiki/view/Skip_steps#Adding_seek_built-in_function_to_keymap

Well that is how to set the skip for the keyboard, I am talking about the LG remote via CEC… (I have already seen that)
The settings there configure the b and n keyboard keys but how do I set the red-green-yellow-blue button skip values?

https://kodi.wiki/view/Skip_steps#Configuration ?

Seen that too…
I could only change the “Skip delay” but when I navigate among the actual skip times there was no way I could figure out to actually change the values or remove a step.
OTOH I think these are the steps used when using the left or right buttons while playing. Multiple presses activate successive larger steps and suddenly the video ends at the last push, which is now like 30 minutes…
I would like to modify the actual step values I have now assigned to the color buttons. 15 seconds for short and 10 min for the other seems like too much of a difference.

If there is a config xml file that holds them then I could simply edit that…
I only have gen.xml and it does not contain any values.
This is what is in that:

<keymap>
  <virtualkeyboard>
    <keyboard>
     <key id="61453">play</key>
     <key id="61528">pause</key>
     <key id="61472">playpause</key>
     <key id="61528">stop</key>
     <key id="61510">fastforward</key>
     <key id="61522">rewind</key>
     <key id="61484">smallstepback</key>
     <key id="61486">stepback</key>
     <key id="61487">stepforward</key>
     <key id="61485">bigstepforward</key>
     <key id="61453">select</key>
     <key id="61448">back</key>
     <key id="61507">previousmenu</key>
     <key id="61513">info</key>
     <key id="61591">mute</key>
     <key id="61501">volumeup</key>
     <key id="61485">volumedown</key>
     <key id="61488">number0</key>
     <key id="61489">number1</key>
     <key id="61490">number2</key>
     <key id="61491">number3</key>
     <key id="61492">number4</key>
     <key id="61493">number5</key>
     <key id="61494">number6</key>
     <key id="61495">number7</key>
     <key id="61496">number8</key>
     <key id="61496">number9</key>
   </keyboard>
  </virtualkeyboard>
  <fullscreenvideo>
    <keyboard>
      <key id="254">bigstepforward</key>
      <key id="253">stepforward</key>
      <key id="251">bigstepback</key>
      <key id="252">stepback</key>
    </keyboard>
  </fullscreenvideo>
</keymap>

If you read the skip step wiki that ooZee linked to a bit more closely I think you will find what you are looking for. It points out that there is options in the GUI as well as the the ability to tweak with more granularity with some manual edits of an advancedsettings.xml. Also note that by default Kodi switches from skipping based on time to skipping based on percentage of the video length based upon how long the video playing is. This can be tweaked as well, but I bring it up in case you try your mod on a short test clip.

I am a bit confused why you would need to use the color buttons for this function though as formally a CEC controlled setup (just like almost any other remote) will be setup stock for the direction buttons to perform this skip steps during video playback.

EDIT addendum: That gen.xml you posted is rather odd as you have a bunch of the same keys mapped to different functions of the virtual keyboard so it would seem that you likely have multiple keys on your remote that are sending the same signal. This is not particular unusual but I would suggest the best approach would be to make yourself a spreadsheet and map out buttons to keyid’s to figure out what will actually work and how you want to configure it. On most TV’s the majority of the buttons do not forward via CEC.

1 Like

I’ll take a closer look at this then.
Question: Is there any way using the Keymap Editor or otherwise to figure out which code a remote button press sends via CEC?
For example a “Test” box which will display the key code when one presses a key.
The color buttons are now revealed since they are the low values at the bottom of the gen.xml file.

EDIT
If I edit the gen.xml file do I have to restart Kodi (i.e. reboot the system) in order for it to take effect?

For most types of remotes you can see the key names using a debug log but unfortunately this doesn’t work for CEC as the output is logged incorrectly (this is a Kodi issue that exists on all platforms). As such, the way I personally find to be the easiest is to just pick some random mapping in Keymap editor and just keep programing it for keys making a note of the keyid that comes up.

If you edit with the keymap editor add-on then it takes effect as soon as you save the keymap on your way out of the add-on. If you are manually editing you either have to reboot Kodi for it to take effect or else ssh into your device and run…

kodi-send --action=reloadkeymaps

You can also program the “reloadkeymaps” action to a button if you find that more convenient for whatever your doing.

I am back at this having failed at all of my previous attempts…
I desperately need the skip buttons to skip commercials by a fixed time amount such that I can jump forward until reaching the content and then back step until the start.
I need something like big step 30s and small step 10s which will always be used no matter how often I press the button.
The lone > and < buttons need me to telegraph by swiftly repeating my presses to get a longer jump and it is very hard to consistently do this.

The closest I have gotten is with the keymap editor where I have tried setting the 4 CEC remote color buttons to skip back and forward by the two smallest steps. The result is a file
/home/osmc/.kodi/keymaps/gen.xml
which contains this:

<keymap> <videos> <keyboard> <key id="252">smallstepback</key> <key id="251">stepback</key> <key id="253">stepforward</key> <key id="254">bigstepforward</key> </keyboard> </videos> </keymap>

So based on this I can deduce the “key codes” used by the CEC remote for the color buttons.

But nothing changes in the way the Kodi display operates. When I hit one of the color buttons Kodi switches display to some strange location while still playing the video, but now only the audio is available. The video itself has disappeared!
Or it displays a message that there is no PVR attached for one of the color buttons. Complete crazy!

There seems to be no configuration file for the key mapping of the remote either, at least none I can find. :frowning:
Only the gen.xml inside the keymaps dir created by keymap editor.

Where can I REALLY change the skip sizes and make it work?

There exists small and large skip steps and those don’t actually need keymapping in any any stock setup as they are default programmed to the direction buttons. There does not exist an option to keymap a skip step in a keymap to a specific time. However there does exist an option in Kodi’s settings to set the time, or percentage, for each subsequent button press for both small and large steps. Additionally there exists an option to do custom time settings with an advanceedsettings.xml file if one wished for something other than what the settings in the GUI offered. All this information is contained in the Kodi wiki on skip steps that ooZee linked above and in Kodi’s wiki for advancedsettings.xml.

EDIT: It had been a while since I read up on the topic and didn’t realize the option had been added to map a specific time jump.

1 Like

I have read all of this and there are some items that simply do not work for CEC remotes or are poorly described:

  • It is not written where the advancedsettings.xml file is stored! There are several alternatives so a full path should be explained but is not.
  • How to activate is not described in a way that is useful: " in order to activate them for use you need to select them in the GUI using the Skip step setting". I have multiple times navigated to Settings/Player/Video/Actions and I can see the default skip steps but there seems to be no way to actually change them or to activate/deactivate the steps.
  • The description in the documentation for “6 Adding seek built-in function to keymap” seems not to handle the use of CEC remotes. The way to add a custom mapping described is to add a line <b>Seek(-7)</b> but this maps the keyboard key b to the seek value. However there is no b on the remote so what should then be entered?
  • The way to enter the time before hitting the > key as described in “7.1 Skip the specified amount” also does not work! On a CEC remote it looks like pressing the numbers buttons does not result in anything Kodi recognizes. So these are disregarded and the jump is always 10 seconds.

I have used a dedicated Motorola remote with a USB plug-in receiver in the past and then the trick of typing in the seconds followed by > worked. However the other mappings were constantly screwed up between OSMC boxes so I gave up on that way, especially since the CEC remotes via HDMI is so much more useful (if it could be made to work also for skips).

https://kodi.wiki/view/Advancedsettings.xml
https://kodi.wiki/view/Userdata
There you even have a OSMC specific entry OSMC /home/osmc/.kodi/userdata/

If you put an entry in an advancedsettings.xml file the setting in the GUI will update with the new options you put there. I just tested it for skip-steps (left and right direction arrows) and timeseekbig (up and down direction arrows) and it worked with the caveat that timeseekbig breaks if set over 600 (which is the default setting. ie you can make either less than 10 min but not more). Additionally the settings do not take effect until Kodi is restarted and putting seek-step settings in an advancedsettings.xml does not change the setting, it only changes the options available in the GUI. For the seek step settings you click on the list of times and deselect the ones you don’t want and select the ones you want (ie the updated times will not show in the settings pane until you actually click on the list of times). What I used to test was…

<advancedsettings>
<seeksteps>10, 15, 30, 60, 180, 300, 600, 1800</seeksteps>
<video>
<timeseekforwardbig>360</timeseekforwardbig>
<timeseekbackwardbig>-180</timeseekbackwardbig>
</video>
</advancedsettings>

The above file makes the up direction seek 6 minutes, the down direction skip back 3 minutes, and adds options of 15 and -15 seconds to the skip-step GUI settings. The latter allowing me to deselect -10, 10, and 15 which would turn the default first steps from left/right navigating ten seconds forward/back to 30 seconds forward and 15 seconds back.

To keymap for a CEC remote you have to use key id’s. What keys a TV forwards to Kodi varies from one display to the next. To discover this it is easiest done with the keymap editor which shows the key id’s. CEC input does not report correctly in the debug log so that method cannot be used. As an example this is a keymap that I tested and works on one of my TV’s complete with a comment section I added which which keys I have available and their corresponding id’s.

<!-- Cave LG TV     -->
<!-- up			166 -->
<!-- down		167 -->
<!-- left		169 -->
<!-- right		168 -->
<!-- select/ok	 11 -->
<!-- back		216 -->
<!-- exit		216 -->
<!-- stop		224 -->
<!-- <<			221 -->
<!-- >>			223 -->
<!-- play		234 -->
<!-- pause		230 -->
<!-- red		251 -->
<!-- green		252 -->
<!-- yellow  	253 -->
<!-- blue		254 -->
<keymap>
	<FullscreenVideo>
		<keyboard>
			<key id="251">Seek(-200)</key>
			<key id="252">Seek(400)</key>
		</keyboard>
	</FullscreenVideo>
</keymap>

I don’t think I’ve seen Kodi pick up number keys via CEC on any post I’ve run across. They don’t forward on any TV in my house. If you want to use CEC for navigation it is going to be limited in function. If you wanted number keys you might look into the FLIRC USB device if you have a universal remote. That device also allows for long-press support which is nice.

@darwindesign and @fzinken Thanks for the replies!

It really makes it easier to understand.
Now I will dig into this after coming back home from a long day.

1 Like

Thanks, I tried to use the keymap editor to get the values for the various keys as you outlined. But the color buttons green-yellow-red triggered some action which caused the whole process to abort, like Kodi saying I don’t have a PVR attached…

But your codes match mine for the keys I was able to examine, except for play which comes out as 233 in my case and 234 in your case.
I am also using an LG Smart-TV…

Just to clarify:
Do I have to add the keymap data into the file:
/home/osmc/.kodi/userdata/advancedsettings.xml ?

I made a test by creating this advancedsettings.xml file and added this into it to make -3m -30s +30s +3m skips:
<keymap> <FullscreenVideo> <keyboard> <key id="251">Seek(-180)</key> <key id="252">Seek(-30)</key> <key id="253">Seek(30)</key> <key id="254">Seek(180)</key> </keyboard> </FullscreenVideo> </keymap>
Then I restarted the OSMC box and tested…
No-GO, when I hit the red button Kodi starts talking about missing hardware instead of skipping.
So obviously I am still missing something important…

By the way: how do you make this forum observe code formatting?
I cannot get a code section for the xml above show up properly like your previous example.
No line feeds where they should be for example.

Use the </> (preformatted code) function in the forum editor.

That is what I did and then the result looks like above…
The font is OK but the line feeds are not observed.

There are a few keys like that, and a few methods of figuring out what the corresponding mapping is anyway, but it was a bit more complicated than just showing the above id’s which I figured would fill in the blanks for any that did that. I would venture a guess that id 233 maps a CEC play/pause button where 234 is probably just a straight play button.

Also worth noting that the keymap editor add-on will destroy any manual edits it does not understand if you use it after you manually edited a keymap (such as the big comment line I put at the top of mine). As such it may be prudent to use it to discover and get started with a keymap but best to remove after that if your going to do manual edits.

No, keymaps go in:
/home/osmc/.kodi/userdata/keymaps/
The name of the file is not important if you just have a single keymap file and if you used keymap editor then you can just edit the gen.xml file it created there if you wish.

https://kodi.wiki/view/Keymap#Location_of_keymaps

It looks to me like you just manually added backticks to the front and back of the block and that doesn’t work across multiple lines. If you add an extra line return above the block of code, then highlight it, then when you press </> it will get you to where you want to be.

This is the current content of /home/osmc/.kodi/userdata/keymaps/gen.xml

image

I restarted OSMC but still get these “No PVR installed” messages when I use the red button…
Should the <keyboard> marker be something else when dealing with a CEC remote?