summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuele Conti <conti.ma@alice.it>2014-10-01 13:13:11 +0200
committerManuele Conti <conti.ma@alice.it>2014-10-01 15:08:19 +0200
commit26d61928f5a50c74f843cd88276c5b18e1bed375 (patch)
treef059d74d12ac09ca30786cae8f28eeec8edc248a
parentdfdebc849400be43396b6600ac4c910e36869989 (diff)
downloadqtserialport-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>
-rw-r--r--src/serialport/qserialport_unix.cpp10
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, &currentSerialInfo) == -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, &currentSerialInfo) == -1)
return decodeSystemError();