From 0cb55c432789659fefd308739ca247385157a4a6 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Mon, 19 Mar 2012 15:21:29 +0100 Subject: [PATCH] cec: mark the correct device as active source after a stream path change. if the new address is not found, but the old address is, then mark the old address as inactive. fixes TV switching back to the old active source when it scans for devices. bugzid: 592 --- src/lib/devices/CECBusDevice.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 429d73f..814f58a 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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(); -- 2.34.1