Skip to content

fixed: GetCurrentConfiguration() did not return the combo key settings - #758

Open
mickderks wants to merge 1 commit into
Pulse-Eight:masterfrom
mickderks:fix-combo-key-config-roundtrip
Open

mickderks wants to merge 1 commit into
Pulse-Eight:masterfrom
mickderks:fix-combo-key-config-roundtrip

Conversation

@mickderks

@mickderks mickderks commented Oct 30, 2026 •

Copy link
Copy Markdown

GetCurrentConfiguration() never wrote comboKey and iComboKeyTimeoutMs.

This is fine in C++, as libcec_configuration is constructed with CEC_USER_CONTROL_CODE_STOP and 1000ms (cectypes.h:1687)

LibCecSharp passes a zero-filled struct, so comboKey came back as Select and iComboKeyTimeoutMs as a 0ms timeout.

CECClient.cpp:1279 then refuses to send the key press of the OK button, as it is the comboKey;

  if (!isrepeat && (key.keycode != comboKey || key.duration > 0))
  {
    LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration);
    QueueAddKey(transmitKey);
  }

The logs before this fix;

TRAFFIC: 39770 >> 01:44:04
DEBUG: 39770 >> TV (0) -> Recorder 1 (1): user control pressed (44)
DEBUG: 39770 SetCurrentButton right (4) D:0ms cur:13e7f5f0
DEBUG: 39770 key pressed: right (4) current(ff) duration(0)
DEBUG: 39770 Changed key right (4) D:0ms cur:ff
DEBUG: 39770 key pressed: right (4, 0)
sent key '4' to 'Foreground application'
DEBUG: 39770 CEC::CCECClient::CheckKeypressTimeout T:1446.037
DEBUG: 39770 Key right: idle (duration:0) (4) timeout:1000ms (rel:5000,rep:0,prs:1,rel:0)
TRAFFIC: 39848 >> 01:45
DEBUG: 39848 >> TV (0) -> Recorder 1 (1): user control release (45)
DEBUG: 39848 key released: right (4) D:78ms
TRAFFIC: 40732 >> 01:44:00
DEBUG: 40732 >> TV (0) -> Recorder 1 (1): user control pressed (44)
DEBUG: 40732 SetCurrentButton select (0) D:0ms cur:13e7f5f0
DEBUG: 40732 key pressed: select (0) current(ff) duration(0)
DEBUG: 40732 Changed key select (0) D:0ms cur:ff
DEBUG: 40732 CEC::CCECClient::CheckKeypressTimeout T:1446.999
DEBUG: 40732 Key select: idle (duration:0) (0) timeout:1000ms (rel:5000,rep:0,prs:1,rel:0)
TRAFFIC: 40854 >> 01:45
DEBUG: 40854 >> TV (0) -> Recorder 1 (1): user control release (45)
DEBUG: 40854 key released: select (0) D:122ms

After this fix it should correctly include;

key pressed: select (0, 0)
sent key '0' to 'Foreground application'

Full disclosure; I have not tested this exact fix, as I do not have the right C++ tools installed. I did, however, change LibCecTray's CECController.cs by changing

    public override int ConfigurationChanged(LibCECConfiguration config)
    {
      Config.Update(config);
      Settings.PhysicalAddress.Value = config.PhysicalAddress;
      ...

to

    public override int ConfigurationChanged(LibCECConfiguration config)
    {
      Config.Update(config);
      Config.ComboKey = CecUserControlCode.Stop;
      Config.ComboKeyTimeoutMs = 1000;
      Settings.PhysicalAddress.Value = config.PhysicalAddress;
      ...

before building this and testing it. My TV remote's OK button immediately started working, where before it didn't.
Given that this effectively patches the issue on the cec-tray side, I feel confident that this patch fixes the root issue.

`GetCurrentConfiguration()` never wrote `comboKey` and `iComboKeyTimeoutMs`.

This is fine in C++, as `libcec_configuration` is constructed with `CEC_USER_CONTROL_CODE_STOP` and 1000ms (`cectypes.h:1687`)

LibCecSharp passes a zero-filled struct, so `comboKey` came back as Select and `iComboKeyTimeoutMs` as a 0ms timeout.

CECClient.cpp:1279 then refused to send the key press of the OK button, as it is considered the `comboKey`.
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for the contribution. Before we can merge it we ask that you accept the Pulse-Eight contributor agreement, which grants us the rights we need to ship your work under every licence libCEC is offered under.
Sign the Individual agreement if you hold the copyright yourself, or the Entity agreement if your employer does, and email the scan to contributor-agreement@pulse-eight.com. Then post the line below as a comment here, so the pull request records that you did:


I have signed the Pulse-Eight contributor agreement and sent it by email


Mick seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@mickderks

Copy link
Copy Markdown
Author

I'm going to be honest. Reading, understanding, and signing a pdf, and then emailing it for this pull request exceeds the quantity of fucks I have left to give, For what it's worth; I agree to let you share, distribute, relicense, or do whatever you want with this pull request and the code therein.

@malard

malard commented Oct 30, 2026

Copy link
Copy Markdown
Member

mick the auto responder is a bit out of date, we've had for a decade, i will give it a review. thanks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants