cec: don't send 'image view on' to LG unless needed, or the tv will get caught in...
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 12 Feb 2012 14:04:07 +0000 (15:04 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 12 Feb 2012 14:04:07 +0000 (15:04 +0100)
src/lib/CECProcessor.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/SLCommandHandler.cpp

index 00b25a26240062035a6f53284c6301d144c36b3b..230f2ab0388f4e937b97a27f10a33f92991ee16b 100644 (file)
@@ -461,7 +461,8 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE
   m_busDevices[addr]->SetActiveSource();
   if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF)
   {
-    bReturn = m_busDevices[addr]->TransmitActiveSource();
+    bReturn = m_busDevices[addr]->TransmitImageViewOn() &&
+        m_busDevices[addr]->TransmitActiveSource();
 
     if (bReturn)
     {
index 0fc486f220fd9244ef14c5672bb1fcf8f166e111..87954228bda9fe6e514b75628f55697a53612731 100644 (file)
@@ -683,7 +683,7 @@ bool CCECBusDevice::TransmitActiveSource(void)
 
   {
     CLockObject lock(m_mutex);
-    if (m_powerStatus != CEC_POWER_STATUS_ON)
+    if (m_powerStatus != CEC_POWER_STATUS_ON && m_powerStatus != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON)
       CLibCEC::AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress);
     else if (m_bActiveSource)
     {
@@ -697,7 +697,6 @@ bool CCECBusDevice::TransmitActiveSource(void)
   if (bSendActiveSource)
   {
     MarkBusy();
-    m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
     m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress);
     MarkReady();
     return true;
@@ -721,6 +720,23 @@ bool CCECBusDevice::TransmitCECVersion(cec_logical_address dest)
   return bReturn;
 }
 
+bool CCECBusDevice::TransmitImageViewOn(void)
+{
+  CLockObject lock(m_mutex);
+  if (m_powerStatus != CEC_POWER_STATUS_ON && m_powerStatus != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON)
+  {
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress);
+    return false;
+  }
+  else
+  {
+    MarkBusy();
+    m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
+    MarkReady();
+    return true;
+  }
+}
+
 bool CCECBusDevice::TransmitInactiveSource(void)
 {
   uint16_t iPhysicalAddress;
index 3de307d9d1381ba3a538d4136cd06450d50c57b2..16b6e089b60a6fd6ebbeafd1da2f4510b72f9b55 100644 (file)
@@ -96,6 +96,7 @@ namespace CEC
 
     virtual bool TransmitActiveSource(void);
     virtual bool TransmitCECVersion(cec_logical_address dest);
+    virtual bool TransmitImageViewOn(void);
     virtual bool TransmitInactiveSource(void);
     virtual bool TransmitMenuState(cec_logical_address dest);
     virtual bool TransmitOSDName(cec_logical_address dest);
index b8dd25f2df51f1bd51292439c7f059977c9e34fc..561819f3f47d77401c5c00b6fea3f172eafb13e8 100644 (file)
@@ -339,6 +339,7 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
     {
       device->SetActiveSource();
       return device->TransmitPhysicalAddress() &&
+          device->TransmitImageViewOn() &&
           device->TransmitActiveSource();
     }
   }
@@ -506,6 +507,7 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command)
     if (device && m_busDevice->MyLogicalAddressContains(device->GetLogicalAddress()))
     {
       device->SetActiveSource();
+      device->TransmitImageViewOn();
       device->TransmitActiveSource();
 
       device->SetMenuState(CEC_MENU_STATE_ACTIVATED);
@@ -605,6 +607,7 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
           if (device->MyLogicalAddressContains(device->GetLogicalAddress()))
           {
             device->SetActiveSource();
+            device->TransmitImageViewOn();
             device->TransmitActiveSource();
 
             if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
index 2475e14ae28c786b8648f8288cd3b778f44eeca1..0de151d6234221e12ced9d240da32e7b06460580 100644 (file)
@@ -89,6 +89,7 @@ bool CSLCommandHandler::ActivateSource(void)
 {
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
   primary->SetActiveSource();
+  primary->TransmitImageViewOn();
   primary->TransmitActiveSource();
   return true;
 }
@@ -219,7 +220,6 @@ void CSLCommandHandler::HandleVendorCommandSLConnect(const cec_command &command)
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
 
   primary->SetActiveSource();
-  TransmitImageViewOn(primary->GetLogicalAddress(), command.initiator);
   TransmitVendorCommand05(primary->GetLogicalAddress(), command.initiator);
 }