How to make CEC fully work the way I want?

Got my Vero 4K today.

Had to replace the HDMI cable with the one that supports CEC.
Quickly realized that I would be using TV remote and not the Vero one because there is no volume control. I actually hoped to use the Vero one because it is smaller and looks good. Pity, but the power button and volume buttons are a must for me.

So, here are my thoughts and questions:

question 1: is it possible to map “double presses” or “press and hold” or something similar, to add volume control to Vero remote. And maybe hold the home button to turn off the TV?

question 2: My TV also has a RF 2.4 GHz remote control with USB dongle so that the remote sends the command via RF to TV and then the TV forwards the command via CEC.

It works except for some buttons, such as “back” button. I also would like to control Kodi volume separately from the TV volume, so mapping “Channel Up” and “Channel Down” to Kodi volume buttons would be really great. Is it possible to achieve?

question 3: Is it possible to customize the CEC functionality via USB - CEC Adapter from Pulse-Eight?

question 4: Is it possible to customize/map RF 2.4Ghz commands that Vero 4K receives? My TV remote control and Vero remote are on the same frequency, so I wondered if I can experiment there.

Thanks!

You can remap any keys to be the volume controls. The fast forward and rewind buttons are often used to do this.

Long press isn’t supported with CEC. See here. Some TVs hack around it, but it’s not passed through to OSMC. Repeat presses can be configured in Peripherals → Input.

What’s the question?

The first thing I would do is enable debug logging and check if the buttons you are pressing on your remote are being received by OSMC. If they are, you can remap them with keymap editor. If they are not, then you can’t, as the TV isn’t forwarding the button.

The dongle can’t be reprogrammed to accept new remote codes. There is a built in IR sensor which can be programmed with irrecord (LIRC)

Thanks for the reply!

It works except for some buttons, such as “back” button. I also would like to control Kodi volume separately from the TV volume, so mapping “Channel Up” and “Channel Down” to Kodi volume buttons would be really great. Is it possible to achieve?

You already answered it with this:

So, first step is the debugging.to see if it actually gets received.
Second, to do the remapping.
Third, see if the TV could receive the signal from Vero and turn itself off on a double “home” press.

I will try and report back.

Thank you for the help!

You need to see if it’s being forwarded to OSMC.

The Vero 4K is intended to be always-on

Sam

Got it!

Yes, Vero 4K will be alway on.

I thought about giving a try to control TV from Vero and not the opposite, since it is only On/Off that I need from TV and I want to use Vero remote. I want the double press of Home button to trigger TV’s On/Off.

CEC won’t pass through long presses; but you could map a button to turn off the TV with CECStandby in a remote.xml.

I have dedicated 1 minute at 09:53 to press “Channel Up” button slowly 5 times and then “Channel Down”
slowly 5 times. Here is what I have got in the logs for that minute. I am not sure how to evaluate that and if I could use that. Could you help me with evaluating the log, and if could map it to kodi volume up and down? or do I need to setup different type of logging?

thanks.


09:53:07.616 T:4110639104 DEBUG: LIRC: Update - NEW at 3569031:67 0 KEY_UP linux-input-layer (KEY_UP)
09:53:07.616 T:4110639104 DEBUG: OnKey: 166 (0xa6, obc89) pressed, action is Up
09:53:07.682 T:4110639104 DEBUG: LIRC: Update - NEW at 3569097:67 0 KEY_UP_UP linux-input-layer (KEY_UP_UP)
09:53:08.582 T:4110639104 DEBUG: LIRC: Update - NEW at 3569997:160 0 KEY_OK linux-input-layer (KEY_OK)
09:53:08.583 T:4110639104 DEBUG: OnKey: 11 (0x0b, obc244) pressed, action is Select
09:53:08.597 T:3900699632 DEBUG: osmc_settings: <OSMCSettingClass(Thread-47, initial daemon)>
09:53:08.597 T:3900699632 DEBUG: osmc_settings: False
09:53:08.598 T:3891000304 DEBUG: OSMC LOGGING scriptmoduleosmcsettinglogging.run received: pos0: <OSMCSettingClass(Thread-49, started daemon -403966992)>
09:53:08.624 T:4110639104 DEBUG: ------ Window Init (DialogAddonSettings.xml) ------
09:53:08.633 T:4110639104 DEBUG: LIRC: Update - NEW at 3570048:160 0 KEY_OK_UP linux-input-layer (KEY_OK_UP)
09:53:10.080 T:4110639104 DEBUG: LIRC: Update - NEW at 3571495:6c 0 KEY_DOWN linux-input-layer (KEY_DOWN)
09:53:10.080 T:4110639104 DEBUG: OnKey: 167 (0xa7, obc88) pressed, action is Down
09:53:10.138 T:4110639104 DEBUG: LIRC: Update - NEW at 3571553:6c 0 KEY_DOWN_UP linux-input-layer (KEY_DOWN_UP)
09:53:11.171 T:4110639104 DEBUG: LIRC: Update - NEW at 3572586:67 0 KEY_UP linux-input-layer (KEY_UP)
09:53:11.171 T:4110639104 DEBUG: OnKey: 166 (0xa6, obc89) pressed, action is Up
09:53:11.183 T:4110639104 DEBUG: LIRC: Update - NEW at 3572598:67 0 KEY_UP_UP linux-input-layer (KEY_UP_UP)
09:53:11.915 T:4110639104 DEBUG: LIRC: Update - NEW at 3573330:67 0 KEY_UP linux-input-layer (KEY_UP)
09:53:11.915 T:4110639104 DEBUG: OnKey: 166 (0xa6, obc89) pressed, action is Up
09:53:12.018 T:4110639104 DEBUG: LIRC: Update - NEW at 3573433:67 0 KEY_UP_UP linux-input-layer (KEY_UP_UP)
09:53:13.355 T:4110639104 DEBUG: LIRC: Update - NEW at 3574770:6c 0 KEY_DOWN linux-input-layer (KEY_DOWN)
09:53:13.356 T:4110639104 DEBUG: OnKey: 167 (0xa7, obc88) pressed, action is Down
09:53:13.456 T:4110639104 DEBUG: LIRC: Update - NEW at 3574871:6c 0 KEY_DOWN_UP linux-input-layer (KEY_DOWN_UP)
09:53:14.045 T:4110639104 DEBUG: LIRC: Update - NEW at 3575460:6a 0 KEY_RIGHT linux-input-layer (KEY_RIGHT)
09:53:14.045 T:4110639104 DEBUG: OnKey: 168 (0xa8, obc87) pressed, action is Right
09:53:14.063 T:4110639104 DEBUG: LIRC: Update - NEW at 3575478:6a 0 KEY_RIGHT_UP linux-input-layer (KEY_RIGHT_UP)
09:53:14.982 T:4110639104 DEBUG: LIRC: Update - NEW at 3576397:160 0 KEY_OK linux-input-layer (KEY_OK)
09:53:14.982 T:4110639104 DEBUG: OnKey: 11 (0x0b, obc244) pressed, action is Select
09:53:14.983 T:3671430128 DEBUG: Thread LanguageInvoker start, auto delete: false
09:53:14.983 T:3671430128 INFO: initializing python engine.
09:53:14.983 T:3671430128 DEBUG: CPythonInvoker(10, /usr/share/kodi/addons/script.module.osmcsetting.logging/resources/lib/grablogs.py): start processing
09:53:15.049 T:4110639104 DEBUG: LIRC: Update - NEW at 3576464:160 0 KEY_OK_UP linux-input-layer (KEY_OK_UP)

Ok, the good news is they are transmitted. So now you either can use the keymap editor (http://kodi.wiki/view/Add-on:Keymap_Editor) to map the key to an action (Volume up/down) or configure it manually via keymaps
http://kodi.wiki/view/Keymaps

I did further investigation and installed Keymap editor add-on. I tried to map the channels up and down buttons and it did not work. I plugged in the USB-CEC and tested all buttons. It seems like only some buttons get passed through CEC:

So, using this remote via CEC gives me even fewer buttons.

What i have figured out that from USB CEC I can send “Power On” and “Power Off” commands to the TV, which now I am thinking to assign to the Vero remote instead.

As you suggested, I will try CECToggleState (Keymap) in a remote.xml. It is not as trivial as I thought but at least there is hope of getting away just with one remote.

By the way, this Swedx screen does not have IR, only RF. So the combination of RF + CEC is the way to go for me.

I am getting there. Need some help with mapping of CECActivateSource, CECStandby, CECToggleState.

I tried the commands from the shell:

echo "standby 0" | cec-client - s
echo "on 0" | cec-client - s

and as expected, the first one turns the tv off. the second one back on. so far so good.

now I go into remote.xml and change the mapping:

<?xml version="1.0" encoding="UTF-8"?>
...
<keymap>
  <global>
    <remote>
      <play>PlayPause</play>
      <pause>Pause</pause>
      <stop>Stop</stop>
      <forward>CECActivateSource</forward>
      <reverse>CECStandby</reverse>
      ...
    </remote>
  </global>
...
</keymap>

I tried both

CECActivateSource, CECStandby
and
CECActivateSource(), CECStandby()

but none of them seem to work.

What am I doing wrong?

Thanks!

What does the log show when you press the button?

CECActivateSource actually works, it is because I was not able the CECStandby to get through:

CECStandby is the one that does not work.

LOG (I tried to press the “Rewind” button every 10 seconds for 1 minute @ 19:09):

19:09:02.268 T:4108713984   DEBUG: LIRC: Update - NEW at 525981:a8 0 KEY_REWIND linux-input-layer (KEY_REWIND)
19:09:02.309 T:4108713984   DEBUG: ToggleDeviceState - putting CEC device on standby...
19:09:02.393 T:4108713984   DEBUG: LIRC: Update - NEW at 526107:a8 0 KEY_REWIND_UP linux-input-layer (KEY_REWIND_UP)
19:09:13.211 T:4108713984   DEBUG: LIRC: Update - NEW at 536925:a8 0 KEY_REWIND linux-input-layer (KEY_REWIND)
19:09:13.253 T:4108713984   DEBUG: ToggleDeviceState - putting CEC device on standby...
19:09:13.322 T:4108713984   DEBUG: LIRC: Update - NEW at 537035:a8 0 KEY_REWIND_UP linux-input-layer (KEY_REWIND_UP)
19:09:23.964 T:4108713984   DEBUG: LIRC: Update - NEW at 547677:a8 0 KEY_REWIND linux-input-layer (KEY_REWIND)
19:09:24.005 T:4108713984   DEBUG: ToggleDeviceState - putting CEC device on standby...
19:09:24.047 T:4108713984   DEBUG: LIRC: Update - NEW at 547761:a8 0 KEY_REWIND_UP linux-input-layer (KEY_REWIND_UP)
19:09:33.753 T:3906991088   DEBUG: script.module.osmcsetting.updates :  - blurp 904 - Home.xml
19:09:33.951 T:4108713984   DEBUG: LIRC: Update - NEW at 557665:a8 0 KEY_REWIND linux-input-layer (KEY_REWIND)
19:09:33.993 T:4108713984   DEBUG: ToggleDeviceState - putting CEC device on standby...
19:09:33.997 T:4108713984   DEBUG: LIRC: Update - NEW at 557710:a8 0 KEY_REWIND_UP linux-input-layer (KEY_REWIND_UP)
19:09:43.609 T:4108713984   DEBUG: LIRC: Update - NEW at 567322:a8 0 KEY_REWIND linux-input-layer (KEY_REWIND)
19:09:43.651 T:4108713984   DEBUG: ToggleDeviceState - putting CEC device on standby...
19:09:43.734 T:4108713984   DEBUG: LIRC: Update - NEW at 567447:a8 0 KEY_REWIND_UP linux-input-layer (KEY_REWIND_UP)
19:10:02.268 T:4108713984   DEBUG: LIRC: Update - NEW at 585981:160 0 KEY_OK linux-input-layer (KEY_OK)

It does not work when I use CECToggleState for forward button either:

20:09:02.822 T:4110577664   DEBUG: LIRC: Update - NEW at 228829:d0 0 KEY_FASTFORWARD linux-input-layer (KEY_FASTFORWARD)
20:09:02.822 T:4110577664   DEBUG: OnKey: action CECToggleState [122], toggling state of playing device
20:09:02.822 T:4110577664   DEBUG: ToggleDeviceState - putting CEC device on standby...
20:09:02.992 T:4110577664   DEBUG: LIRC: Update - NEW at 228998:d0 0 KEY_FASTFORWARD_UP linux-input-layer (KEY_FASTFORWARD_UP)
20:09:14.556 T:4110577664   DEBUG: LIRC: Update - NEW at 240562:160 0 KEY_OK linux-input-layer (KEY_OK)
20:09:14.556 T:4110577664   DEBUG: OnKey: 11 (0x0b, obc244) pressed, action is Select
20:09:14.556 T:4110577664  NOTICE: Disabled debug logging due to GUI setting. Level 0. 

It does not work to switch either ON or OFF (when I switch the TV with another remote first) with this button.

my latest test and log: https://pastebin.com/raw/2SrWi4pZ

  1. When trying to turn off the TV with its original remote, not via CEC, the log says:

ERROR: OnTvStandby - Unexpected [standby_pc_on_tv_standby] setting value

I have the value standby_pc_on_tv_standby set to 36028 in cec_CEC_Adapter.xml
Is it something that I need to change?

  1. When CEC successfully turns ON the TV, the last lines say:

22:41:10.226 T:3970954224 DEBUG: CecLogMessage - << 10:8e:00 22:41:10.406 T:3970954224 WARNING: CecLogMessage - Write: write failed 22:41:10.406 T:3970954224 DEBUG: CecLogMessage - << 10:8e:00 22:41:10.585 T:3970954224 WARNING: CecLogMessage - Write: write failed

is there something somewhere to adjust/fix?

Thank you.

It could be a settings issue in the CEC configuration. I remember a string was duplicated / misused before which caused some confusion, but think this was fixed some time ago.

The setting should be configurable in Peripherals → Input

I changed the setting to 0 and now this error is not coming up when I put TV to standby.

any ideas what 10:8e:00 is and what kind of Write it is and why it failed?

22:41:10.406 T:3970954224 DEBUG: CecLogMessage - << 10:8e:00
22:41:10.585 T:3970954224 WARNING: CecLogMessage - Write: write failed

Thanks!

It is an address.

With snippets, it’s hard to speculate what the issue is. If things are working, then it can be largely
ignored.