cec: fixed - set the physical address of each device controlled by a CCECClient if...
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 22 Jun 2012 10:28:34 +0000 (12:28 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 22 Jun 2012 10:28:34 +0000 (12:28 +0200)
src/lib/CECClient.cpp
src/lib/CECProcessor.cpp
src/lib/devices/CECBusDevice.cpp

index 008831b95527b6438747b4ebc4f6b12e668292a8..2f3dabbcb49637805632f9c4993c7b488f2adec4 100644 (file)
@@ -1173,7 +1173,10 @@ cec_device_type_list CCECClient::GetDeviceTypes(void)
 bool CCECClient::SetDevicePhysicalAddress(const uint16_t iPhysicalAddress)
 {
   if (!CLibCEC::IsValidPhysicalAddress(iPhysicalAddress))
+  {
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - not setting invalid physical address %04x", iPhysicalAddress);
     return false;
+  }
 
   // reconfigure all devices
   cec_logical_address reactivateSource(CECDEVICE_UNKNOWN);
index 1975421fc9de39c9fdf6dbd491a551ef63d74dd0..324c5580e7439d8c21c62c108124824f2f0894d0 100644 (file)
@@ -666,6 +666,10 @@ bool CCECProcessor::RegisterClient(CCECClient *client)
   m_busDevices->GetByLogicalAddresses(devices, configuration.logicalAddresses);
   for (CECDEVICEVEC::const_iterator it = devices.begin(); it != devices.end(); it++)
   {
+               // set the physical address of the device at this LA
+    if (CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress))
+      (*it)->SetPhysicalAddress(configuration.iPhysicalAddress);
+
     // replace a previous client
     CLockObject lock(m_mutex);
     m_clients.erase((*it)->GetLogicalAddress());
index 47bd53aff566b60bcf98ece20a76867a1539805a..88d6b46c35cea9ddd00dc8e19df40faf18089acf 100644 (file)
@@ -951,7 +951,7 @@ bool CCECBusDevice::TransmitActiveSource(void)
     CLockObject lock(m_mutex);
     if (!HasValidPhysicalAddress())
     {
-      LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X) has an invalid physical address, not sending active source commands", GetLogicalAddressName(), m_iLogicalAddress);
+      LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X) has an invalid physical address (%04x), not sending active source commands", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);
       return false;
     }