CEC Remote keymap remap
#1
Hi,

Trying to remap the long press of one of my samsung remote buttons. It shows up as clear in the logs I have below but when i try to set up the keymap.xml file it does not work. Anyone here know how to properly do this.

the first log is my htpcs keyboard to show the difference of how kodi handles CEC vs Keyboard. I also have my keymap.xml at the bottom

Code:

### htpc keyboard
htpc:~ # tail -F .kodi/temp/kodi.log
2021-08-31 16:41:47.982 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:41:47.998 T:907      INFO <general>: Skipped 1 duplicate messages..
2021-08-31 16:41:47.998 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 4247
2021-08-31 16:41:48.126 T:907     DEBUG <general>: ------ Window Deinit (DialogSelect.xml) ------
2021-08-31 16:41:50.704 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:41:50.715 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 11409
2021-08-31 16:41:59.691 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:41:59.700 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 8826
2021-08-31 16:42:02.791 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:42:02.801 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 8942
2021-08-31 16:42:09.786 T:907     DEBUG <general>: Keyboard: scancode: 0x3e, sym: 0x012f, unicode: 0x0000, modifier: 0x2
2021-08-31 16:42:09.787 T:907     DEBUG <general>: HandleKey: rightshift (0xf0d3) pressed, action is
2021-08-31 16:42:09.787 T:907     DEBUG <general>: Keyboard: scancode: 0x15, sym: 0x002b, unicode: 0x002b, modifier: 0x2
2021-08-31 16:42:09.787 T:907     DEBUG <general>: HandleKey: plus (0xf02b) pressed, action is VolumeUp
2021-08-31 16:42:09.787 T:907     DEBUG <general>: ------ Window Init (DialogVolumeBar.xml) ------
2021-08-31 16:42:09.910 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:42:09.919 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 8027
2021-08-31 16:42:09.935 T:907     DEBUG <general>: Keyboard: scancode: 0x3e, sym: 0x012f, unicode: 0x0000, modifier: 0x0
2021-08-31 16:42:09.935 T:907     DEBUG <general>: Keyboard: scancode: 0x15, sym: 0x003d, unicode: 0x0000, modifier: 0x0
2021-08-31 16:42:10.911 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:42:10.919 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 7883
2021-08-31 16:42:10.958 T:907     DEBUG <general>: ------ Window Deinit (DialogVolumeBar.xml) ------
2021-08-31 16:42:11.793 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync check blocking
2021-08-31 16:42:11.803 T:907     DEBUG <general>: CGLContextEGL::SwapBuffers: sync sleep: 9031

## tvpi

2021-08-31 15:18:32.341 T:795     DEBUG <general>: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control release (45)
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - CLinuxCECAdapterCommunication:Tonguerocess - ioctl CEC_RECEIVE - rx_status=01 len=3 addr=01 opcode=44
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - >> 01:44:02
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - SetCurrentButton down (2) D:0ms cur:2
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - key pressed: down (2) current(ff) duration(0)
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - Changed key down (2) D:0ms cur:ff
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - key pressed: down (2, 0)
2021-08-31 15:18:32.989 T:795     DEBUG <general>: PushCecKeypress - received key a7 duration 0
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - CheckKeypressTimeout T:96.913
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - Key down: idle (duration:0) (2) timeout:-306003168ms (rel:500,rep:0,prs:500,rel:0)
2021-08-31 15:18:32.989 T:795     DEBUG <general>: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control pressed (44)
2021-08-31 15:18:33.004 T:758     DEBUG <general>: HandleKey: 167 (0xa7, obc88) pressed, action is Down
2021-08-31 15:18:33.192 T:795     DEBUG <general>: CecLogMessage - CLinuxCECAdapterCommunication:Tonguerocess - ioctl CEC_RECEIVE - rx_status=01 len=2 addr=01 opcode=45
2021-08-31 15:18:33.192 T:795     DEBUG <general>: CecLogMessage - >> 01:45
2021-08-31 15:18:33.192 T:795     DEBUG <general>: CecLogMessage - key released: down (2) D:203ms
2021-08-31 15:18:33.192 T:795     DEBUG <general>: PushCecKeypress - received key a7 duration 203
2021-08-31 15:18:33.192 T:795     DEBUG <general>: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control release (45)
2021-08-31 15:18:35.140 T:795     DEBUG <general>: CecLogMessage - CLinuxCECAdapterCommunication:Tonguerocess - ioctl CEC_RECEIVE - rx_status=01 len=3 addr=01 opcode=44
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - >> 01:44:2c
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - SetCurrentButton clear (2c) D:0ms cur:2c
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - key pressed: clear (2c) current(ff) duration(0)
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - Changed key clear (2c) D:0ms cur:ff
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - key pressed: clear (2c, 0)
2021-08-31 15:18:35.141 T:795     DEBUG <general>: PushCecKeypress - received key f9 duration 0
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - CheckKeypressTimeout T:99.064
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - Key clear: idle (duration:0) (2c) timeout:-306003168ms (rel:500,rep:0,prs:500,rel:0)
2021-08-31 15:18:35.141 T:795     DEBUG <general>: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control pressed (44)
2021-08-31 15:18:35.145 T:758     DEBUG <general>: HandleKey: 249 (0xf9, obc6) pressed, action is Delete
2021-08-31 15:18:35.145 T:758     DEBUG <general>: ------ Window Init (DialogConfirm.xml) ------
2021-08-31 15:18:35.145 T:758      INFO <general>: Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2021-08-31 15:18:35.641 T:795     DEBUG <general>: CecLogMessage - CheckKeypressTimeout T:99.565
2021-08-31 15:18:35.641 T:795     DEBUG <general>: CecLogMessage - Key unknown: idle (duration:501) (ff) timeout:565118510ms (rel:1000,rep:0,prs:0,rel:0)
2021-08-31 15:18:35.745 T:795     DEBUG <general>: CecLogMessage - CLinuxCECAdapterCommunication:Tonguerocess - ioctl CEC_RECEIVE - rx_status=01 len=2 addr=01 opcode=45
2021-08-31 15:18:35.746 T:795     DEBUG <general>: CecLogMessage - >> 01:45
2021-08-31 15:18:35.746 T:795     DEBUG <general>: CecLogMessage - >> TV (0) -> Recorder 1 (1): user control release (45)

xml:

<keymap>
  <global>
    <remote>
    <clear>ContextMenu</clear>
    </remote>
  </global>
  <FileManager>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </FileManager>
  <FileBrowser>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </FileBrowser>
  <MusicPlaylist>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </MusicPlaylist>
  <MusicPlaylistEditor>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </MusicPlaylistEditor>
  <Music>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </Music>
  <Pictures>
    <remote>
      <clear>ContextMenu</clear>
    </remote>
  </Pictures>
</keymap>
Reply
#2
Long presses are done with a modifier, such as <return mod="longpress">ContextMenu</return>.

That said, that's from a keyboard map - if I remember correctly I don't think CEC (wiki) can do long presses.

See the wiki page on keymaps (wiki) (and especially the GitHub links from it in section 2.1 for the default maps as examples) for more details.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
Yup why I attached the logs the long press shows up as clear button for the back button. Why I want to remap it to contextmenu. CEC does not support long press it just comes as a different key from what i read which in my case is clear. But yeah the remap is not taking effect.
(2021-09-01, 17:12)DarrenHill Wrote: Long presses are done with a modifier, such as <return mod="longpress">ContextMenu</return>.

That said, that's from a keyboard map - if I remember correctly I don't think CEC (wiki) can do long presses.

See the wiki page on keymaps (wiki) (and especially the GitHub links from it in section 2.1 for the default maps as examples) for more details.
Reply
#4
Yes, as I said I don't think CEC supports the longpress function, so it can't be done.

You would have to map another key or use a different control.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#5
So do you mean that remapping is not possible for cec long pressed buttons? Because i clearly see the button mapped in the logs as "clear" and not its normal "back" function and kodi also recognises that action.
(2021-09-01, 18:07)DarrenHill Wrote: Yes, as I said I don't think CEC supports the longpress function, so it can't be done.

You would have to map another key or use a different control.https://hackaday.com/wp-content/uploads/2019/04/KiCon2019-blinky-grid.jpg
Reply
#6
That has always been my understanding yes. Long-press on CEC cannot be mapped in Kodi, only for Keyboard inputs.

The buttons themselves can be mapped, but only for normal pressing not long press.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#7
Long press does not go with CEC unfortunately. Tried it, forgot about it and got a remote recognized as a keyboard.
Reply

Logout Mark Read Team Forum Stats Members Help
CEC Remote keymap remap0