From 56035c8658776a144f63cdfd35ae32d93aacc987 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Wed, 7 Dec 2011 23:32:48 +0100 Subject: [PATCH] cec: set the proper ackmask before doing anything else. set the LG vendor ID after switching the command handler --- src/lib/CECProcessor.cpp | 17 +++++++++-------- src/lib/implementations/SLCommandHandler.cpp | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index b07f2dd..94651fc 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -152,8 +152,10 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, } lock.Leave(); - if (SetAckMask(m_logicalAddresses.AckMask()) && - SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) + + m_busDevices[CECDEVICE_TV]->GetVendorId(); + + if (SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) { m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started"); m_busScan = new CCECBusScan(this); @@ -260,8 +262,7 @@ void *CCECProcessor::Process(void) } else { - m_busDevices[CECDEVICE_TV]->GetVendorId(); - m_busDevices[m_logicalAddresses.primary]->TransmitVendorID(CECDEVICE_TV, false); + SetAckMask(m_logicalAddresses.AckMask()); CLockObject lock(&m_mutex); m_bStarted = true; @@ -395,15 +396,15 @@ bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, { bool bReturn(false); - CStdString strLog; - strLog.Format("setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice); - AddLog(CEC_LOG_DEBUG, strLog); - m_iBaseDevice = iBaseDevice; m_iHDMIPort = iPort; if (!m_bStarted && !bForce) return true; + CStdString strLog; + strLog.Format("setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice); + AddLog(CEC_LOG_DEBUG, strLog); + uint16_t iPhysicalAddress(0); iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress(); uint16_t iPos = 0; diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 713eebb..809558b 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -256,7 +256,10 @@ bool CSLCommandHandler::InitHandler(void) CCECBusDevice *primary = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]; if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) + { primary->SetVendorId(CEC_VENDOR_LG, false); + primary->TransmitVendorID(CECDEVICE_TV, false); + } if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) { -- 2.34.1