cec: send power state 'standby->on' before 'on' for SL
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 00:43:03 +0000 (01:43 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 00:43:03 +0000 (01:43 +0100)
src/lib/adapter/USBCECAdapterCommunication.cpp
src/lib/implementations/SLCommandHandler.cpp

index 3b32ebd3b259af9b312c4922e09843f741472949..e5cedb8b03e99d07652018813b0ef180c4666fb6 100644 (file)
@@ -663,6 +663,7 @@ bool CUSBCECAdapterCommunication::ReadFromDevice(uint32_t iTimeout, size_t iSize
   if (iBytesRead < 0 || iBytesRead > 256)
   {
     CLibCEC::AddLog(CEC_LOG_ERROR, "error reading from serial port: %s", m_port->GetError().c_str());
+    StopThread(false);
     return false;
   }
   else if (iBytesRead > 0)
index e8cdf43f8e4d10128e0fc76ef6dc992b8a9755d7..3e79fd1e433511622c25ddeb6943e889492b293a 100644 (file)
@@ -229,7 +229,17 @@ void CSLCommandHandler::HandleVendorCommandPowerOn(const cec_command &command)
   {
     SetSLInitialised();
     device->SetActiveSource();
-    ActivateSource();
+    device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+    device->TransmitPowerState(command.initiator);
+
+    CEvent::Sleep(2000);
+    device->SetPowerStatus(CEC_POWER_STATUS_ON);
+    device->TransmitPowerState(command.initiator);
+    device->TransmitPhysicalAddress();
+    {
+      CLockObject lock(m_SLMutex);
+      m_bActiveSourceSent = false;
+    }
   }
 }
 void CSLCommandHandler::HandleVendorCommandPowerOnStatus(const cec_command &command)
@@ -269,11 +279,12 @@ bool CSLCommandHandler::HandleGiveDeckStatus(const cec_command &command)
     {
       if (command.parameters.size > 0)
       {
-        ((CCECPlaybackDevice *) device)->SetDeckStatus(!device->IsActiveSource() ? CEC_DECK_INFO_OTHER_STATUS : CEC_DECK_INFO_OTHER_STATUS_LG);
+        ((CCECPlaybackDevice *) device)->SetDeckStatus(!device->IsActiveSource() || !ActiveSourceSent() ? CEC_DECK_INFO_OTHER_STATUS : CEC_DECK_INFO_OTHER_STATUS_LG);
         if (command.parameters[0] == CEC_STATUS_REQUEST_ON)
         {
           bool bReturn = ((CCECPlaybackDevice *) device)->TransmitDeckStatus(command.initiator);
-          ActivateSource();
+          if (!ActiveSourceSent())
+            ActivateSource();
           return bReturn;
         }
         else if (command.parameters[0] == CEC_STATUS_REQUEST_ONCE)