cec: set the power state to 'powered on' by default
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index b43d2b0ed87262f9723ad1b349319f07f7b910a1..5a3de0b690c7d4015a2b27144e69c6ab69d7ef46 100644 (file)
@@ -577,7 +577,10 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
           }
         }
       }
-      m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
+      else
+      {
+        m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
+      }
       return true;
     }
   }
@@ -919,3 +922,16 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
 
   return false;
 }
+
+bool CCECCommandHandler::InitHandler(void)
+{
+  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  {
+    CCECBusDevice *primary = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary];
+    primary->SetPowerStatus(CEC_POWER_STATUS_ON);
+    primary->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+
+    m_processor->SetActiveSource();
+    primary->TransmitMenuState(m_busDevice->GetLogicalAddress());
+  }
+}