Private
Public Access
2
0

uart: Fix software flow control management

Rather than updating IXON/IXOFF in termios, mraa_uart_set_flowcontrol
was incorrectly issuing a stop or start character on mode changes. This
lead to spurious transmission in setups that actually wanted to disable
software flow control. And it prevented enabling it (which could have
been checked also by reading back the state via mraa_uart_settings).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka
2021-04-30 07:57:59 +02:00
committed by Tom Ingleby
parent 833bac569c
commit aeb0b331b5

View File

@@ -616,16 +616,6 @@ mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_bo
}
}
// hardware flow control
int action = TCIOFF;
if (xonxoff) {
action = TCION;
}
if (tcflow(dev->fd, action)) {
return MRAA_ERROR_FEATURE_NOT_SUPPORTED;
}
// rtscts
struct termios termio;
// get current modes
@@ -634,6 +624,12 @@ mraa_uart_set_flowcontrol(mraa_uart_context dev, mraa_boolean_t xonxoff, mraa_bo
return MRAA_ERROR_INVALID_RESOURCE;
}
if (xonxoff) {
termio.c_iflag |= IXON|IXOFF;
} else {
termio.c_iflag &= ~(IXON|IXOFF);
}
if (rtscts) {
termio.c_cflag |= CRTSCTS;
} else {