summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2016-02-22 15:27:52 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2016-02-25 15:44:04 +0000
commit56c001b4fe378f1f1461f57a75e077ec8434a2ee (patch)
tree4cd5266777675b08bf34838ee6925953e37cf5e5
parent4e1873cea12c747aaa021e529051bcb2d3e85bb8 (diff)
downloadqtserialport-56c001b4fe378f1f1461f57a75e077ec8434a2ee.tar.gz
Forbid the RTS changing when the HardwareFlowControl was set
It is an error when the RTS changes manually when the HardwareFlowControl is set. In this case the driver operates with the RTS automatically, so manual control is not allowed. But some drivers ignore this requirement and do not return errors in attempt of manual RTS control. Thus, we have to forbid change of RTS and to return the UnsupportedOperationError error. Change-Id: I80bc87d51d9c653ed15ec310fca654243821b1e7 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 38bd150..481b07e 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -955,6 +955,11 @@ bool QSerialPort::setRequestToSend(bool set)
return false;
}
+ if (d->flowControl == QSerialPort::HardwareControl) {
+ d->setError(QSerialPortErrorInfo(QSerialPort::UnsupportedOperationError));
+ return false;
+ }
+
const bool requestToSend = isRequestToSend();
const bool retval = d->setRequestToSend(set);
if (retval && (requestToSend != set))