Initial FreeBSD support
authorFneufneu <fneufneu@xbmc.org>
Mon, 27 Feb 2012 17:07:37 +0000 (18:07 +0100)
committerFneufneu <fneufneu@xbmc.org>
Mon, 27 Feb 2012 17:07:37 +0000 (18:07 +0100)
simply try to use ttyU*

configure.ac
src/lib/adapter/USBCECAdapterDetection.cpp
src/lib/platform/posix/os-types.h
src/lib/platform/posix/serialport.cpp

index b7a4b6006d6ecc809c882e9caf27135eb9ca349c..209ecf6e070ebeb575ae9a2dc77745515f86bb73 100644 (file)
@@ -13,6 +13,9 @@ case "${host}" in
     has_libudev="no";
     LIBS+="-framework CoreVideo -framework IOKit"
     ;;
     has_libudev="no";
     LIBS+="-framework CoreVideo -framework IOKit"
     ;;
+  *-freebsd*)
+    has_libudev="no"
+    ;;
 esac
 
 if test "x$has_libudev" != "xno"; then
 esac
 
 if test "x$has_libudev" != "xno"; then
index 0d9f8b3d9c04b19738f560be47d1cb57ae43f95b..c2a0b5cfb47b77ff48ae942a3df55eca6aad2d60 100644 (file)
@@ -55,6 +55,9 @@ static GUID USB_RAW_GUID =  { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0x
 extern "C" {
 #include <libudev.h>
 }
 extern "C" {
 #include <libudev.h>
 }
+#elif defined(__FreeBSD__)
+#include <stdio.h>
+#include <unistd.h>
 #endif
 
 #define CEC_VID 0x2548
 #endif
 
 #define CEC_VID 0x2548
@@ -323,6 +326,20 @@ uint8_t CUSBCECAdapterDetection::FindAdapters(cec_adapter *deviceList, uint8_t i
 
     RegCloseKey(hDeviceKey);
   }
 
     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);
+         ++iFound;
+       }
+  }
 #endif
 
   iBufSize = 0; /* silence "unused" warning on linux/osx */
 #endif
 
   iBufSize = 0; /* silence "unused" warning on linux/osx */
index 631e96508e963a9cfb1b88184e463fc80527d837..b8783b15e76d37f6aba75a9b3c144ba9624c4038 100644 (file)
@@ -35,7 +35,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/time.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/time.h>
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <sys/prctl.h>
 #endif
 #include <pthread.h>
 #include <sys/prctl.h>
 #endif
 #include <pthread.h>
index 5557064555be90200cc2eeb7873522f6c1de9359..31ae09b1cdd2d58261f25f92acbab9f587a84be0 100644 (file)
@@ -37,7 +37,7 @@
 #include "../util/baudrate.h"
 #include "../posix/os-socket.h"
 
 #include "../util/baudrate.h"
 #include "../posix/os-socket.h"
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
 #ifndef XCASE
 #define XCASE  0
 #endif
 #ifndef XCASE
 #define XCASE  0
 #endif