Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.6.2
-
None
-
Toradex Colibri IMX6
Windows Embedded Compact 2013 (BSP: Toradex V1.1b4)
VisualStudio 2015
Description
Symptom: Using QSerialPort in asynch mode (Asynch-Example from QT) on an embedded device running Windows Compact 2013 OS.
After successfully sending a msg using QSerialPort:::write(QByteArray) function, a QSerialPort::error() signal is received with error QSerialPort::WriteError a couple of milliseconds later. Same happens on QSerialPort::flush() function.
Problem: Apparently the windows WriteFile function returns false for 0-length data on Windows Compact 2013 systems
Solution: bool QSerialPortPrivate::notifyWrite() (qtserialport_wince.cpp) does not check for empty writebuffer (the win implementation does so, see qtserialport_win.cpp).
Patch:
+++ qserialport_wince.cpp 2016-12-21 17:20:33.285213800 +0100 @@ -499,6 +499,9 @@ { Q_Q(QSerialPort); + if (writeBuffer.isEmpty()) { + return true; + } int nextSize = writeBuffer.nextDataBlockSize(); const char *ptr = writeBuffer.readPointer();
Drawback: The patch fixes the issue. But since debugging is not possible on the device, the source of the issue can be somewhere else. And the fix is not well tested (e.g not tested for large data, not tested for other OS)