cec: set the power status to 'on' when receiving CEC_USER_CONTROL_CODE_POWER
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 17:30:00 +0000 (18:30 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 10 Nov 2011 18:00:38 +0000 (19:00 +0100)
src/lib/implementations/CECCommandHandler.cpp

index 2db0c7232ba96301919baa8a675885753562ad77..c37f7a2343ffcba1e2b832a9d8a02478d0b5cae8 100644 (file)
@@ -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]);
     }
   }