]> sigrok.org Git - libserialport.git/commitdiff
Fix building for Android.
authorMartin Ling <redacted>
Thu, 5 Dec 2013 20:24:05 +0000 (20:24 +0000)
committerMartin Ling <redacted>
Thu, 5 Dec 2013 20:33:06 +0000 (20:33 +0000)
linux_termios.c
serialport.c

index 5343e6e8268f15253aa82fb2f6983b76427591f5..328c4d39b4024bc06fc218a52a69e7ac2cbd079c 100644 (file)
@@ -33,7 +33,7 @@
  * TCSETX/TCGETX ioctls used with struct termiox, others do not.
  */
 
-#ifdef __linux__
+#if defined(__linux__) && !defined(__ANDROID__)
 
 #include <linux/termios.h>
 #include "linux_termios.h"
index 497ce7fead5ecf3b1259f343f3309885ffe2fccd..45f9773bd56020dfbc9fba2453fbb0f3b3b0b73e 100644 (file)
@@ -50,7 +50,9 @@
 #ifdef HAVE_LIBUDEV
 #include "libudev.h"
 #endif
+#ifndef __ANDROID__
 #include "linux/serial.h"
+#endif
 #include "linux_termios.h"
 
 /* TCGETX/TCSETX is not available everywhere. */
@@ -815,7 +817,12 @@ enum sp_return sp_drain(struct sp_port *port)
 #else
        int result;
        while (1) {
+#ifdef __ANDROID__
+               int arg = 1;
+               result = ioctl(port->fd, TCSBRK, &arg);
+#else
                result = tcdrain(port->fd);
+#endif
                if (result < 0) {
                        if (errno == EINTR) {
                                DEBUG("tcdrain() was interrupted");