From: Martin Ling Date: Thu, 5 Dec 2013 20:24:05 +0000 (+0000) Subject: Fix building for Android. X-Git-Tag: libserialport-0.1.0~28 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=33fd8804b8a81da4cc3ffcf43ded2288381aad49;p=libserialport.git Fix building for Android. --- diff --git a/linux_termios.c b/linux_termios.c index 5343e6e..328c4d3 100644 --- a/linux_termios.c +++ b/linux_termios.c @@ -33,7 +33,7 @@ * TCSETX/TCGETX ioctls used with struct termiox, others do not. */ -#ifdef __linux__ +#if defined(__linux__) && !defined(__ANDROID__) #include #include "linux_termios.h" diff --git a/serialport.c b/serialport.c index 497ce7f..45f9773 100644 --- a/serialport.c +++ b/serialport.c @@ -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");