From: Lars Op den Kamp Date: Tue, 14 Feb 2012 00:43:03 +0000 (+0100) Subject: cec: send power state 'standby->on' before 'on' for SL X-Git-Tag: upstream/2.2.0~1^2~35^2~65 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=60383b11a744aae1352f84d1a93aef163b0a17a0;p=deb_libcec.git cec: send power state 'standby->on' before 'on' for SL --- 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)