Repository navigation
Conversation
…erent one The Linux CEC framework ignores log_addr[0] in CEC_ADAP_S_LOG_ADDRS and claims the first free logical address of the requested type itself. When the kernel's poll and libCEC's poll disagree (e.g. due to a false ACK on the bus, or after a physical address change / HPD / TV power cycle where the kernel re-claims on its own), the kernel ends up on a different logical address than the one libCEC uses as initiator, causing every subsequent CEC_TRANSMIT ioctl to fail with EINVAL. Track the logical address libCEC expects, retry clearing and claiming up to 3 times if the kernel claims a different address, and verify the claimed address after CEC_EVENT_STATE_CHANGE (with a cooldown timer to avoid endless loops if the address is genuinely taken).
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. It is needed once, not for every pull request. I have read the Pulse-Eight Individual Contributor License Agreement, version 2, and I accept it You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This branch has not been deployed
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.
Problem
The Linux CEC framework ignores
log_addr[0]inCEC_ADAP_S_LOG_ADDRSand claims the first free logical address of the requested type itself (e.g. 1, 2, 9 for a recorder).When the kernel's poll and libCEC's poll disagree (e.g. a transient false ACK on the bus), or when the kernel re-claims automatically after a physical address change (HPD / TV power cycle / initial claim without a valid physical address), the kernel can end up on a different logical address than libCEC. Every subsequent
CEC_TRANSMITfrom libCEC then fails withEINVAL("initiator has unknown logical address").Solution
m_wantedAddress), guarded bym_mutex.ClaimLogicalAddress(), verifylog_addrs.log_addr_maskafterCEC_ADAP_S_LOG_ADDRSand retry clearing and claiming (up to 3 attempts with 500 ms delay) if the kernel claimed a different address.CEC_EVENT_STATE_CHANGEwith a non-zerolog_addr_mask, scheduleVerifyLogicalAddress()after a 1-second debounce to catch kernel-initiated re-claims that landed on the wrong address.m_repairTimeout) after a failed repair so state-change events do not trigger a retry loop when the address is genuinely occupied.