cec: don't replace handlers when not initialised, or the primary device's logical...
[deb_libcec.git] / src / lib / devices / CECBusDevice.cpp
index 46e618c8ad952398b7517ae01e02a4a345daf956..3577518a95305bb7fa0574968d95e696841f3465 100644 (file)
@@ -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());
@@ -833,4 +834,16 @@ bool CCECBusDevice::ActivateSource(void)
   return m_handler->ActivateSource();
 }
 
+void CCECBusDevice::HandlePoll(cec_logical_address destination)
+{
+  CLockObject lock(m_handlerMutex);
+  m_handler->HandlePoll(m_iLogicalAddress, destination);
+}
+
+bool CCECBusDevice::HandleReceiveFailed(void)
+{
+  CLockObject lock(m_handlerMutex);
+  return m_handler->HandleReceiveFailed();
+}
+
 //@}