Restrict IOKit usage to desktop OSX.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Thu, 26 Feb 2015 10:32:54 +0000 (11:32 +0100)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Thu, 26 Feb 2015 12:49:59 +0000 (13:49 +0100)
IOKit is a private framework in iOS, so it can't be used (and
no headers are provided, so it doesn't even compile).

support/serial.c

index 681c914f8071e5990b173e57b5f2ea6a594e5165..94d7e0b19f5d72c19bb9aa3808b17e0d22f391a8 100644 (file)
@@ -33,7 +33,8 @@
 #endif
 
 /* sys/time.h (for timeval) is required when using osx 10.3 (but not 10.4) */
-#ifdef __APPLE__
+/* IOKit is a private framework in iOS, so exclude there */
+#if defined(__APPLE__) && !defined(HOST_IOS)
 #include <sys/time.h>
 #include <IOKit/IOKitLib.h>
 #include <IOKit/serial/IOSerialKeys.h>
@@ -383,7 +384,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop
                if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, baud_rate) < 0)
                        return FALSE;
        } else {
-#if __linux__ || __APPLE__
+#if __linux__ || (defined(__APPLE__) && !defined(HOST_IOS))
 
                /* On Linux to set a custom baud rate, we must set the
                 * "standard" baud_rate to 38400.   On Apple we set it purely
@@ -416,7 +417,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop
                {
                        return FALSE;
                }
-#elif __APPLE__
+#elif defined(__APPLE__) && !defined(HOST_IOS)
                speed_t speed = baud_rate;
                if (ioctl(fd, IOSSIOSPEED, &speed) == -1)
                        return FALSE;