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");