X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=fc85d38f6f0c89854e1addc495156babbb9ff730;hb=224ea8772f229d2d7dafcdbf64c4266c9b4de35e;hp=3577518a95305bb7fa0574968d95e696841f3465;hpb=0cfdeb5a137651058e393d70c18523f77c10b5a6;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 3577518..fc85d38 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -582,7 +582,10 @@ void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus) bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */) { - CLockObject lock(m_mutex); + CTryLockObject lock(m_mutex); + if (!lock.IsLocked()) + return false; + CLockObject handlerLock(m_handlerMutex); if (m_vendor != m_handler->GetVendorId()) @@ -834,16 +837,19 @@ bool CCECBusDevice::ActivateSource(void) return m_handler->ActivateSource(); } -void CCECBusDevice::HandlePoll(cec_logical_address destination) +void CCECBusDevice::HandlePoll(cec_logical_address iDestination) { - CLockObject lock(m_handlerMutex); - m_handler->HandlePoll(m_iLogicalAddress, destination); + CLockObject lock(m_mutex); + CLibCEC::AddLog(CEC_LOG_DEBUG, "<< POLL: %s (%x) -> %s (%x)", ToString(m_iLogicalAddress), m_iLogicalAddress, ToString(iDestination), iDestination); + m_bAwaitingReceiveFailed = true; } bool CCECBusDevice::HandleReceiveFailed(void) { CLockObject lock(m_handlerMutex); - return m_handler->HandleReceiveFailed(); + bool bReturn = m_bAwaitingReceiveFailed; + m_bAwaitingReceiveFailed = false; + return bReturn; } //@}