changeset 229:8afb91f7282c me-8.2

8135280: [UART] Invalid data is read from loopback RPi ttyAMA0 device Summary: UART is reset by cfmakeraw() at open() Reviewed-by: alkonsta
author snazarki
date Wed, 09 Sep 2015 22:25:40 +0300
parents 419a9dee7d0f
children f30bd71ed3b0
files src/share/linux/native/com/oracle/dio/uart/serial.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/linux/native/com/oracle/dio/uart/serial.c	Thu Aug 20 19:34:57 2015 +0300
+++ b/src/share/linux/native/com/oracle/dio/uart/serial.c	Wed Sep 09 22:25:40 2015 +0300
@@ -478,7 +478,7 @@
         JAVACALL_REPORT_ERROR(JC_SERIAL, "[UART] tcgetattr failed");
         return JAVACALL_FAIL;
     }
-    cfmakeraw(&term);
+
     if (options & JAVACALL_SERIAL_STOP_BITS_2) {
         term.c_cflag |= CSTOPB;
     } else {
@@ -896,6 +896,14 @@
             return JAVACALL_FAIL;
         }
     }
+    {
+        // reset device to default "raw" mode
+        struct termios term;
+        tcgetattr(p->fd, &term);
+        cfmakeraw(&term);
+        tcsetattr(p->fd, TCSANOW, &term);
+    }
+
     return JAVACALL_OK;
 }