X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FSLCommandHandler.cpp;h=83fc268e6fa1b95bf1b009d8f9b0d5a66a489f30;hb=632f58103755a83b2b8cfe65c496a32d80014aa5;hp=2ed05afcf2e8b816147b1cd4dbec0accb5fe55e6;hpb=c6d7f0e195896c6ae7140c88dd03b3eaa6967105;p=deb_libcec.git 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); +}