cec: just send the vendor id in InitHandler()
[deb_libcec.git] / src / lib / implementations / SLCommandHandler.cpp
index e3259219b90141c611afb43dd1a9b9318da74eda..2ed05afcf2e8b816147b1cd4dbec0accb5fe55e6 100644 (file)
@@ -51,15 +51,17 @@ using namespace PLATFORM;
 CSLCommandHandler::CSLCommandHandler(CCECBusDevice *busDevice) :
     CCECCommandHandler(busDevice),
     m_bSLEnabled(false),
-    m_bActiveSourceSent(false),
-    m_bVendorIdSent(false)
+    m_bActiveSourceSent(false)
 {
   m_vendorId = CEC_VENDOR_LG;
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
 
   /* imitate LG devices */
   if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+  {
     primary->SetVendorId(CEC_VENDOR_LG);
+    primary->ReplaceHandler(false);
+  }
 
   /* LG TVs don't always reply to CEC version requests, so just set it to 1.3a */
   if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
@@ -84,6 +86,9 @@ bool CSLCommandHandler::InitHandler(void)
     /* start as 'in transition standby->on' */
     primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
     primary->TransmitPowerState(CECDEVICE_TV);
+
+    /* send the vendor id */
+    primary->TransmitVendorID(CECDEVICE_BROADCAST);
   }
 
   return true;
@@ -91,16 +96,6 @@ bool CSLCommandHandler::InitHandler(void)
 
 bool CSLCommandHandler::ActivateSource(void)
 {
-  /* reply with LGs vendor id */
-  bool bSendVendorId(false);
-  {
-    CLockObject lock(m_SLMutex);
-    bSendVendorId = !m_bVendorIdSent;
-    m_bVendorIdSent = true;
-  }
-  if (bSendVendorId)
-    m_processor->GetPrimaryDevice()->TransmitVendorID(CECDEVICE_BROADCAST, false);
-
   if (!SLInitialised())
   {
     CLibCEC::AddLog(CEC_LOG_NOTICE, "not activating the source until SL has been initialised");