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.
This commit is contained in:
Adrien Destugues
2013-12-21 21:59:31 +01:00
parent 9cdbb95476
commit d3e73d457e
+3 -2
View File
@@ -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;