summaryrefslogtreecommitdiffstats
path: root/tools/runonphone
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-08-02 14:06:05 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-08-02 14:25:56 (GMT)
commit8479ef846a60c230be3f5af470ec5129bc4375f3 (patch)
tree8672fe9478aab8728eb4504b6317f87a92c168d9 /tools/runonphone
parentcb678ebc0ba9d804050c67418e8eb46962bf3bc0 (diff)
downloadQt-8479ef846a60c230be3f5af470ec5129bc4375f3.zip
Qt-8479ef846a60c230be3f5af470ec5129bc4375f3.tar.gz
Qt-8479ef846a60c230be3f5af470ec5129bc4375f3.tar.bz2
runonphone: fix failure to terminate
In some cases, the serial port is always completing with no error and zero bytes read. In this case, runonphone would not shut down properly as the terminate file descriptor was never read. Reviewed-By: mread
Diffstat (limited to 'tools/runonphone')
-rw-r--r--tools/runonphone/symbianutils/trkdevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/runonphone/symbianutils/trkdevice.cpp b/tools/runonphone/symbianutils/trkdevice.cpp
index c6dc0a4..e28e70e 100644
--- a/tools/runonphone/symbianutils/trkdevice.cpp
+++ b/tools/runonphone/symbianutils/trkdevice.cpp
@@ -694,7 +694,7 @@ public slots:
void terminate();
private:
- enum Handles { FileHandle, TerminateEventHandle, HandleCount };
+ enum Handles { TerminateEventHandle, FileHandle, HandleCount };
inline int tryRead();
@@ -727,7 +727,7 @@ int WinReaderThread::tryRead()
const DWORD bytesToRead = qMax(DWORD(1), qMin(comStat.cbInQue, DWORD(BufSize)));
// Trigger read
DWORD bytesRead = 0;
- if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) {
+ if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped) && bytesRead > 0) {
if (bytesRead == 1) {
processData(buffer[0]);
} else {
@@ -736,7 +736,7 @@ int WinReaderThread::tryRead()
return 0;
}
const DWORD readError = GetLastError();
- if (readError != ERROR_IO_PENDING) {
+ if (readError != ERROR_IO_PENDING && readError != 0) {
emit error(QString::fromLatin1("Read error: %1").arg(winErrorMessage(readError)));
return -1;
}