diff options
author | Manuele Conti <conti.ma@alice.it> | 2014-10-01 13:13:11 +0200 |
---|---|---|
committer | Manuele Conti <conti.ma@alice.it> | 2014-10-01 15:08:19 +0200 |
commit | 26d61928f5a50c74f843cd88276c5b18e1bed375 (patch) | |
tree | f059d74d12ac09ca30786cae8f28eeec8edc248a /src | |
parent | dfdebc849400be43396b6600ac4c910e36869989 (diff) | |
download | qtserialport-26d61928f5a50c74f843cd88276c5b18e1bed375.tar.gz |
Remove custom baud rate filtering
Some serial device have baud base that it is not multiple of baud rate selected,
so we need to allow baud rate compliant with device.
Change-Id: I7d3ce94f10d4382a29ff34bb18daebb650186c1c
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index d555805..e80c0e8 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -504,9 +504,6 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d if (::ioctl(descriptor, TIOCGSERIAL, ¤tSerialInfo) == -1) return decodeSystemError(); - if (currentSerialInfo.baud_base % baudRate != 0) - return QSerialPort::UnsupportedOperationError; - currentSerialInfo.flags &= ~ASYNC_SPD_MASK; currentSerialInfo.flags |= (ASYNC_SPD_CUST /* | ASYNC_LOW_LATENCY*/); currentSerialInfo.custom_divisor = currentSerialInfo.baud_base / baudRate; @@ -514,6 +511,13 @@ QSerialPortPrivate::setCustomBaudRate(qint32 baudRate, QSerialPort::Directions d if (currentSerialInfo.custom_divisor == 0) return QSerialPort::UnsupportedOperationError; + if (currentSerialInfo.custom_divisor * baudRate != currentSerialInfo.baud_base) { + qWarning("Baud rate of serial port %s is set to %d instead of %d: divisor %f unsupported", + qPrintable(systemLocation), + currentSerialInfo.baud_base / currentSerialInfo.custom_divisor, + baudRate, (float)currentSerialInfo.baud_base / baudRate); + } + if (::ioctl(descriptor, TIOCSSERIAL, ¤tSerialInfo) == -1) return decodeSystemError(); |