From: Lars Op den Kamp Date: Fri, 25 Nov 2011 11:48:26 +0000 (+0100) Subject: cec: don't scan the whole bus in CCECProcessor::IsActiveDeviceType() X-Git-Tag: upstream/2.2.0~1^2~44^2~98 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;ds=inline;h=2813bd07868a69271858aaa5ddda786d8488fffc;p=deb_libcec.git cec: don't scan the whole bus in CCECProcessor::IsActiveDeviceType() --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 17e9fcb..e43d298 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -668,10 +668,12 @@ bool CCECProcessor::IsActiveDevice(cec_logical_address address) bool CCECProcessor::IsActiveDeviceType(cec_device_type type) { - cec_logical_addresses activeDevices = GetActiveDevices(); for (unsigned int iPtr = 0; iPtr < 15; iPtr++) - if (activeDevices.IsSet((cec_logical_address) iPtr) && m_busDevices[iPtr]->GetType() == type) + { + if (m_busDevices[iPtr]->GetType() == type && m_busDevices[iPtr]->GetStatus() == CEC_DEVICE_STATUS_PRESENT) return true; + } + return false; }