From: Lars Op den Kamp Date: Thu, 10 Nov 2011 17:30:00 +0000 (+0100) Subject: cec: set the power status to 'on' when receiving CEC_USER_CONTROL_CODE_POWER X-Git-Tag: upstream/2.2.0~1^2~72 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=68391d4f314948ec3f808765593b6d60394132ec;p=deb_libcec.git cec: set the power status to 'on' when receiving CEC_USER_CONTROL_CODE_POWER --- diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 2db0c72..c37f7a2 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -386,9 +386,17 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command) if (command.parameters[0] <= CEC_USER_CONTROL_CODE_MAX) { CStdString strLog; - strLog.Format("key pressed: %1x", command.parameters[0]); + strLog.Format("key pressed: %x", command.parameters[0]); m_busDevice->AddLog(CEC_LOG_DEBUG, strLog.c_str()); + if (command.parameters[0] == CEC_USER_CONTROL_CODE_POWER || + command.parameters[0] == CEC_USER_CONTROL_CODE_POWER_ON_FUNCTION) + { + CCECBusDevice *device = GetDevice(command.destination); + if (device) + device->SetPowerStatus(CEC_POWER_STATUS_ON); + } + m_busDevice->GetProcessor()->SetCurrentButton((cec_user_control_code) command.parameters[0]); } }