From: Lars Op den Kamp Date: Mon, 19 Mar 2012 14:21:29 +0000 (+0100) Subject: cec: mark the correct device as active source after a stream path change. if the... X-Git-Tag: upstream/2.2.0~1^2~31^2~64 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0cb55c432789659fefd308739ca247385157a4a6;p=deb_libcec.git 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 --- 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();