cec: transmit an active source message when transmitting the physical address
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index 0ca1557e9a6f298c36486238c7b1f42b28c70cd5..be2a9bd661bc322b1645e0417fcee7180900fb10 100644 (file)
@@ -299,7 +299,11 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
   {
     CCECBusDevice *device = GetDevice(command.destination);
     if (device)
-      return device->TransmitPhysicalAddress();
+    {
+      device->SetActiveSource();
+      return device->TransmitPhysicalAddress() &&
+          device->TransmitActiveSource();
+    }
   }
 
   return false;
@@ -927,8 +931,11 @@ bool CCECCommandHandler::InitHandler(void)
 {
   if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
   {
+    CCECBusDevice *primary = m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary];
+    primary->SetPowerStatus(CEC_POWER_STATUS_ON);
+    primary->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+
     m_processor->SetActiveSource();
-    m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]->SetMenuState(CEC_MENU_STATE_ACTIVATED);
-    m_processor->m_busDevices[m_processor->GetLogicalAddresses().primary]->TransmitMenuState(m_busDevice->GetLogicalAddress());
+    primary->TransmitMenuState(m_busDevice->GetLogicalAddress());
   }
 }