cec: display a warning message if libCEC was not compiled with adapter detection...
[deb_libcec.git] / src / lib / adapter / USBCECAdapterDetection.cpp
index c2a0b5cfb47b77ff48ae942a3df55eca6aad2d60..78b2760a3b43f369759debd7ca136416ef25d280 100644 (file)
@@ -115,6 +115,15 @@ bool FindComPort(CStdString &strLocation)
 }
 #endif
 
+bool CUSBCECAdapterDetection::CanAutodetect(void)
+{
+#if defined(__APPLE__) || defined(HAVE_LIBUDEV) || defined(__WINDOWS__) || defined(__FreeBSD__)
+  return true;
+#else
+  return false;
+#endif
+}
+
 uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */)
 {
   uint8_t iFound(0);
@@ -333,12 +342,11 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i
   for (i = 0; i < 8; ++i)
   {
     (void)snprintf(devicePath, sizeof(devicePath), "/dev/ttyU%d", i);
-       if (!access(devicePath, 0))
-       {
-      snprintf(deviceList[iFound].path, sizeof(deviceList[iFound].path), "%s", devicePath);
-         snprintf(deviceList[iFound].comm, sizeof(deviceList[iFound].path), "%s", devicePath);
-         ++iFound;
-       }
+    if (!access(devicePath, 0))
+    {
+      snprintf(deviceList[iFound  ].path, sizeof(deviceList[iFound].path), "%s", devicePath);
+      snprintf(deviceList[iFound++].comm, sizeof(deviceList[iFound].path), "%s", devicePath);
+    }
   }
 #endif