bool CPHCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = false */) { CCECBusDevice* tv = m_processor->GetDevice(CECDEVICE_TV); if (m_busDevice->IsActiveSource() && m_busDevice->IsHandledByLibCEC() && tv && tv->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON && !bTransmitDelayedCommandsOnly) { // tv sometimes ignores image view on. check the power status of the tv in 5 seconds, and retry when it failed to power up if (m_imageViewOnCheck && !m_imageViewOnCheck->IsRunning()) m_imageViewOnCheck->CreateThread(false); } return CCECCommandHandler::ActivateSource(bTransmitDelayedCommandsOnly); }
int CSLCommandHandler::HandleGiveDevicePowerStatus(const cec_command &command) { if (m_processor->CECInitialised() && m_processor->IsHandledByLibCEC(command.destination) && command.initiator == CECDEVICE_TV) { CCECBusDevice *device = GetDevice(command.destination); if (device && device->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON) { device->TransmitPowerState(command.initiator, true); device->SetPowerStatus(CEC_POWER_STATUS_ON); } else { if (!ActiveSourceSent()) { device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); device->TransmitPowerState(command.initiator, true); ActivateSource(); } else if (m_resetPowerState.IsSet() && m_resetPowerState.TimeLeft() > 0) { /* TODO assume that we've bugged out. the return button no longer works after this */ LIB_CEC->AddLog(CEC_LOG_WARNING, "FIXME: LG seems to have bugged out. resetting to 'in transition standby to on'. the return button will not work"); { CLockObject lock(m_SLMutex); m_bActiveSourceSent = false; } device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); device->TransmitPowerState(command.initiator, true); device->SetPowerStatus(CEC_POWER_STATUS_ON); m_resetPowerState.Init(5000); } else { device->TransmitPowerState(command.initiator, true); m_resetPowerState.Init(5000); } } return COMMAND_HANDLED; } return CEC_ABORT_REASON_NOT_IN_CORRECT_MODE_TO_RESPOND; }