added bQuickScan param to DetectDevices(), so we don't try to open a connection each...
[deb_libcec.git] / src / lib / LibCEC.cpp
index c04283d1871a7e8b76b34767b9211e32ac95fb5f..c24b4ed96e7d2ffcd8cb93fdbc7051d3325a0d30 100644 (file)
@@ -560,17 +560,20 @@ uint8_t CLibCEC::AudioStatus(void)
   return m_client ? m_client->AudioStatus() : (uint8_t)CEC_AUDIO_VOLUME_STATUS_UNKNOWN;
 }
 
-int8_t CLibCEC::DetectAdapters(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */)
+int8_t CLibCEC::DetectAdapters(cec_adapter_descriptor *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */, bool bQuickScan /* = false */)
 {
   int8_t iAdaptersFound = CAdapterFactory(this).DetectAdapters(deviceList, iBufSize, strDevicePath);
-  for (int8_t iPtr = 0; iPtr < iAdaptersFound; iPtr++)
+  if (!bQuickScan)
   {
-    libcec_configuration config;
-    GetDeviceInformation(deviceList[iPtr].strComName, &config);
-    deviceList[iPtr].iFirmwareVersion   = config.iFirmwareVersion;
-    deviceList[iPtr].iPhysicalAddress   = config.iPhysicalAddress;
-    deviceList[iPtr].iFirmwareBuildDate = config.iFirmwareBuildDate;
-    deviceList[iPtr].adapterType        = config.adapterType;
+    for (int8_t iPtr = 0; iPtr < iAdaptersFound; iPtr++)
+    {
+      libcec_configuration config;
+      GetDeviceInformation(deviceList[iPtr].strComName, &config);
+      deviceList[iPtr].iFirmwareVersion   = config.iFirmwareVersion;
+      deviceList[iPtr].iPhysicalAddress   = config.iPhysicalAddress;
+      deviceList[iPtr].iFirmwareBuildDate = config.iFirmwareBuildDate;
+      deviceList[iPtr].adapterType        = config.adapterType;
+    }
   }
   return iAdaptersFound;
 }