+ return false;
+}
+
+bool CSLCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command)
+{
+ bool bReturn(false);
+ if (m_processor->IsRunning() && m_busDevice->MyLogicalAddressContains(command.destination))
+ {
+ CCECBusDevice *device = GetDevice(command.destination);
+ if (device && device->GetPowerStatus(false) != CEC_POWER_STATUS_ON)
+ {
+ bReturn = device->TransmitPowerState(command.initiator);
+ device->SetPowerStatus(CEC_POWER_STATUS_ON);
+ }
+ else
+ {
+ 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);
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+bool CSLCommandHandler::HandleRequestActiveSource(const cec_command &command)
+{
+ if (m_processor->IsRunning())
+ {
+ CLibCEC::AddLog(CEC_LOG_DEBUG, ">> %i requests active source, ignored", (uint8_t) command.initiator);
+ return true;
+ }
+ 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);