From f437e4bef6bb01038c97f80a404e94ca596f97be Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Thu, 10 Nov 2011 18:30:00 +0100 Subject: [PATCH] cec: only send a power on command when a device isn't on already and set the power state to CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON while powering on --- src/lib/devices/CECBusDevice.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index b5f5b58..e061619 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -107,14 +107,23 @@ void CCECBusDevice::PollVendorId(void) bool CCECBusDevice::PowerOn(void) { - CStdString strLog; - strLog.Format("<< powering on '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); - AddLog(CEC_LOG_DEBUG, strLog.c_str()); + cec_power_status current = GetPowerStatus(); + if (current != CEC_POWER_STATUS_ON && + current != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON) + { + CStdString strLog; + strLog.Format("<< powering on '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); + AddLog(CEC_LOG_DEBUG, strLog.c_str()); - cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON); + SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); - return m_processor->Transmit(command); + cec_command command; + cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON); + + return m_processor->Transmit(command); + } + + return true; } bool CCECBusDevice::Standby(void) -- 2.34.1