From: Lars Op den Kamp Date: Sat, 29 Oct 2011 21:25:21 +0000 (+0200) Subject: cec: only set the logical address once when it hasn't changed X-Git-Tag: upstream/2.2.0~1^2~185 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0677510792d7ad89652ea636d0f3dbf868ead04f;p=deb_libcec.git cec: only set the logical address once when it hasn't changed --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index b5cd540..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)