X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Flib%2Fimplementations%2FSLCommandHandler.cpp;h=f1e3d7e229539980e1b34e9c71e74f32661c25ec;hb=6581031ae0bd36fcd4e666083115344c286b1e62;hp=1d4c8c5a70605ae75db52a019a88d21e94432b6c;hpb=5abb18f38e146cebabd9ec1b7538459f41249a58;p=deb_libcec.git diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 1d4c8c5..f1e3d7e 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -80,7 +80,7 @@ bool CSLCommandHandler::InitHandler(void) /* reply with LGs vendor id */ CCECBusDevice *primary = m_processor->GetPrimaryDevice(); if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) - primary->TransmitVendorID(CECDEVICE_TV, false); + primary->TransmitVendorID(CECDEVICE_BROADCAST, false); primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); return true; @@ -88,8 +88,11 @@ bool CSLCommandHandler::InitHandler(void) bool CSLCommandHandler::ActivateSource(void) { + if (!m_bSLEnabled) + return true; + if (m_bActiveSourceSent) - return false; + return true; m_bActiveSourceSent = true; CCECBusDevice *primary = m_processor->GetPrimaryDevice(); @@ -265,18 +268,29 @@ bool CSLCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command) bReturn = device->TransmitPowerState(command.initiator); device->SetPowerStatus(CEC_POWER_STATUS_ON); } - else if (!ActivateSource()) - { - /* assume that we've bugged out */ - CLibCEC::AddLog(CEC_LOG_NOTICE, "LG seems to have bugged out. resetting to 'in transition standby to on'"); - m_bActiveSourceSent = false; - device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); - bReturn = device->TransmitPowerState(command.initiator); - device->SetPowerStatus(CEC_POWER_STATUS_ON); - } else { - bReturn = true; + if (!m_bActiveSourceSent) + { + device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); + bReturn = device->TransmitPowerState(command.initiator); + ActivateSource(); + } + else if (m_resetPowerState.IsSet() && m_resetPowerState.TimeLeft() > 0) + { + /* assume that we've bugged out */ + CLibCEC::AddLog(CEC_LOG_NOTICE, "LG seems to have bugged out. resetting to 'in transition standby to on'"); + m_bActiveSourceSent = false; + device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); + bReturn = device->TransmitPowerState(command.initiator); + device->SetPowerStatus(CEC_POWER_STATUS_ON); + m_resetPowerState.Init(5000); + } + else + { + bReturn = device->TransmitPowerState(command.initiator); + m_resetPowerState.Init(5000); + } } } @@ -292,3 +306,30 @@ bool CSLCommandHandler::HandleRequestActiveSource(const cec_command &command) } return false; } + +bool CSLCommandHandler::HandleFeatureAbort(const cec_command &command) +{ + if (command.parameters.size == 0 && m_processor->GetPrimaryDevice()->GetPowerStatus() == CEC_POWER_STATUS_ON && !m_bSLEnabled) + { + m_processor->GetPrimaryDevice()->TransmitPowerState(command.initiator); + m_processor->GetPrimaryDevice()->TransmitVendorID(CECDEVICE_BROADCAST, false); + } + + return CCECCommandHandler::HandleFeatureAbort(command); +} + +bool CSLCommandHandler::HandleStandby(const cec_command &command) +{ + if (command.initiator == CECDEVICE_TV) + { + m_bSLEnabled = false; + m_bPowerStateReset = false; + m_bActiveSourceSent = false; + } + + CCECBusDevice *device = GetDevice(command.initiator); + if (device) + device->SetPowerStatus(CEC_POWER_STATUS_STANDBY); + + return true; +}