cec: added the firmware version to libcec_configuration (read-only). bumped server...
[deb_libcec.git] / src / lib / devices / CECBusDevice.cpp
index 845cb07d6426af2ab801fa7ba674a439c7628517..814f58a63237b9cbb00456bcd54ace9f2b0cdf88 100644 (file)
@@ -88,7 +88,7 @@ bool CCECBusDevice::HandleCommand(const cec_command &command)
     m_iLastActive = GetTimeMs();
 
     /* don't call GetStatus() here, just read the value with the mutex locked */
-    if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
+    if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC && command.opcode_set == 1)
       m_deviceStatus = CEC_DEVICE_STATUS_PRESENT;
 
     MarkBusy();
@@ -625,6 +625,20 @@ void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /*
     CLibCEC::AddLog(CEC_LOG_DEBUG, ">> %s (%X): stream path changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, iOldAddress == 0 ? m_iStreamPath : iOldAddress, iNewAddress);
     m_iStreamPath = iNewAddress;
 
+    CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iNewAddress, false);
+    if (device)
+    {
+      // if a device is found with the new physical address, mark it as active, which will automatically mark all other devices as inactive
+      device->SetActiveSource();
+    }
+    else
+    {
+      // try to find the device with the old address, and mark it as inactive when found
+      device = m_processor->GetDeviceByPhysicalAddress(iOldAddress, false);
+      if (device)
+        device->SetInactiveSource();
+    }
+
     if (iNewAddress > 0)
     {
       lock.Unlock();