cec: replace the handler directly after getting the vendor id of a device when regist...
[deb_libcec.git] / src / lib / implementations / RLCommandHandler.cpp
index c7e46823e92e13489f7d9b8ad2da0cea5c806ced..b913c322be41e4ab17fa2af264c02f6db0fe25a0 100644 (file)
@@ -41,15 +41,7 @@ using namespace PLATFORM;
 CRLCommandHandler::CRLCommandHandler(CCECBusDevice *busDevice) :
     CCECCommandHandler(busDevice)
 {
-  m_vendorId = CEC_VENDOR_PANASONIC;
-  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
-
-  /* imitate Panasonice devices */
-  if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
-  {
-    primary->SetVendorId(CEC_VENDOR_PANASONIC);
-    primary->ReplaceHandler(false);
-  }
+  m_vendorId = CEC_VENDOR_TOSHIBA;
 }
 
 bool CRLCommandHandler::InitHandler(void)
@@ -58,12 +50,21 @@ bool CRLCommandHandler::InitHandler(void)
     return true;
   m_bHandlerInited = true;
 
-  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+  if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
   {
-    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+    /* imitate Toshiba devices */
+    if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+    {
+      primary->SetVendorId(CEC_VENDOR_TOSHIBA);
+      primary->ReplaceHandler(false);
+    }
 
-    /* send the vendor id */
-    primary->TransmitVendorID(CECDEVICE_BROADCAST);
+    if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+    {
+      /* send the vendor id */
+      primary->TransmitVendorID(CECDEVICE_BROADCAST);
+    }
   }
 
   return true;