From 11ed2f6216b89bf1ee52ce99c37822379f764d41 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 24 Oct 2014 17:36:01 +0400 Subject: Fix critical typo with _q_startAsyncWrite() Commit 62dfdeb3642250bdb642dbf607a8c7b95e57835e introduce a critical typo that revert a bug which are fixed in the b4d5bd813f591dc618e0fff2d55d93eeccb1a26e commit. Change-Id: I9ed29f5b443cbd7102878287d531d18a9351a2e5 Reviewed-by: Oswald Buddenhagen Reviewed-by: Sergey Belyashov Reviewed-by: Thiago Macieira --- src/serialport/qserialport_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 9635325..bd9a9fb 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -709,7 +709,7 @@ qint64 QSerialPortPrivate::writeData(const char *data, qint64 maxSize) if (!writeBuffer.isEmpty() && !writeStarted) { if (!startAsyncWriteTimer) { startAsyncWriteTimer = new QTimer(q); - q->connect(startAsyncWriteTimer, SIGNAL(timeout()), q, SLOT(_q_completeAsyncWrite())); + q->connect(startAsyncWriteTimer, SIGNAL(timeout()), q, SLOT(_q_startAsyncWrite())); startAsyncWriteTimer->setSingleShot(true); } startAsyncWriteTimer->start(0); -- cgit v1.2.1 From cb2ff89d4250fb089d5cf0fb4aeecdc35ae526ac Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 10 Oct 2014 21:51:12 +0400 Subject: Prevent multiple calls of WaitCommEvent Commit ac0422e8c9e74f2275129e3c7c69ef64299f07a9 introduced a regression that QSP::startAsyncCommunication() was called twice when a limited read buffer is used. In the second call the WaitCommEvent function returned the ERROR_INVALID_PARAMETER error that lead to a stall of the read sequence. QSP::startAsyncCommunication() should be called only when the read buffer has enough space. Tested on Windows 8 with the virtual com0com ports using Qt5. Change-Id: Icd6cada7c3acfd4e689ac76ec304416b00f52b50 Reviewed-by: Oswald Buddenhagen Reviewed-by: Sergey Belyashov --- src/serialport/qserialport_win.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index bd9a9fb..c47f1e4 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -549,11 +549,12 @@ bool QSerialPortPrivate::_q_completeAsyncRead() readStarted = false; - // start async read for possible remainder into driver queue if ((bytesTransferred == ReadChunkSize) && (policy == QSerialPort::IgnorePolicy)) return startAsyncRead(); - else // driver queue is emplty, so startup wait comm event + else if (readBufferMaxSize == 0 || readBufferMaxSize > readBuffer.size()) return startAsyncCommunication(); + else + return true; } bool QSerialPortPrivate::_q_completeAsyncWrite() -- cgit v1.2.1 From 367ed19c803497105dd219039fbd8c69ba070296 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Fri, 10 Oct 2014 22:41:24 +0400 Subject: Improve the QSP::clear() on Windows Commit 9c88ad89801596e1d94acc4f32ff55c34118a66f solves a problem partially. Still when used QSP::clear() with some devices (e.g. virtual ports from the "AGG Software") the reading can be stalled. It is reasonable to make following: 1. Prevent to reset the both readStarted and writeStarted variables inside of QSP::clear() method. These variables shall be reset inside of _q_completeXX() methods which will be called automatically from the notifiers, since the PurgeComm should terminate pending read or write operations. 2. Instead of startAsyncRead() should be called the startAsyncCommunication(), that allow to correctly startup of the read sequence. This scenario can be reproduced with running of the tst_QSerialPort::readAfterInputClear() autotest. Tested on Windows 8 with the virtual com0com ports and with the virtual ports from the "AGG Software" using Qt5. Change-Id: Ic1a53334abd97667a9dd3291c3b975eb04062efd Reviewed-by: Robert Kurjata Reviewed-by: Sergey Belyashov --- src/serialport/qserialport_win.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index c47f1e4..62a547c 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -271,13 +271,10 @@ bool QSerialPortPrivate::clear(QSerialPort::Directions directions) Q_Q(QSerialPort); DWORD flags = 0; - if (directions & QSerialPort::Input) { + if (directions & QSerialPort::Input) flags |= PURGE_RXABORT | PURGE_RXCLEAR; - readStarted = false; - } if (directions & QSerialPort::Output) { flags |= PURGE_TXABORT | PURGE_TXCLEAR; - writeStarted = false; actualBytesToWrite = 0; } if (!::PurgeComm(handle, flags)) { @@ -289,7 +286,7 @@ bool QSerialPortPrivate::clear(QSerialPort::Directions directions) // 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(); + startAsyncCommunication(); return true; } -- cgit v1.2.1 From 8a7156c2f9a409fa741dd9e013407169211fb5ed Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 8 Oct 2014 20:14:11 +0400 Subject: Refactor and add missed changes up 5.2.0 to 5.3.2 Change-Id: I8a3c40202a89cd1fd264e324e6379d1f6220c340 Reviewed-by: Martin Smith Reviewed-by: Sergey Belyashov --- dist/changes-5.1.1 | 2 +- dist/changes-5.2.0 | 186 ++++++++++++++++++++++------------------------------- dist/changes-5.2.1 | 32 +++++++++ dist/changes-5.3.0 | 76 ++++++++++++++++++++++ dist/changes-5.3.1 | 49 ++++++++++++++ dist/changes-5.3.2 | 51 +++++++++++++++ 6 files changed, 285 insertions(+), 111 deletions(-) create mode 100644 dist/changes-5.2.1 create mode 100644 dist/changes-5.3.0 create mode 100644 dist/changes-5.3.1 create mode 100644 dist/changes-5.3.2 diff --git a/dist/changes-5.1.1 b/dist/changes-5.1.1 index e233af4..92c2648 100644 --- a/dist/changes-5.1.1 +++ b/dist/changes-5.1.1 @@ -4,7 +4,7 @@ compatibility (source and binary) with Qt 5.1.0. For more details, refer to the online documentation included in this distribution. The documentation is also available online: - http://qt-project.org/doc/qt-5.1/ + http://qt-project.org/doc/ The Qt version 5.1 series is binary compatible with the 5.0.x series. Applications compiled for 5.0 will continue to run with 5.1. diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0 index 6105c8b..f4e79c4 100644 --- a/dist/changes-5.2.0 +++ b/dist/changes-5.2.0 @@ -3,7 +3,7 @@ bugfixes over the 5.1.x series. For more details, refer to the online documentation included in this distribution. The documentation is also available online: - http://qt-project.org/doc/qt-5.2/qtserialport-index.html + http://qt-project.org/doc/ The QtSerialPort version 5.2 series is binary compatible with the 5.1.x series. Applications compiled for 5.1 will continue to run with 5.2. @@ -20,112 +20,78 @@ information about a particular change. * Library * **************************************************************************** -- [QTBUG-32684] VID/PID for USB Huawei 3G Modem is returned properly now. - -- [QTBUG-32016] No "No such file or directory" error set after waitForReadyRead -anymore. - -- [QTBUG-32017] Windows: Fixed the waitAnyEvent() method for the WAIT_FAILED -handling. - -- [QTBUG-32018] The port name and product identifiers now work for more devices -and scenarios on Windows. - -- [QTBUG-31964] The serial port enums are now properly tagged as Q_FLAGS and -used so. - -- [QTBUG-31966] Support has been added for non-standard Qt header intallation -folder (e.g. on Red Hat). - -- Added native serial port handle; it is now possible to do any custom operation -if not supported by QtSerialPort. - -- [QTBUG-32680] Added API for handling the time out errors when waiting for read -or write. - -- [QTBUG-33125] The generation of the forward headers now works with Qt 4 and -Necessitas. - -- [QTBUG-33117] [QTBUG-33139] Fixed the compilation for Android with Qt 5. The -command line enumerator seems to work. - -- Added support for BSD4 baud rates, i.e. not Unix compatible. - -- Linux: sysfs support was added for serial port information as a fallback for -udev, but it is preferred to hard coded serial port node names. - -- [QTBUG-32173] Rewrote the documentation to more proper English than before, -and also some change for more accurate content. - -- Added a new error enumeration value called "NotOpenError". This can be used -for operation when the serial port is not open. This is also used internally -now. - -- [QTBUG-33774] Document that the serial port parameters cannot be set before -opening. - -- No more unnecessary syscalls (parameter settings, pinout signal query, etc) in the -backend when the port is closed. This also means no improper errors are set -accordingly. - -- Removed the QtGui linkage for the command line enumerator example, so it now -links against QtCore and QtSerialPort only. - -- More warnings when doing operations that require the serial port to be open, -but it is closed. - -- The deprecated QtAlgorithm usage is removed. - -- Some outputs in the examples are fixed to be more proper English; this -includes mostly typo, but also some comprehensive changes. - -- New command line sync reader example available with screen shot and -documentation. - -- New command line async reader example available with screen shot and -documentation. - -- New command line sync writer example available with screen shot and -documentation. - -- New command line async writer example available with screen shot and -documentation. - -- [QTBUG-34329] Support added for loading udev at runtime rather than linking at -compilation time. - -- The buildsystem now respects the configure run for Qt 5, i.e. packageconfig is -not used for finding udev again. - -- [QTBUG-32563] Motorola IMX support was added when udev and sysfs are not -present. - -- [QTBUG-34429] Mark the data error policy obsolete. End users should stop using -this feature now. It may be removed later in Qt 6.X, and there is a warning now -if it is used. - -- Support has been added for the hard-coded device enumeration backend to get -information. Android uarts such as /dev/ttyHS* (High speed UART) and -/dev/ttyHSL* (Low speed UART) are supported by that backend. - -- [QTBUG-34474] Replace the internal QTtyLocker with QLockFile from QtCore and a -small convenience on top of it to comply with the locking directories lockdev -also uses. - -- Support has been added for the hard-coded device enumeration backend to get -information. /dev/ttyO* (native OMAP UART) is supported by that backend. - -- The lock file usage has been extended to support Android as there is no direct -access to the usual Unix lock file system paths. The lock file is now placed -into /data/local/tmp. - -- [QTBUG-35064] PCI support has been added to the sysfs backend on Linux to -support the enumeration of such devices. - -- [QTBUG-35184] Mark the isValid() method in QSerialPortInfo deprecated because -it has no common use case. - -- [QTBUG-35215] Mark the QSerialPort::Unknown* enumeration values in QSerialPort -deprecated because it has no use case, and was added mistakenly. There is no -such "standard" serial port behavior general for these as "unknown". It is an -implementation detail for error reporting, and hence not recommended anymore. + - [QTBUG-31966] Support has been added for non-standard Qt header installation + folder (e.g. on Red Hat). + - [QTBUG-33125] The generation of the forwarding headers now works with Qt 4 and + Necessitas. + - [QTBUG-33117] [QTBUG-33139] Fixed the compilation for Android with Qt 5. The + command line enumerator seems to work. + - Added support for non-standard BSD4 baud rates. + - [QTBUG-32173] Rewrote the documentation to more proper English than before, + and also improved the accuracy of the content. + - [QTBUG-33774] Document that the serial port parameters cannot be set before + opening. + - No more unnecessary syscalls (parameter settings, pinout signal query, etc) in the + backend when the port is closed. This also means no unnecessary errors are set. + - Removed the QtGui linkage for the command line enumerator example, so it now + links against QtCore and QtSerialPort only. + - More warnings when doing operations that require the serial port to be open, + but it is closed. + - The deprecated QtAlgorithm usage is removed. + - Some outputs in the examples are fixed to be more proper English; this + includes mostly typos, but also some comprehensive changes. + - New command line sync reader example available with screen shot and + documentation. + - New command line async reader example available with screen shot and + documentation. + - New command line sync writer example available with screen shot and + documentation. + - New command line async writer example available with screen shot and + documentation. + - The buildsystem now respects the configure run for Qt 5, i.e. pkg-config is + not used for finding udev again. + - [QTBUG-34429] Mark the data error policy obsolete. End users should stop using + this feature now. It may be removed later in Qt 6.X, and there is a warning now + if it is used. + - [QTBUG-34474] Replace the internal QTtyLocker with QLockFile from QtCore and a + small convenience on top of it to comply with the locking directories lockdev + also uses. + - The lock file usage has been extended to support Android as there is no direct + access to the usual Unix lock file system paths. The lock file is now placed + into /data/local/tmp. + - [QTBUG-35184] Mark the isValid() method in QSerialPortInfo deprecated because + it has no common use case. + - [QTBUG-35215] Mark the QSerialPort::Unknown* enumeration values in QSerialPort + deprecated because they have no use case. + + - QSerialPortInfo: + * [QTBUG-32684] VID/PID for USB Huawei 3G Modem is returned properly now. + * [QTBUG-32018] The port name and product identifiers now work for more devices + and scenarios on Windows. + * Linux: sysfs support was added for serial port information as a fallback for + udev. + * [QTBUG-34329] Support added for loading udev at runtime rather than linking at + compilation time. + * [QTBUG-32563] Motorola IMX support was added when udev and sysfs are not + present. + * Support has been added for the hard-coded device enumeration backend to get + information. Android uarts such as /dev/ttyHS* (High speed UART) and + /dev/ttyHSL* (Low speed UART) are supported by that backend. + * Support has been added for the hard-coded device enumeration backend to get + information. /dev/ttyO* (native OMAP UART) is supported by that backend. + * [QTBUG-35064] PCI support has been added to the sysfs backend on Linux to + support the enumeration of such devices. + + - QSerialPort: + * [QTBUG-32016] No "No such file or directory" error set after waitForReadyRead + anymore. + * [QTBUG-32017] Windows: Fixed the waitAnyEvent() method for the WAIT_FAILED + handling. + * [QTBUG-31964] The serial port enums are now properly tagged as Q_FLAGS. + * Added native serial port handle; it is now possible to do any custom operation + if not supported by QtSerialPort. + * [QTBUG-32680] Added API for handling the timeout errors when waiting for read + or write. + * Added a new error enumeration value called "NotOpenError". This can be used + for operations where the serial port is not open. This is also used internally + now. diff --git a/dist/changes-5.2.1 b/dist/changes-5.2.1 new file mode 100644 index 0000000..3bbb623 --- /dev/null +++ b/dist/changes-5.2.1 @@ -0,0 +1,32 @@ +Qt 5.2.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.2.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/ + +The Qt version 5.2 series is binary compatible with the 5.1.x series. +Applications compiled for 5.1 will continue to run with 5.2. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + + - The creadersync example should not return true when an empty buffer was read. + - Improved data receiving in creaderasync example. Received data should be + accumulated at each triggering of readyRead() during wait timeout. + + - QSerialPort: + * [QTBUG-33938] Fixed crash when closing serial port on Windows. Now the + signals/slots are used instead of overriding the QWinEventNotifier::event(). + * Improved the low-level data writing on Windows. Now a whole writeBuffer + is written instead of chunks. diff --git a/dist/changes-5.3.0 b/dist/changes-5.3.0 new file mode 100644 index 0000000..73caecb --- /dev/null +++ b/dist/changes-5.3.0 @@ -0,0 +1,76 @@ +QtSerialPort 5.3 introduces a few new features and improvements as well as +bugfixes over the 5.2.x series. For more details, refer to the online +documentation included in this distribution. The documentation is also available +online: + + http://qt-project.org/doc/ + +The QtSerialPort version 5.3 series is binary compatible with the 5.2.x series. +Applications compiled for 5.2 will continue to run with 5.3. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + + - Build for WinRT is disabled, since the MSDN Windows Store apps will not have + any serial port replacement. + - Improved the documentation. + - Added error handling to some missing functions. + - Removed some unused code related to the SystemIn/OutputQueue size + methods. + - Now the TxD/RxD signals are obsolete, since there is no reliable low-level + API of obtaining the status of these signals. + - Now the signal bytesWritten() is emitted only after completion of a write + operation (when a payload of data was transferred from the driver's queue and + the driver's queue became empty). + - [QTBUG-36865] Remove the continuous warning about the unknown flow control. + - [QTBUG-35781] Use private linkage where appropriate. + - Swap the open and configure error reporting in the terminal example. + - Obsolete the "settings restore on close" API. + - [QTBUG-37989] Keep qmake's "-framework" option on OSX to fix building. + - Fixed display of the serial number in the terminal example. + - Mark the settingsRestoredOnClose property deprecated since 5.3 instead + of 5.2. + - Ensure both input and output baud rates are set. + + - QSerialPortInfo: + * [QTBUG-32774] Added the enumerating of virtual serial ports that are created + from the "AGG Software" utility on Windows. + * [QTBUG-36526] Added an additional enumeration through the SERIALCOMM + registry for serial ports which are not present in Windows Device Manager. + * [QTBUG-36870] Used Q_GLOBAL_STATIC for the udev symbol loading QLibrary + instance. + * [QTBUG-31981] Added API for querying the serial number of USB serial ports. + * [QTBUG-36296] Fixed info update for FTDI devices on Android by using Sysfs. + * [QTBUG-37578] Used QScopedPointer (RAII) to avoid memory leaks with udev. + + - QSerialPort: + * Added handling of the ERROR_INVALID_NAME error code on Windows; now this + error is interpreted as DeviceNotFoundError. + * Optimized writing sequence algorithm on Windows; now there are no excess + calls of WriteFile when the writeBuffer is empty. + * [QTBUG-36490] Fixed changing the state of the DTR signal when modifying + DCB properties; now the DTR signal stays in the same state. + * [QTBUG-33987] Fixed the waitForReadyRead() behavior on Windows. + * cfmakeraw is no longer used on SunO since it doesn't exist on Solaris and + Illumos. + * qt_safe_open() is now used instead of open() on Unix since open() is not + thread-safe, that can lead to leaking of file descriptors. + * [QTBUG-36824] Protected against EINTR in Unix non-atomic I/O calls with use + of qt_safe_xxx functions. + * [QTBUG-33774] Now there is the possibility to set up the port settings + before opening. + * Improved the reading and writing algorithm on Windows. + * Define CRTSCTS on QNX. Tested on SVTronics UEVM5432 Omap5 board with + QNX 6.6. + * [QTBUG-38339] Fixed the flush() regression on Unix. + * [QTBUG-38961] Fixed regression on Linux when trying to set a custom baud + rate. diff --git a/dist/changes-5.3.1 b/dist/changes-5.3.1 new file mode 100644 index 0000000..2f350db --- /dev/null +++ b/dist/changes-5.3.1 @@ -0,0 +1,49 @@ +Qt 5.3.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.3.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/ + +The Qt version 5.3 series is binary compatible with the 5.2.x series. +Applications compiled for 5.2 will continue to run with 5.3. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + + - Use Q_NULLPTR for null pointer purposes with NULL fallback for Qt4. + - The WinCE implementation is moved into its own separate module. + - Disabled automatic header precompilation for QtSerialPort, since it is + more expensive than the benefit. + + - QSerialPortInfo: + * Added support for the VID/PID of PCI serial ports from the Sysfs backend. + * Fixed mixed up vendor and product identifiers by using of Udev backend. + + - QSerialPort: + * Added support of custom baud rate on QNX. + * Improved the error handling. + * QTimer is now used with zero interval to defer starting of writing on + Windows to next event-loop entering. It allow to accumulate a multiple + write() calls to futher write of whole buffer instead of chunks. + * [QTBUG-36758] Fixed the waitForBytesWritten() behavior on Windows. + * [QTBUG-38640] Now a states of the DTR/RTS signals are initialized after + opening. + * [QTBUG-39369] Do not emit the error() in destructor of QSerialPort; this + error signal may then call slots of already (partially) deleted objects. + * Fixed the error message for TimeoutError on Windows (which has the + WAIT_TIMEOUT error code). + * [QTBUG-39314] Fixed regression of waitForReadyRead() method on Windows. + * Added handling of the ENOENT error code in uclibc on Linux. Now this error + is interpreted as DeviceNotFoundError. + diff --git a/dist/changes-5.3.2 b/dist/changes-5.3.2 new file mode 100644 index 0000000..515ac83 --- /dev/null +++ b/dist/changes-5.3.2 @@ -0,0 +1,51 @@ +Qt 5.3.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.3.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/ + +The Qt version 5.3 series is binary compatible with the 5.2.x series. +Applications compiled for 5.2 will continue to run with 5.3. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + + - Improved documentation. + - Fixed compilation with QT_DISABLE_DEPRECATED_BEFORE=0x050300. + + - QSerialPortInfo: + * Improved detection of serial numbers of the USB CDC serial ports on Windows. + * Now the OSX code is in its own separate module. + * Rewrote OSX code to wrap CFTypeRef and CFStringRef, which are defined in + qcore_mac_p.h. + * Optimized searching of the names of serial ports on Windows. The algorithm + now returns early if a serial port name is found. + * [QTBUG-39748][QTBUG-41415] Fixed error caused by calling fromWCharArray() + with incorrect arguments on Windows. + + - QSerialPort: + * [QTBUG-36727] Fixed entering a busy-loop on Linux/OSX when connected device + disappears for the system (e.g. the USB converter was pulled from the PC). + * [QTBUG-35829] Fixed the error message "QSocketNotifier::Exception is not + supported on iOS". + * [QTBUG-32020] Improved the ResourceError handling on Windows when a + USB/Serial converter is pulled from PC. + * Immediately returns from the waitForReadyRead() on Linux when there is an + error. + * Refactored error handling on Windows. + * [QTBUG-40344] Fixed the loopback I/O on Windows when waitForBytesWritten() + is used. + * [QTBUG-40414] Fixed leak of a descriptor after unsuccessful opening. + * Made the QSerialPort::flush() non-blocking according to the documentation. + * [QTBUG-40793] Now the waitForReadyRead() also starts writing on Windows. -- cgit v1.2.1