cec: and more LG hacks
[deb_libcec.git] / src / lib / CECProcessor.cpp
index 84b9bafcbc451ba5e4881cd80f2e66107d5234bd..4df840d02f48e261cac71d371cdfcda8c9b123d4 100644 (file)
@@ -268,7 +268,9 @@ void *CCECProcessor::Process(void)
   }
   else
   {
-    m_busDevices[m_logicalAddresses.primary]->TransmitPhysicalAddress();
+    m_busDevices[CECDEVICE_TV]->GetVendorId();
+    m_busDevices[m_logicalAddresses.primary]->TransmitVendorID(CECDEVICE_TV, false);
+
     CLockObject lock(&m_mutex);
     m_bStarted = true;
     m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
@@ -329,8 +331,7 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE
     }
   }
 
-  bReturn = m_busDevices[CECDEVICE_TV]->PowerOn() &&
-      m_busDevices[addr]->TransmitActiveSource() &&
+  bReturn = m_busDevices[addr]->TransmitActiveSource() &&
       SetStreamPath(m_busDevices[addr]->GetPhysicalAddress(false));
 
   if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE ||
@@ -354,11 +355,6 @@ void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout)
   m_iRetryLineTimeout = iTimeout;
 }
 
-bool CCECProcessor::SetActiveSource(cec_logical_address iAddress)
-{
-  return SetStreamPath(m_busDevices[iAddress]->GetPhysicalAddress(false));
-}
-
 bool CCECProcessor::SetActiveView(void)
 {
   return SetActiveSource(m_types.IsEmpty() ? CEC_DEVICE_TYPE_RESERVED : m_types[0]);
@@ -525,7 +521,10 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
   {
     for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
       if (m_logicalAddresses[iPtr])
+      {
         m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
+        m_busDevices[iPtr]->TransmitPhysicalAddress();
+      }
     return SetActiveView();
   }
   return false;
@@ -541,7 +540,7 @@ bool CCECProcessor::SwitchMonitoring(bool bEnable)
     CLockObject lock(&m_mutex);
     m_bMonitor = bEnable;
 
-    if (bEnable)
+    if (!bEnable)
     {
       if (!m_busScan)
       {
@@ -1298,9 +1297,15 @@ const char *CCECProcessor::ToString(const cec_vendor_id vendor)
 void *CCECBusScan::Process(void)
 {
   CCECBusDevice *device(NULL);
+  uint8_t iCounter(0);
 
   while (!IsStopped())
   {
+    if (++iCounter < 30)
+    {
+      Sleep(1000);
+      continue;
+    }
     for (unsigned int iPtr = 0; iPtr <= 11 && !IsStopped(); iPtr++)
     {
       device = m_processor->m_busDevices[iPtr];