From 209bb132fad14d46c3eca820bf13a0e4a4338cd5 Mon Sep 17 00:00:00 2001 From: Daniel Magree Date: Wed, 28 Aug 2019 14:58:59 -0400 Subject: [PATCH] HAL_Linux: disable input modifications on serial interface for rc receiver Make sure to clear CBAUD before setting the baud and disable input modifications. Fix for #12162 This change removes input options that can modify the input data stream. INLCR: map new line to carriage return ICRNL: map carriage return to new line IUCLC: map upper case to lower case IGNCR: ignore carriage return BRKINT: send SIGINT on serial break --- libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp b/libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp index cc1f452ab6..d7dde0a82e 100644 --- a/libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp +++ b/libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp @@ -84,11 +84,12 @@ int RCInput_RCProtocol::open_115200(const char *path) return -1; } - tio.c_cflag &= ~(PARENB|CSTOPB|CSIZE); - tio.c_cflag |= CS8 | B115200; + tio.c_cflag &= ~(PARENB|CSTOPB|CSIZE|CBAUD); + tio.c_cflag |= CS8 | CREAD | CLOCAL | B115200; tio.c_lflag &= ~(ICANON|ECHO|ECHOE|ISIG); tio.c_iflag &= ~(IXON|IXOFF|IXANY); + tio.c_iflag &= ~(INLCR|ICRNL|IGNCR|IUCLC|BRKINT); tio.c_oflag &= ~OPOST; if (ioctl(fd, TCSETS2, &tio) != 0) {