From 56c001b4fe378f1f1461f57a75e077ec8434a2ee Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Mon, 22 Feb 2016 15:27:52 +0300 Subject: 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 Reviewed-by: Denis Shienkov --- src/serialport/qserialport.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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)) -- cgit v1.2.1