From: Lars Op den Kamp Date: Fri, 22 Jun 2012 10:28:34 +0000 (+0200) Subject: cec: fixed - set the physical address of each device controlled by a CCECClient if... X-Git-Tag: upstream/2.2.0~1^2~22^2^2~19 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b1d821c6982cf67b68fe1ee00e58af33a75d5b3b;p=deb_libcec.git cec: fixed - set the physical address of each device controlled by a CCECClient if it's valid --- diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index 008831b..2f3dabb 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -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); diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 1975421..324c558 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -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()); diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 47bd53a..88d6b46 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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; }