From 33fd8804b8a81da4cc3ffcf43ded2288381aad49 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Thu, 5 Dec 2013 20:24:05 +0000 Subject: [PATCH] Fix building for Android. --- linux_termios.c | 2 +- serialport.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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");