From: Lars Op den Kamp Date: Sun, 4 Dec 2011 19:05:03 +0000 (+0100) Subject: cec: send the physical address only once. keep a write lock when polling devices X-Git-Tag: upstream/2.2.0~1^2~44^2~44 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2bdfdeefe29b5d897135f5d3d4adc86721334c73;p=deb_libcec.git cec: send the physical address only once. keep a write lock when polling devices --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 52f0c20..340602c 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -730,6 +730,10 @@ bool CCECBusDevice::TransmitOSDString(cec_logical_address dest, cec_display_cont bool CCECBusDevice::TransmitPhysicalAddress(void) { CLockObject lock(&m_writeMutex); + + if (m_iPhysicalAddress = 0xffff) + return false; + CStdString strLog; strLog.Format("<< %s (%X) -> broadcast (F): physical adddress %4x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress); AddLog(CEC_LOG_NOTICE, strLog.c_str()); @@ -750,6 +754,8 @@ bool CCECBusDevice::TransmitPoll(cec_logical_address dest) if (dest == CECDEVICE_UNKNOWN) dest = m_iLogicalAddress; + CLockObject lock(&m_writeMutex); + CStdString strLog; strLog.Format("<< %s (%X) -> %s (%X): POLL", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest); AddLog(CEC_LOG_NOTICE, strLog.c_str()); @@ -764,12 +770,8 @@ bool CCECBusDevice::TransmitPoll(cec_logical_address dest) } AddLog(CEC_LOG_DEBUG, bReturn ? ">> POLL sent" : ">> POLL not sent"); - if (bReturn) - { - CLockObject lock(&m_writeMutex); m_iLastActive = GetTimeMs(); - } return bReturn; }