Add configurable device vendor ID (libcec_configuration.iDeviceVendorId)#714
Open
Andy1210 wants to merge 1 commit into
Open
Add configurable device vendor ID (libcec_configuration.iDeviceVendorId)#714Andy1210 wants to merge 1 commit into
Andy1210 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libCEC hardcodes
CEC_VENDOR_PULSE_EIGHTas the identity of the devices it handles — the Linux adapter registers it viaCEC_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
iDeviceVendorIdtolibcec_configuration(defaultCEC_VENDOR_UNKNOWN= current behavior) so an application can present a consistent vendor identity from the first bus transaction, plus a--vendor-idoption in cec-client.Changes
libcec_configuration.iDeviceVendorId(new field, defaultCEC_VENDOR_UNKNOWN), copied inCCECClient::Get/SetConfiguration.CEC_ADAP_S_LOG_ADDRSinOpen()andSetLogicalAddresses()) announces the configured vendor when set, otherwiseCEC_VENDOR_PULSE_EIGHTas 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 e091the TV completes the SIMPLINK handshake and forwards remote keys; without it it probes forever and forwards nothing. Default behavior is unchanged wheniDeviceVendorIdis left atCEC_VENDOR_UNKNOWN.