diff options
author | Dyami Caliri <dyami@dragonframe.com> | 2014-05-01 14:22:00 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-03 08:57:30 +0200 |
commit | 684945503a444dfc3a0fd475b7f8d81bc48a387a (patch) | |
tree | 52a89c0e432e89c07c7f448cfe60de1dbbc4946d | |
parent | d1e689f8c5162ec77e6fa08fbb4e988545c5c4ab (diff) |
Ensure both input and output baud rates are set.v5.3.0-rc1
QSerialPortPrivate::setBaudRate() wasn't trying to set the output
baud rate for the port after successfully setting the input baud rate.
Also, some devices (such as FTDI chips) on Mac don't respond
properly if you call updateTermios() with mismatched baud rates,
even if you later set them to be the same.
Change-Id: I507fe10cba221bb4e43ded650dc44cc974de2414
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 007a7753..8140e079 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -521,12 +521,11 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) bool QSerialPortPrivate::setBaudRate() { - if (!setBaudRate(inputBaudRate, QSerialPort::Input) - && !setBaudRate(outputBaudRate, QSerialPort::Output)) { - return false; - } + if (inputBaudRate == outputBaudRate) + return setBaudRate(inputBaudRate, QSerialPort::AllDirections); - return true; + return (setBaudRate(inputBaudRate, QSerialPort::Input) + && setBaudRate(outputBaudRate, QSerialPort::Output)); } bool QSerialPortPrivate::setBaudRate(qint32 baudRate, QSerialPort::Directions directions) |