cec: init the default handler after starting up. sets the active source and menu...
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 20 Dec 2011 22:13:34 +0000 (23:13 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 20 Dec 2011 22:13:34 +0000 (23:13 +0100)
src/lib/CECProcessor.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index 96ef591443bc7d2a23267e3885e2237974a139cf..2c0f876a989bb89bcf9678ab029b50e07dfd5689 100644 (file)
@@ -157,7 +157,9 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */,
 
     if (SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true))
     {
-      SetMenuState(CEC_MENU_STATE_ACTIVATED);
+      /* init the default handler */
+      if (m_busDevices[CECDEVICE_TV]->GetHandler()->GetVendorId() == CEC_VENDOR_UNKNOWN)
+        m_busDevices[CECDEVICE_TV]->GetHandler()->InitHandler();
 
       m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
       m_busScan = new CCECBusScan(this);
index bdabcb74ea23dd99717f0893c968fcc3b0889e47..0ca1557e9a6f298c36486238c7b1f42b28c70cd5 100644 (file)
@@ -922,3 +922,13 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
 
   return false;
 }
+
+bool CCECCommandHandler::InitHandler(void)
+{
+  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  {
+    m_processor->SetActiveSource();
+    m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+    m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]->TransmitMenuState(m_busDevice->GetLogicalAddress());
+  }
+}
index c730d047a6f8020eeab14ee6c08217fc18d6b18f..5da9823a0694949429c81305a82f4bba0716ceb3 100644 (file)
@@ -52,7 +52,7 @@ namespace CEC
     virtual void HandlePoll(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool HandleReceiveFailed(void);
 
-    virtual bool InitHandler(void) { return true; }
+    virtual bool InitHandler(void);
     virtual uint8_t GetTransmitRetries(void) const { return m_iTransmitRetries; }
 
     virtual bool TransmitPowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);