From d3e73d457e74feb381f5984f060595a2a60e835d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 21 Dec 2013 21:59:31 +0100 Subject: [PATCH] Use POSIX API to set serial port speed. POSIX says CBAUD is reserved, and provides an easier way to set the speed using a dedicated function. --- src/kits/device/SerialPort.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/device/SerialPort.cpp b/src/kits/device/SerialPort.cpp index 97c88748a2..a4255569de 100644 --- a/src/kits/device/SerialPort.cpp +++ b/src/kits/device/SerialPort.cpp @@ -562,7 +562,7 @@ BSerialPort::_DriverControl() // Reset all flags options.c_iflag &= ~(IXON | IXOFF | IXANY | INPCK); - options.c_cflag &= ~(CRTSCTS | CSIZE | CBAUD | CSTOPB | PARODD | PARENB); + options.c_cflag &= ~(CRTSCTS | CSIZE | CSTOPB | PARODD | PARENB); options.c_lflag &= ~(ECHO | ECHONL | ISIG | ICANON); // Local line @@ -589,7 +589,8 @@ BSerialPort::_DriverControl() } //Set the baud rate - options.c_cflag |= (fBaudRate & CBAUD); + cfsetispeed(&options, fBaudRate); + cfsetospeed(&options, fBaudRate); //Set the timeout options.c_cc[VTIME] = 0;