X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=7e8af29c0a88abce63037bb29e2e614f5e5133f5;hb=0677510792d7ad89652ea636d0f3dbf868ead04f;hp=c73c02d21748f324ce105ae134ee7f830a48376c;hpb=13929cffe20a14024ab52a2f93b4edd414e129d1;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index c73c02d..7e8af29 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -149,12 +149,17 @@ void CCECProcessor::LogOutput(const cec_command &data) bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress) { - CStdString strLog; - strLog.Format("<< setting logical address to %1x", iLogicalAddress); - m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); + if (m_iLogicalAddress != iLogicalAddress) + { + CStdString strLog; + strLog.Format("<< setting logical address to %1x", iLogicalAddress); + m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); + + m_iLogicalAddress = iLogicalAddress; + return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); + } - m_iLogicalAddress = iLogicalAddress; - return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); + return true; } bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) @@ -189,17 +194,8 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true if (bWaitForAck) { - uint64_t now = GetTimeMs(); - uint64_t target = now + 1000; bool bError(false); - - while (!bReturn && now < target && !bError) - { - bReturn = WaitForAck(&bError, output.size(), (uint32_t) (target - now)); - now = GetTimeMs(); - } - - if (!bReturn) + if ((bReturn = WaitForAck(&bError, output.size(), 1000)) == false) m_controller->AddLog(CEC_LOG_ERROR, "did not receive ack"); } else