From: Lars Op den Kamp Date: Tue, 29 Nov 2011 00:55:09 +0000 (+0100) Subject: cec: make sure that a device is really powered on X-Git-Tag: upstream/2.2.0~1^2~44^2~77 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9bc8934c6dac8efcd2f636b6f68798049f84deac;p=deb_libcec.git cec: make sure that a device is really powered on --- diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 439fc05..7fe92a4 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -99,7 +99,16 @@ bool CCECBusDevice::PowerOn(void) cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON); if (m_processor->Transmit(command)) { - RequestPowerStatus(); + { + CLockObject lock(&m_mutex); + m_powerStatus = CEC_POWER_STATUS_UNKNOWN; + } + cec_power_status status = GetPowerStatus(); + if (status == CEC_POWER_STATUS_STANDBY || status == CEC_POWER_STATUS_UNKNOWN) + { + SendKeypress(CEC_USER_CONTROL_CODE_POWER, true); + return SendKeyRelease(false); + } return true; }