X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Flib%2Fdevices%2FCECBusDevice.cpp;h=fc85d38f6f0c89854e1addc495156babbb9ff730;hb=224ea8772f229d2d7dafcdbf64c4266c9b4de35e;hp=46e618c8ad952398b7517ae01e02a4a345daf956;hpb=5477a250b595adb296ed42a88abab002981f4761;p=deb_libcec.git diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 46e618c..fc85d38 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -1,7 +1,7 @@ /* * This file is part of the libCEC(R) library. * - * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. * libCEC(R) is an original work, containing original code. * * libCEC(R) is a trademark of Pulse-Eight Limited. @@ -37,6 +37,7 @@ #include "../implementations/SLCommandHandler.h" #include "../implementations/VLCommandHandler.h" #include "../LibCEC.h" +#include "../platform/util/timeutils.h" using namespace CEC; using namespace PLATFORM; @@ -496,7 +497,7 @@ bool CCECBusDevice::TryLogicalAddress(void) { CLibCEC::AddLog(CEC_LOG_DEBUG, "trying logical address '%s'", GetLogicalAddressName()); - m_processor->SetAckMask(0x1 << m_iLogicalAddress); + m_processor->SetAckMask(0); if (!TransmitPoll(m_iLogicalAddress)) { CLibCEC::AddLog(CEC_LOG_NOTICE, "using logical address '%s'", GetLogicalAddressName()); @@ -581,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()) @@ -833,4 +837,19 @@ bool CCECBusDevice::ActivateSource(void) return m_handler->ActivateSource(); } +void CCECBusDevice::HandlePoll(cec_logical_address iDestination) +{ + 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); + bool bReturn = m_bAwaitingReceiveFailed; + m_bAwaitingReceiveFailed = false; + return bReturn; +} + //@}