1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Fix building for Android.

This commit is contained in:
Martin Ling 2013-12-05 20:24:05 +00:00
parent 397d89de3a
commit 33fd8804b8
2 changed files with 8 additions and 1 deletions

View File

@ -33,7 +33,7 @@
* TCSETX/TCGETX ioctls used with struct termiox, others do not. * 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>
#include "linux_termios.h" #include "linux_termios.h"

View File

@ -50,7 +50,9 @@
#ifdef HAVE_LIBUDEV #ifdef HAVE_LIBUDEV
#include "libudev.h" #include "libudev.h"
#endif #endif
#ifndef __ANDROID__
#include "linux/serial.h" #include "linux/serial.h"
#endif
#include "linux_termios.h" #include "linux_termios.h"
/* TCGETX/TCSETX is not available everywhere. */ /* TCGETX/TCSETX is not available everywhere. */
@ -815,7 +817,12 @@ enum sp_return sp_drain(struct sp_port *port)
#else #else
int result; int result;
while (1) { while (1) {
#ifdef __ANDROID__
int arg = 1;
result = ioctl(port->fd, TCSBRK, &arg);
#else
result = tcdrain(port->fd); result = tcdrain(port->fd);
#endif
if (result < 0) { if (result < 0) {
if (errno == EINTR) { if (errno == EINTR) {
DEBUG("tcdrain() was interrupted"); DEBUG("tcdrain() was interrupted");