cec: don't scan the whole bus in CCECProcessor::IsActiveDeviceType()
authorLars Op den Kamp <lars@opdenkamp.eu>
Fri, 25 Nov 2011 11:48:26 +0000 (12:48 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Fri, 25 Nov 2011 11:48:26 +0000 (12:48 +0100)
src/lib/CECProcessor.cpp

index 17e9fcbd1ceaa30fd831b1c4d4370b5bb2e6f318..e43d298fba3ddfac53c5639580d04be61af34daa 100644 (file)
@@ -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;
 }