cec: send LG's vendor id to broadcast, not the tv
[deb_libcec.git] / src / lib / implementations / SLCommandHandler.cpp
index 1d4c8c5a70605ae75db52a019a88d21e94432b6c..5a76d286749cd4f19e2068e17ab75cab023a2c01 100644 (file)
@@ -80,7 +80,7 @@ bool CSLCommandHandler::InitHandler(void)
   /* reply with LGs vendor id */
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
   if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
-    primary->TransmitVendorID(CECDEVICE_TV, false);
+    primary->TransmitVendorID(CECDEVICE_BROADCAST, false);
 
   primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
   return true;
@@ -292,3 +292,30 @@ bool CSLCommandHandler::HandleRequestActiveSource(const cec_command &command)
   }
   return false;
 }
+
+bool CSLCommandHandler::HandleFeatureAbort(const cec_command &command)
+{
+  if (command.parameters.size == 0 && m_processor->GetPrimaryDevice()->GetPowerStatus() == CEC_POWER_STATUS_ON && !m_bSLEnabled)
+  {
+    m_processor->GetPrimaryDevice()->TransmitPowerState(command.initiator);
+    m_processor->GetPrimaryDevice()->TransmitVendorID(CECDEVICE_BROADCAST, false);
+  }
+
+  return CCECCommandHandler::HandleFeatureAbort(command);
+}
+
+bool CSLCommandHandler::HandleStandby(const cec_command &command)
+{
+  if (command.initiator == CECDEVICE_TV)
+  {
+    m_bSLEnabled = false;
+    m_bPowerStateReset = false;
+    m_bActiveSourceSent = false;
+  }
+
+  CCECBusDevice *device = GetDevice(command.initiator);
+  if (device)
+    device->SetPowerStatus(CEC_POWER_STATUS_STANDBY);
+
+  return true;
+}