Skip to content

Add configurable device vendor ID (libcec_configuration.iDeviceVendorId)#714

Open
Andy1210 wants to merge 1 commit into
Pulse-Eight:masterfrom
Andy1210:device-vendor-id
Open

Add configurable device vendor ID (libcec_configuration.iDeviceVendorId)#714
Andy1210 wants to merge 1 commit into
Pulse-Eight:masterfrom
Andy1210:device-vendor-id

Conversation

@Andy1210

@Andy1210 Andy1210 commented Jul 6, 2026

Copy link
Copy Markdown

libCEC hardcodes CEC_VENDOR_PULSE_EIGHT as the identity of the devices it handles — the Linux adapter registers it via CEC_ADAP_S_LOG_ADDRS (the kernel then broadcasts <Device Vendor ID> with it at every logical-address claim), and devices handled by libCEC answer <Give Device Vendor ID> with it until a vendor-specific handler replaces the default.

Some TVs key protocol features on that identity. The reproducible case is LG SIMPLINK: the TV only forwards remote keys to devices whose vendor ID reads LG (0x00e091), queries the vendor ~200 ms after a device appears — before the SL handler is installed — and caches the first answer per logical address, so the built-in LG masquerade loses the race and the device never receives remote keys.

This adds iDeviceVendorId to libcec_configuration (default CEC_VENDOR_UNKNOWN = current behavior) so an application can present a consistent vendor identity from the first bus transaction, plus a --vendor-id option in cec-client.

Changes

  • libcec_configuration.iDeviceVendorId (new field, default CEC_VENDOR_UNKNOWN), copied in CCECClient::Get/SetConfiguration.
  • Linux adapter (CEC_ADAP_S_LOG_ADDRS in Open() and SetLogicalAddresses()) announces the configured vendor when set, otherwise CEC_VENDOR_PULSE_EIGHT as before.
  • CCECBusDevice::SetDeviceStatus(CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC) uses the configured vendor for own devices, so <Give Device Vendor ID> replies match from the first transaction.
  • cec-client --vendor-id <hex> to set it from the CLI.

Validation

Tested on a Raspberry Pi 5 (vc4_hdmi, kernel CEC API, kernel 6.18) against an LG TV where the race reproduces deterministically: with --vendor-id e091 the TV completes the SIMPLINK handshake and forwards remote keys; without it it probes forever and forwards nothing. Default behavior is unchanged when iDeviceVendorId is left at CEC_VENDOR_UNKNOWN.

libCEC hardcodes CEC_VENDOR_PULSE_EIGHT as the identity of the devices it
handles: the Linux adapter registers it via CEC_ADAP_S_LOG_ADDRS (the
kernel then broadcasts it in <Device Vendor ID> at every logical address
claim) and devices marked as handled by libCEC answer
<Give Device Vendor ID> with it until a vendor-specific handler replaces
the default. Some TVs key protocol features on that identity. LG SIMPLINK
is the reproducible case: the TV only forwards remote keys to devices
whose vendor ID reads LG (0x00e091), queries the vendor ~200 ms after a
new device appears — before the LG (SL) handler is installed — and caches
the first answer per logical address, so libCEC's built-in LG masquerade
loses that race and the device never receives remote keys.

Add an iDeviceVendorId field to libcec_configuration (default
CEC_VENDOR_UNKNOWN = keep today's behavior) so the application can present
a consistent vendor identity from the very first bus transaction, plus a
--vendor-id option in cec-client to set it.

Validated on a Raspberry Pi 5 (vc4_hdmi, kernel CEC API, kernel 6.18)
against an LG TV where the race reproduces deterministically: with
--vendor-id e091 the TV completes the SIMPLINK handshake and forwards
remote keys; without it the TV probes the device forever and forwards
nothing. Default behavior is unchanged.
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.

1 participant