Browse Source

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
c415-sdk
Daniel Magree 6 years ago committed by Lucas De Marchi
parent
commit
209bb132fa
  1. 5
      libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp

5
libraries/AP_HAL_Linux/RCInput_RCProtocol.cpp

@ -84,11 +84,12 @@ int RCInput_RCProtocol::open_115200(const char *path) @@ -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) {

Loading…
Cancel
Save