cec: TransmitImageViewOn() and TransmitActiveSource() always returned true, even...
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 10 Jun 2012 09:40:37 +0000 (11:40 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 10 Jun 2012 09:40:37 +0000 (11:40 +0200)
src/lib/CECProcessor.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/implementations/CECCommandHandler.cpp

index 034c7e660c56de66d1702781d5f636b3716a71fe..ca323fc4b67851fd3f26a58ff5b3998595b5bc56 100644 (file)
@@ -51,7 +51,7 @@ using namespace std;
 using namespace PLATFORM;
 
 #define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
-#define ACTIVE_SOURCE_CHECK_TIMEOUT    10000
+#define ACTIVE_SOURCE_CHECK_TIMEOUT    15000
 
 #define ToString(x) CCECTypeUtils::ToString(x)
 
index 6fd077050038c492f2df72cba371f5edd43dab66..8f966a233194dd748e76a1a43c1b85263ca1a225 100644 (file)
@@ -952,15 +952,15 @@ bool CCECBusDevice::TransmitActiveSource(void)
       LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not the active source", GetLogicalAddressName(), m_iLogicalAddress);
   }
 
+  bool bActiveSourceSent(false);
   if (bSendActiveSource)
   {
     MarkBusy();
-    m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress);
+    bActiveSourceSent = m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress);
     MarkReady();
-    return true;
   }
 
-  return false;
+  return bActiveSourceSent;
 }
 
 bool CCECBusDevice::TransmitImageViewOn(void)
@@ -974,10 +974,11 @@ bool CCECBusDevice::TransmitImageViewOn(void)
     }
   }
 
+  bool bImageViewOnSent(false);
   MarkBusy();
-  m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
+  bImageViewOnSent = m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
   MarkReady();
-  return true;
+  return bImageViewOnSent;
 }
 
 bool CCECBusDevice::TransmitInactiveSource(void)
index 77b94a49f0d27241ff27e49f760a6d477fdea4d3..a240c9086739cc343e3e25354c5750d7acaedbfd 100644 (file)
@@ -1069,19 +1069,25 @@ bool CCECCommandHandler::ActivateSource(void)
     m_busDevice->SetPowerStatus(CEC_POWER_STATUS_ON);
     m_busDevice->SetMenuState(CEC_MENU_STATE_ACTIVATED);
 
-    if (!m_busDevice->TransmitImageViewOn() ||
-        !m_busDevice->TransmitActiveSource() ||
-        !m_busDevice->TransmitMenuState(CECDEVICE_TV))
+    bool bActiveSourceFailed = !m_busDevice->TransmitImageViewOn() ||
+                               !m_busDevice->TransmitActiveSource() ||
+                               !m_busDevice->TransmitMenuState(CECDEVICE_TV);
+
+    if (!bActiveSourceFailed)
     {
+      CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
+      if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
+        bActiveSourceFailed = !playbackDevice->TransmitDeckStatus(CECDEVICE_TV);
+    }
+
+    if (bActiveSourceFailed)
+    {
+      LIB_CEC->AddLog(CEC_LOG_DEBUG, "failed to make '%s' the active source. will retry later", m_busDevice->GetLogicalAddressName());
       CLockObject lock(m_mutex);
       m_bActiveSourcePending = true;
       return false;
     }
 
-    CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
-    if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
-      playbackDevice->TransmitDeckStatus(CECDEVICE_TV);
-
     m_bHandlerInited = true;
   }
   return true;