fixed - don't keep trying to send 'image view on' commands to the TV when no TV is...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 11 Oct 2012 10:41:26 +0000 (12:41 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 11 Oct 2012 10:53:46 +0000 (12:53 +0200)
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/VLCommandHandler.cpp

index 269cbde0d183fbdef4411fa4cc1f975c05869337..796f7aba72b6d9aa63737542ba61f674b3d7b483 100644 (file)
@@ -1121,7 +1121,13 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
     VendorPreActivateSourceHook();
 
     // power on the TV
-    bool bActiveSourceFailed = !m_busDevice->TransmitImageViewOn();
+    CCECBusDevice* tv = m_processor->GetDevice(CECDEVICE_TV);
+    bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT);
+    bool bActiveSourceFailed(false);
+    if (bTvPresent)
+      bActiveSourceFailed = !m_busDevice->TransmitImageViewOn();
+    else
+      LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'");
 
     // check if we're allowed to switch sources
     bool bSourceSwitchAllowed = SourceSwitchAllowed();
@@ -1131,11 +1137,12 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
     // switch sources (if allowed)
     if (!bActiveSourceFailed && bSourceSwitchAllowed)
     {
-      bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false) ||
-                            !m_busDevice->TransmitMenuState(CECDEVICE_TV, false);
+      bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false);
+      if (bTvPresent && !bActiveSourceFailed)
+        bActiveSourceFailed = !m_busDevice->TransmitMenuState(CECDEVICE_TV, false);
 
       // update the deck status for playback devices
-      if (!bActiveSourceFailed)
+      if (bTvPresent && !bActiveSourceFailed)
       {
         CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
         if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
index 227d8a0aa3b67e25ebe4ec8f71a4f51c85a22d1a..00e062bc8c3920096dbf6abca8a1dfd424058797 100644 (file)
@@ -162,8 +162,11 @@ bool CVLCommandHandler::PowerUpEventReceived(void)
 
   if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV)
   {
+    CCECBusDevice* tv = m_processor->GetTV();
+    if (tv && tv->GetStatus() != CEC_DEVICE_STATUS_PRESENT)
+      return true;
+
     // get the status from the TV
-    CCECBusDevice *tv = m_processor->GetTV();
     if (tv && tv->GetCurrentVendorId() == CEC_VENDOR_PANASONIC)
     {
       CVLCommandHandler *handler = static_cast<CVLCommandHandler *>(tv->GetHandler());