cosmetic replace tab by space
[deb_libcec.git] / src / lib / adapter / USBCECAdapterDetection.cpp
index 0d9f8b3d9c04b19738f560be47d1cb57ae43f95b..8775b4e55bbb2444c8b9a841e3e57f0e3748773f 100644 (file)
@@ -55,6 +55,9 @@ static GUID USB_RAW_GUID =  { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0x
 extern "C" {
 #include <libudev.h>
 }
+#elif defined(__FreeBSD__)
+#include <stdio.h>
+#include <unistd.h>
 #endif
 
 #define CEC_VID 0x2548
@@ -323,6 +326,19 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i
 
     RegCloseKey(hDeviceKey);
   }
+#elif defined(__FreeBSD__)
+  char devicePath[PATH_MAX + 1];
+  int 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);
+    }
+  }
 #endif
 
   iBufSize = 0; /* silence "unused" warning on linux/osx */