summaryrefslogtreecommitdiff
path: root/src/serialport/qserialport.cpp
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-10-01 15:53:09 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2015-10-01 13:20:36 +0000
commit23c89518d1404a4db570fe41f3cc04451703e16f (patch)
treed5b8c0bc5543f5a9683f46f416c8cd90e342bfb2 /src/serialport/qserialport.cpp
parenta1655d6ccf3f82508286b471819cc5e5cb64ff44 (diff)
downloadqtserialport-23c89518d1404a4db570fe41f3cc04451703e16f.tar.gz
Fix stalling of reading with the limited buffer size on *nix
When the read buffer with a limited size is used, the read notifier becomes disabled when the buffer completely is filled. The notifier should be enabled again when several bytes were read from the read buffer. Change-Id: I723253fb153a1144009579141fa0ce1aca93b648 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/serialport/qserialport.cpp')
-rw-r--r--src/serialport/qserialport.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 690eb65..369be62 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -1409,7 +1409,7 @@ qint64 QSerialPort::readData(char *data, qint64 maxSize)
Q_UNUSED(data);
Q_UNUSED(maxSize);
-#ifdef Q_OS_WIN32
+#if defined(Q_OS_WIN32)
// We need try to start async reading to read a remainder from a driver's queue
// in case we have a limited read buffer size. Because the read notification can
// be stalled since Windows do not re-triggered an EV_RXCHAR event if a driver's
@@ -1417,6 +1417,12 @@ qint64 QSerialPort::readData(char *data, qint64 maxSize)
Q_D(QSerialPort);
if (d->readBufferMaxSize || d->flowControl == QSerialPort::HardwareControl)
d->startAsyncRead();
+#elif defined(Q_OS_UNIX)
+ // We need try to re-trigger the read notification to read a remainder from a
+ // driver's queue in case we have a limited read buffer size.
+ Q_D(QSerialPort);
+ if (d->readBufferMaxSize && !d->isReadNotificationEnabled())
+ d->setReadNotificationEnabled(true);
#endif
// return 0 indicating there may be more data in the future