]> sigrok.org Git - libserialport.git/blobdiff - serialport.c
android: Fix build compatibility with NDK platform 21 and up.
[libserialport.git] / serialport.c
index 9e56e89aed61c1347bef3b08f867ff2344f7772e..c233b28564c799b66cd3e903cd92dd45a9ea6ded 100644 (file)
@@ -742,7 +742,9 @@ SP_API enum sp_return sp_drain(struct sp_port *port)
 #else
        int result;
        while (1) {
-#ifdef __ANDROID__
+#if defined(__ANDROID__) && (__ANDROID_API__ < 21)
+               /* Android only has tcdrain from platform 21 onwards.
+                * On previous API versions, use the ioctl directly. */
                int arg = 1;
                result = ioctl(port->fd, TCSBRK, &arg);
 #else