summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-10-03 13:21:17 +0400
committerDenis Shienkov <denis.shienkov@gmail.com>2014-10-03 13:32:01 +0200
commit9c88ad89801596e1d94acc4f32ff55c34118a66f (patch)
tree18f3150a0ab599b082f3b5813e833e0fe6886f4a /src
parentac0422e8c9e74f2275129e3c7c69ef64299f07a9 (diff)
downloadqtserialport-9c88ad89801596e1d94acc4f32ff55c34118a66f.tar.gz
Restart of async reading when a QSP::clear() is called
The method QSP::clear() can stall reading in case of following situations: - at the moment when PurgeComm abort of previously started asynchronous reading operation - when a serial port is in hardware flow control mode - when a serial port has a limited read buffer size Therefore is necessary restart of asynchronous reading to enable of the read sequence. Change-Id: I7a722a1ee20ecba0dd631da96ca81d2937d7ca6b Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialport_win.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index 3174db5..84d1db7 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -282,6 +282,12 @@ bool QSerialPortPrivate::clear(QSerialPort::Directions directions)
return false;
}
+ // We need start async read because a reading can be stalled. Since the
+ // PurgeComm can abort of current reading sequence, or a port is in hardware
+ // flow control mode, or a port has a limited read buffer size.
+ if (directions & QSerialPort::Input)
+ startAsyncRead();
+
return true;
}