summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2013-07-23 21:26:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-24 09:50:51 +0200
commita879b799635ff086156a213512a93963ce40fa28 (patch)
tree46bd6cdfabefd72abee13bde962804438b82a4c9
parent38a54cddd6298746ce05102f95b43106d89029ad (diff)
downloadqtserialport-a879b799635ff086156a213512a93963ce40fa28.tar.gz
Do not set an error for timeout as there is no timeout error handled yet
This will need a proper extension later with a dedicated timeout error for 5.2 which will follow this change. See the following QIODevice subclasses for details to get a rough idea: http://doc-snapshot.qt-project.org/qt5-stable/qtcore/qprocess.html#ProcessError-enum http://qt-project.org/doc/qt-5.0/qtcore/qfiledevice.html#FileError-enum http://doc-snapshot.qt-project.org/qt5-stable/qtnetwork/qabstractsocket.html#SocketError-enum This will also mean, we need to duplicate the qt_safe_select and qt_core_unix.cpp etc files as qt_safe_select is exported, but only from a private header. Anyway, more explain to come for that change. Task-number: QTBUG-32016 Change-Id: If10cd7b5575636f0f7ee3368258e80bd4766ff3a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport_unix.cpp6
-rw-r--r--src/serialport/qserialport_win.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp
index 2f6c8cc..92d9f2f 100644
--- a/src/serialport/qserialport_unix.cpp
+++ b/src/serialport/qserialport_unix.cpp
@@ -429,7 +429,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs)
bool timedOut = false;
if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(),
timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) {
- q_ptr->setError(decodeSystemError());
+ if (!timedOut)
+ q_ptr->setError(decodeSystemError());
return false;
}
@@ -460,7 +461,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs)
bool timedOut = false;
if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(),
timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) {
- q_ptr->setError(decodeSystemError());
+ if (!timedOut)
+ q_ptr->setError(decodeSystemError());
return false;
}
diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp
index c3261a2..129df7e 100644
--- a/src/serialport/qserialport_win.cpp
+++ b/src/serialport/qserialport_win.cpp
@@ -476,7 +476,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs)
if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) {
// This is occur timeout or another error
- q_ptr->setError(decodeSystemError());
+ if (!timedOut)
+ q_ptr->setError(decodeSystemError());
return false;
}
@@ -511,7 +512,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs)
AbstractOverlappedEventNotifier *n = 0;
if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) {
- q_ptr->setError(decodeSystemError());
+ if (!timedOut)
+ q_ptr->setError(decodeSystemError());
return false;
}