cec: don't make libCEC the active source when changing the physical address. don...
[deb_libcec.git] / src / lib / devices / CECBusDevice.cpp
index b42967d12613cdbaf48634aed0466b47032cf6e3..9e9145c0e76af2f4b2abcd70c60182f189166722 100644 (file)
@@ -513,6 +513,12 @@ void CCECBusDevice::SetInactiveSource(void)
 void CCECBusDevice::SetActiveSource(void)
 {
   CLockObject lock(&m_mutex);
+  if (!m_bActiveSource)
+  {
+    CStdString strLog;
+    strLog.Format("making %s (%x) the active source", GetLogicalAddressName(), m_iLogicalAddress);
+    AddLog(CEC_LOG_DEBUG, strLog);
+  }
 
   for (int iPtr = 0; iPtr < 16; iPtr++)
     if (iPtr != m_iLogicalAddress)
@@ -660,7 +666,7 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
       m_handler->SetVendorId(m_vendor);
       m_handler->InitHandler();
 
-      if (bActivateSource && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised())
+      if (bActivateSource && m_processor->GetLogicalAddresses().IsSet(m_iLogicalAddress) && m_processor->IsInitialised() && IsActiveSource())
         m_handler->ActivateSource();
     }
   }