cec: only set the logical address once when it hasn't changed
authorLars Op den Kamp <lars@opdenkamp.eu>
Sat, 29 Oct 2011 21:25:21 +0000 (23:25 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sat, 29 Oct 2011 21:25:21 +0000 (23:25 +0200)
src/lib/CECProcessor.cpp

index b5cd540fb9135d26a1685a47f3c20406e87a41d8..7e8af29c0a88abce63037bb29e2e614f5e5133f5 100644 (file)
@@ -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)