From: Lars Op den Kamp Date: Mon, 13 Feb 2012 17:07:24 +0000 (+0100) Subject: cec: implemented power up for LG devices other than a TV X-Git-Tag: upstream/2.2.0~1^2~35^2~72 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=632f58103755a83b2b8cfe65c496a32d80014aa5;p=deb_libcec.git cec: implemented power up for LG devices other than a TV --- diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index ad65063..14e39fc 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -56,6 +56,7 @@ namespace CEC virtual bool ActivateSource(void); virtual uint8_t GetTransmitRetries(void) const { return m_iTransmitRetries; } + virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) { return TransmitImageViewOn(iInitiator, iDestination); } virtual bool TransmitImageViewOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); virtual bool TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination); virtual bool TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination); diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 2ed05af..83fc268 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -80,9 +80,10 @@ bool CSLCommandHandler::InitHandler(void) return true; m_bHandlerInited = true; - CCECBusDevice *primary = m_processor->GetPrimaryDevice(); - if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) + if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) { + CCECBusDevice *primary = m_processor->GetPrimaryDevice(); + /* start as 'in transition standby->on' */ primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); primary->TransmitPowerState(CECDEVICE_TV); @@ -134,7 +135,7 @@ bool CSLCommandHandler::HandleDeviceVendorId(const cec_command &command) { SetVendorId(command); - if (!SLInitialised()) + if (!SLInitialised() && command.initiator == CECDEVICE_TV) { cec_command response; cec_command::Format(response, m_processor->GetLogicalAddress(), command.initiator, CEC_OPCODE_FEATURE_ABORT); @@ -203,6 +204,9 @@ void CSLCommandHandler::TransmitVendorCommand0205(const cec_logical_address iSou void CSLCommandHandler::HandleVendorCommandPowerOn(const cec_command &command) { + if (command.initiator != CECDEVICE_TV) + return; + CCECBusDevice *device = m_processor->GetPrimaryDevice(); if (device) { @@ -276,7 +280,7 @@ bool CSLCommandHandler::HandleGiveDeckStatus(const cec_command &command) bool CSLCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command) { bool bReturn(false); - if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination)) + if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination) && command.initiator == CECDEVICE_TV) { CCECBusDevice *device = GetDevice(command.destination); if (device && device->GetPowerStatus(false) != CEC_POWER_STATUS_ON) @@ -328,7 +332,8 @@ bool CSLCommandHandler::HandleRequestActiveSource(const cec_command &command) bool CSLCommandHandler::HandleFeatureAbort(const cec_command &command) { - if (command.parameters.size == 0 && m_processor->GetPrimaryDevice()->GetPowerStatus() == CEC_POWER_STATUS_ON && !SLInitialised()) + if (command.parameters.size == 0 && m_processor->GetPrimaryDevice()->GetPowerStatus() == CEC_POWER_STATUS_ON && !SLInitialised() && + command.initiator == CECDEVICE_TV) { m_processor->GetPrimaryDevice()->TransmitPowerState(command.initiator); m_processor->GetPrimaryDevice()->TransmitVendorID(CECDEVICE_BROADCAST, false); @@ -372,3 +377,17 @@ bool CSLCommandHandler::ActiveSourceSent(void) CLockObject lock(m_SLMutex); return m_bActiveSourceSent; } + +bool CSLCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) +{ + if (iDestination != CECDEVICE_TV) + { + cec_command command; + cec_command::Format(command, CECDEVICE_TV, iDestination, CEC_OPCODE_VENDOR_COMMAND); + command.PushBack(SL_COMMAND_POWER_ON); + command.PushBack(0); + return Transmit(command); + } + + return CCECCommandHandler::PowerOn(iInitiator, iDestination); +} diff --git a/src/lib/implementations/SLCommandHandler.h b/src/lib/implementations/SLCommandHandler.h index 4ea6a05..a0ea25a 100644 --- a/src/lib/implementations/SLCommandHandler.h +++ b/src/lib/implementations/SLCommandHandler.h @@ -66,6 +66,7 @@ namespace CEC virtual bool HandleFeatureAbort(const cec_command &command); virtual bool HandleStandby(const cec_command &command); virtual bool TransmitMenuState(const cec_logical_address UNUSED(iInitiator), const cec_logical_address UNUSED(iDestination), cec_menu_state UNUSED(menuState)) { return true; } + virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); virtual void ResetSLState(void); virtual bool SLInitialised(void);