From: Lars Op den Kamp Date: Fri, 17 Feb 2012 09:53:56 +0000 (+0100) Subject: cec: fixed 'unsupported command' marking in CCECBusDevice X-Git-Tag: upstream/2.2.0~1^2~35^2~16 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=66c3ef5adae1e4cdaadb7379a40387e5fc207124;p=deb_libcec.git cec: fixed 'unsupported command' marking in CCECBusDevice --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 3638453..a0d612e 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -169,7 +169,8 @@ bool CCECBusDevice::RequestCecVersion(void) { bool bReturn(false); - if (!MyLogicalAddressContains(m_iLogicalAddress)) + if (!MyLogicalAddressContains(m_iLogicalAddress) && + !IsUnsupportedFeature(CEC_OPCODE_GET_CEC_VERSION)) { MarkBusy(); CLibCEC::AddLog(CEC_LOG_NOTICE, "<< requesting CEC version of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); @@ -811,7 +812,7 @@ bool CCECBusDevice::TransmitOSDName(cec_logical_address dest) bool CCECBusDevice::TransmitOSDString(cec_logical_address dest, cec_display_control duration, const char *strMessage) { bool bReturn(false); - if (!IsUnsupportedFeature(CEC_OPCODE_SET_OSD_STRING)) + if (!m_processor->m_busDevices[dest]->IsUnsupportedFeature(CEC_OPCODE_SET_OSD_STRING)) { CLibCEC::AddLog(CEC_LOG_NOTICE, "<< %s (%X) -> %s (%X): display OSD message '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, strMessage); MarkBusy(); @@ -933,11 +934,15 @@ bool CCECBusDevice::TransmitKeyRelease(bool bWait /* = true */) bool CCECBusDevice::IsUnsupportedFeature(cec_opcode opcode) const { - return m_unsupportedFeatures.find(opcode) != m_unsupportedFeatures.end(); + bool bUnsupported = (m_unsupportedFeatures.find(opcode) != m_unsupportedFeatures.end()); + if (bUnsupported) + CLibCEC::AddLog(CEC_LOG_NOTICE, "'%s' is marked as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName()); + return bUnsupported; } void CCECBusDevice::SetUnsupportedFeature(cec_opcode opcode) { + CLibCEC::AddLog(CEC_LOG_DEBUG, "marking opcode '%s' as unsupported feature for device '%s'", ToString(opcode), GetLogicalAddressName()); m_unsupportedFeatures.insert(opcode); } diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 83d9936..f742fc9 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -49,6 +49,7 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) : m_iTransmitRetries(CEC_DEFAULT_TRANSMIT_RETRIES), m_bHandlerInited(false), m_expectedResponse(CEC_OPCODE_NONE), + m_lastCommandSent(CEC_OPCODE_NONE), m_bOPTSendDeckStatusUpdateOnActiveSource(false), m_vendorId(CEC_VENDOR_UNKNOWN), m_bRcvSignal(false) @@ -191,7 +192,8 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command) { CLockObject lock(m_receiveMutex); if (m_expectedResponse == CEC_OPCODE_NONE || - m_expectedResponse == command.opcode) + m_expectedResponse == command.opcode || + (command.opcode == CEC_OPCODE_FEATURE_ABORT && command.parameters.size > 0 && command.parameters[0] == m_lastCommandSent)) { m_bRcvSignal = true; m_condition.Signal(); @@ -251,10 +253,8 @@ bool CCECCommandHandler::HandleDeviceVendorId(const cec_command &command) bool CCECCommandHandler::HandleFeatureAbort(const cec_command &command) { - if (command.parameters.size == 2) - { + if (command.parameters.size == 2 && command.parameters[1] == CEC_ABORT_REASON_UNRECOGNIZED_OPCODE) m_processor->m_busDevices[command.initiator]->SetUnsupportedFeature((cec_opcode)command.parameters[0]); - } return true; } @@ -967,12 +967,13 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /* while (!bReturn && ++iTries <= iMaxTries) { m_expectedResponse = expectedResponse; + m_lastCommandSent = command.opcode; + m_bRcvSignal = false; if ((bReturn = m_processor->Transmit(command)) == true) { CLibCEC::AddLog(CEC_LOG_DEBUG, "command transmitted"); if (bExpectResponse) bReturn = m_condition.Wait(m_receiveMutex, m_bRcvSignal, m_iTransmitWait); - m_bRcvSignal = false; CLibCEC::AddLog(CEC_LOG_DEBUG, bReturn ? "expected response received" : "expected response not received"); } } diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index a60dc73..a1b1f96 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -137,6 +137,7 @@ namespace CEC int8_t m_iTransmitRetries; bool m_bHandlerInited; cec_opcode m_expectedResponse; + cec_opcode m_lastCommandSent; bool m_bOPTSendDeckStatusUpdateOnActiveSource; cec_vendor_id m_vendorId; PLATFORM::CMutex m_receiveMutex;