From 60383b11a744aae1352f84d1a93aef163b0a17a0 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 14 Feb 2012 01:43:03 +0100 Subject: [PATCH] cec: send power state 'standby->on' before 'on' for SL --- src/lib/adapter/USBCECAdapterCommunication.cpp | 1 + src/lib/implementations/SLCommandHandler.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/adapter/USBCECAdapterCommunication.cpp b/src/lib/adapter/USBCECAdapterCommunication.cpp index 3b32ebd..e5cedb8 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/USBCECAdapterCommunication.cpp @@ -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) diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index e8cdf43..3e79fd1 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -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) -- 2.34.1