From: Lars Op den Kamp Date: Wed, 21 Dec 2011 23:25:33 +0000 (+0100) Subject: cec: don't try to do anything before the processor thread has started X-Git-Tag: upstream/2.2.0~1^2~43^2~23 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=994dbaaa5c1f32810f3b4266caf5d6dd72e21718;p=deb_libcec.git cec: don't try to do anything before the processor thread has started --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 0aa8760..cc5cd40 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -149,9 +149,23 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread"); return false; } - lock.Leave(); + if (m_logicalAddresses.IsEmpty() && !FindLogicalAddresses()) + { + m_controller->AddLog(CEC_LOG_ERROR, "could not detect our logical addresses"); + StopThread(true); + return false; + } + else + { + /* only set our OSD name and active source for the primary device */ + m_busDevices[m_logicalAddresses.primary]->m_strDeviceName = m_strDeviceName; + m_busDevices[m_logicalAddresses.primary]->m_bActiveSource = true; + + SetAckMask(m_logicalAddresses.AckMask()); + } + m_busDevices[CECDEVICE_TV]->GetVendorId(); if (SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) @@ -248,21 +262,7 @@ void *CCECProcessor::Process(void) cec_command command; CCECAdapterMessage msg; - if (m_logicalAddresses.IsEmpty() && !FindLogicalAddresses()) - { - CLockObject lock(&m_mutex); - m_controller->AddLog(CEC_LOG_ERROR, "could not detect our logical addresses"); - m_startCondition.Signal(); - return NULL; - } - else { - /* only set our OSD name and active source for the primary device */ - m_busDevices[m_logicalAddresses.primary]->m_strDeviceName = m_strDeviceName; - m_busDevices[m_logicalAddresses.primary]->m_bActiveSource = true; - - SetAckMask(m_logicalAddresses.AckMask()); - CLockObject lock(&m_mutex); m_bStarted = true; m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");