From: Lars Op den Kamp Date: Tue, 20 Dec 2011 22:13:34 +0000 (+0100) Subject: cec: init the default handler after starting up. sets the active source and menu... X-Git-Tag: upstream/2.2.0~1^2~43^2~34 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=83be070122f15d5d8fa878608131ba69845fcd75;p=deb_libcec.git cec: init the default handler after starting up. sets the active source and menu state to active --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 96ef591..2c0f876 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -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); diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index bdabcb7..0ca1557 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -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()); + } +} diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index c730d04..5da9823 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -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);