summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Remove foreign records from 5.4.0 changesv5.4.05.4.0Denis Shienkov2014-11-281-3/+0
| | | | | | | To this changelog were added wrong changes from 5.4.1. Change-Id: I77cc5abb7d537dda3859969d18fb22546cf466ec Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Add changelog for Qt 5.4.0Denis Shienkov2014-11-281-0/+42
| | | | | Change-Id: I7c15897db3429df3a0d122893662c20ede4c8f66 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Check for lock file in non-writable directoriesv5.4.0-rc1Rainer Keller2014-10-231-8/+11
| | | | | | | | | | | | On some linux systems /var/lock is not writable by users which are not root and not in the uucp or dialout group. If the root user acquires a lock and you are trying to access the same port with a non-root user it will not check for the lock but creates a new lock file in /tmp instead. This change checks in readable directories for lock files. Change-Id: Ia308fd344d2fe9d3c699f7a428ff620ea101eff3 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-1412-52/+215
|\ | | | | | | Change-Id: Id7e66059233e8d07ba44cad19048d9cddc68e250
| * Fix QSP::bytesToWrite() on WindowsDenis Shienkov2014-10-067-36/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After calling the WriteFile() function, QSP::bytesToWrite() should return zero, but did return the size of writeBuffer. On Windows, we must not to cut a size of the writeBuffer until the asynchronous write operation has completed. So we need to make use of an additional actualBytesToWrite variable, the value of which is increased when new data is added to the writeBuffer, and decreased after calling the WriteFile() function. This change also entails the modification of the QSP::writeData() method and deleting the QSP::startWriting() method. Now all platform-dependent code (related to startWriting(), and to copying of memory to writeBuffer) resides in the new QSP::writeData() method. But this modification does not change the behavior on platforms other than Windows. Tested on Windows with the virtual com0com serial ports using Qt5. Change-Id: I35c1428ad374c0709d6c352a93c552898e947bde Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Allow for deviceInstanceIdentifier() to return an upper case stringDenis Shienkov2014-10-061-3/+3
| | | | | | | | | | | | Change-Id: I91977b1aa4a8e5bd8321efc5cfda375c9d7deff7 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Restart of async reading when a QSP::clear() is calledDenis Shienkov2014-10-032-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method QSP::clear() can stall reading in case of following situations: - at the moment when PurgeComm abort of previously started asynchronous reading operation - when a serial port is in hardware flow control mode - when a serial port has a limited read buffer size Therefore is necessary restart of asynchronous reading to enable of the read sequence. Change-Id: I7a722a1ee20ecba0dd631da96ca81d2937d7ca6b Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix reading on Windows at limited read buffer sizeDenis Shienkov2014-10-028-4/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case the read buffer has a limited size then are impossible to read remainder which is still can be in driver's queue, since no readyRead signal emmitted and reading are stalled. Problem is that Windows does not fire the EV_RXCHAR event in case a driver's queue has ready to read remainder; this event will be triggered only when a new data are received. The solution is to start of asynchronous read operation for reading of possible remainder from the queue after doing QSP::read() from the user. Besides is necessary to meet conditions: - do not start reading in case a reading already is started - do not start reading in case is not in limited buffer size - do not start reading in case is a previous reading returns a less data than read buffer size or are not in the hardware flow control mode Tested on Windows 8 with virtual com0com serial ports using Qt5 and then Qt4. Task-number: QTBUG-41295 Change-Id: I01797e6f8d6006751244144fead3616b1de1b811 Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Remove custom baud rate filteringManuele Conti2014-10-011-3/+7
| | | | | | | | | | | | | | | | | | Some serial device have baud base that it is not multiple of baud rate selected, so we need to allow baud rate compliant with device. Change-Id: I7d3ce94f10d4382a29ff34bb18daebb650186c1c Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix segfault related to dynamic udev loadingSergey Belyashov2014-10-012-7/+2
| | | | | | | | | | | | | | | | | | Problem was caused by conflict of libudev symbols and function pointers declared in qtudev_p.h. Task-number: QTBUG-40113 Change-Id: I599575e8a1b9ffe32295331d46d991422975f773 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Handle onboard serial ports when parsing sysfsRainer Keller2014-09-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | The device detection stopped if one of the sources reported at least one device. This made onboard serial ports not listed if a USB device was plugged in. Onboard serial ports are now detected and added to the list of devices. Change-Id: I8798e7f14073e19d9e206eb4d7cdd0b28bd8a0bb Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix typo in twoStageSynchronousLoopback testDenis Shienkov2014-09-281-2/+2
| | | | | | | | | | | | | | | | | | Commit f1761c1236edce428278f7a9e8aa1091097eaa57 introduce a typo for receiverPort and senderPort variables, that lead to failure of test. Change-Id: I18ecad78bb11d7bb218a674c3c3bf9c863a2b33c Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix order of passed parameters into QCOMPAREDenis Shienkov2014-09-281-7/+7
| | | | | | | | | | | | | | | | According to documentation the QCOMPARE should accept to the first parameter an actual value, and to the second parameter an expected value. Change-Id: I64e762e779fa6a61401f358c4dd6097dacf7a33a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix access after delete in OS X QSPIDyami Caliri2014-09-251-2/+1
| | | | | | | | | | | | | | | | | | | | Valgrind analysis shows that searchStringProperty was accessing memory after deletion. This was caused by constructing QCFString local var with CFStringRef, which does not retain object. Change-Id: I1e9571a5051aa6f0c3fbc732ac01e821069f8b02 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Query a serial number of USB device from SysfsDenis Shienkov2014-09-251-0/+4
| | | | | | | | | | | | | | | | Tested on Linux with the USB (FTDI and TI) serial ports using Qt4 Change-Id: I8c088bf8b6fe440565cc37538ca7ef029651fb61 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Doc: Applied title case in section1 titlesv5.4.0-beta1Nico Vertriest2014-10-081-1/+1
| | | | | | | | | | | | Change-Id: I8d68786028fe6e561e9c1d8b6960d43020c60e50 Task-number: QTBUG-41250 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-165-18/+179
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I5887622f233275703cca8cc2a5db4aaaccc72d97
| * Make tst_qtserialport build with Qt 4Samuel Gaist2014-09-121-4/+5
| | | | | | | | | | | | | | | | | | The newly moved twoStageSynchronousLoopback fails to compile since there's no qCompare available for int and long long with Qt 4. This patch allows to build it again with Qt 4 Change-Id: Ib3764b125f371ae70864bd578c7ccda39d08ae22 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Added missing deprecation guards and documentation updateSamuel Gaist2014-09-121-2/+7
| | | | | | | | | | | | | | | | This patch adds the missing guards around the deprecated functions implementations. Change-Id: I829e90e289da7af736fc6f5d6c319509138f1aef Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix Qt 4 buildSamuel Gaist2014-09-121-2/+0
| | | | | | | | | | | | | | | | | | | | Following the discussion on the development mailing list with Thiago Macieira, remove the guard around the signals since it's not supported to build with Qt 4. Task-number: QTBUG-41190 Change-Id: I8df1b7fa8cc69a2aacdcb4fedea0cc6fe092eece Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Bump versionFrederik Gladhorn2014-08-291-1/+1
| | | | | | | | Change-Id: Ida6ecfd792ea1906c70bf17bb5b8077ad4c5e631
| * Fix a race condition at writing on Windowsv5.3.25.3.2Denis Shienkov2014-08-284-10/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The writeStarted flag shall be reset to false after bytesWritten() signal is emitted, but not before it. 2. In case of start of writing from the startAsyncWriteTimer it is necessary to call the startAsyncWrite() method but not the completeAsyncWrite() method. It give guarantees to exclude of race condition to multiple call of the WriteFile twice until the write operation is not completed. For example, a race condition is watched in case of writing data from the slots which are connected to the bytesWritten() signal from a device; or to the timeout() signal from a timer with zero interval. To checking of these scenarios are added additional autotests. Tested on Windows 8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40769 Change-Id: Iedabbf38847debeee795a10fd7a4c54c65d2a338 Reviewed-by: Patrick Noffke <patrick.noffke@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Update license headers and add new license filesAntti Kokko2014-09-0971-1891/+1158
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I08685205169cdd4b49a651ed98f36ba1e6c1bb29 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4v5.4.0-alpha1Frederik Gladhorn2014-08-288-0/+80
|\ \ | |/ | | | | Change-Id: Id742521c303261262a87db4189d369851ed2078b
| * Add missing private headers warningsSamuel Gaist2014-08-187-0/+77
| | | | | | | | | | Change-Id: Ia60bf0d020d98a6fda8f689d631bb8681950d15f Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix handling of writing at using of waitForReadyRead()Denis Shienkov2014-08-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The method waitForReadyRead() shall call of the write sequence since the signals from the startAsyncWriteTimer will not be handled inside of waitForReadyRead() without event-loop. Tested on Windows 8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40793 Change-Id: I7806f16a4df30c4ec1643d8f696ad5761decd30a Reviewed-by: Patrick Noffke <patrick.noffke@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-1219-193/+332
|\ \ | |/ | | | | | | | | | | Conflicts: examples/serialport/examples.qdoc Change-Id: If79f2f140e72f0a499f8e61e3897848f454a5042
| * Fix compilation of apps with QT_DISABLE_DEPRECATED_BEFORE=0x050300Marcel Krems2014-08-111-0/+2
| | | | | | | | | | | | | | | | | | | | The enum is already marked as deprecated leading to this error: qserialport.h:267:46: error: no type named 'DataErrorPolicy' in 'QSerialPort' void dataErrorPolicyChanged(QSerialPort::DataErrorPolicy policy); ~~~~~~~~~~~~~^ Change-Id: I8d178f0d0921b8f5308183e1f09a4c8388448e26 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Move the synchronous loopback test from benchmarks to auto testsDenis Shienkov2014-08-035-158/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous commit 76f293bfb0fd7bab391f96ac822eacc40e4c5176 with adding of this test to the benchmarks were hasty. After all it makes sense to place it to auto tests to have opportunity to run with others together. Besides, this test is renamed since it is not a loopback, it is an I/O test with the synchronous approach. Change-Id: I043a6e0075561167bb29a59a384554ef98dbbd4a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Make the QSerialPort::flush() non-blockingDenis Shienkov2014-08-022-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | According to documentation, the flush() method shall be non-blocking. Tested on Linux 64-bit with auto-tests with the on-board and the USB serial ports for Qt4 and then Qt5. Note: On Windows the flush() method still does not work. Change-Id: Iaee80361e59e0c281206ca24c817a446cdbf6ed1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Pass a length of string to QString::fromWCharArrayDenis Shienkov2014-08-011-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using of the QString::fromWCharArray() we didn't pass length of a string, hoping that all WCHAR strings are terminated by the null-character. But it can lead to the wrong results if the initial WCHAR string has no null character. Therefore it is reasonable to pass length of a string to exclude an error. Besides, to do not break of the algorithm of string comparison it is necessary to return not null-terminated strings. Also now there is no need to initialize of some allocated arrays by zero values. Tested on Windows 7/8 with the on-board, the virtual com0com, the USB FTDI and the PL2303 serial ports, using Qt4 and then Qt5. Change-Id: I382cf8eacf4ab4d21c54de17fcdd6b9fcfa3d02c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix leak of a descriptor after unsuccessful openingDenis Shienkov2014-07-316-115/+152
| | | | | | | | | | | | | | | | | | In case of unsuccessful initialization of a device at the opening, a valid descriptor has to be closed before return from the open() method. Task-number: QTBUG-40414 Change-Id: I45568f176e003d9be1fe8c3017da29f39908efb0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix events handling in waitForBytesWritten() method on WindowsDenis Shienkov2014-07-302-5/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of communication event is triggered in the waitForBytesWritten() method then necessary to process it with the _q_completeAsyncCommunication() method, but not with the _q_completeAsyncRead() method. Otherwise it leads to false filling of the readBuffer with the data that were read earlier (or with garbage) which remained in readChunkBuffer. The synchronous loopback autotest reproduces a bug without of this patch. Tested on Windows 7/8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40344 Change-Id: I679109b60f4058c4c6f7e5f02c1f70ba6039d8d8 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Add the synchronous loopback data verification testDenis Shienkov2014-07-264-1/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Good reason to check of data correctness at transferring and receiving. In this test are used two serial ports, connected in a null-modem mode: http://en.wikipedia.org/wiki/Null_modem . The sender port transfers data to the receiver port. After data are received is carried out check of equivalence of the transferred and received data. Before run of testing it is necessary to set two variable environments QTEST_SERIALPORT_SENDER and QTEST_SERIALPORT_RECEIVER to specify names of used serial ports. This test can reveal errors related with the internal data processing and also errors of synchronous I/O inside of QSerialPort. This test is placed in separate "benchmarks" category not to mix-up with "manual" and "auto" categories, because this test is closer to "benchmarks" by own functionality. Tested on Windows 7/8 with the virtual com0com serial ports, using Qt4 and then Qt5. Change-Id: Ie6f87b50784bce211cf68c16cf75f79d12a8564f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * Doc: Edited example documentation.Jerome Pasion2014-07-1410-48/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | -added information about how to run the example by including a file from qtbase/doc/global -edited summary sections -added \brief. -removed image captions. Our Qt 5 CSS files don't handle them. Task-number: QTBUG-33597 Change-Id: If3293aa9d98b662f20af2af7030b0ab0fb1e8401 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
| * Return from the loop if a port name is foundDenis Shienkov2014-07-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The function devicePortName() search in the Registry the names of ports by names of registry keys. At first looks for value of a key of "PortName", and then of "PortNumber" key. Thus, the first found value shall stop search and do not try to continue. Tested on Windows 7/8 using Qt4 and then Qt5. Change-Id: I98b00ff043a3b08476fec0a57b0d36ce65fc8d63 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Update QRingBuffer by recent version from qtbaseAlex Trotsenko2014-07-281-225/+93
| | | | | | | | | | | | | | Fix some issues. Optimized for size and speed. Change-Id: Ie7b55e3f01fb088999d3a5b10d0d941934fda162 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Doc: rename the end file for serialport docsThiago Macieira2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This page has been showing up in the master Qt docs as http://qt-project.org/doc/qt-5/examples.html, which is way too generic. The current practice is to add the module: \page qt3d-examples.html \page qt3d-examples-placeholder.html \page examples-graphicsview.html \page examples-graphicsview.html \page bluetooth-examples.html \page nfc-examples.html \page qtquick-codesamples.html \page qtexamplesandtutorials.html \page examples-layouts.html \page examples-draganddrop.html \page examples-threadandconcurrent.html \page examples-sql.html \page examples-xml.html \page examples-statemachine.html \page examples-animation.html \page examples-gestures.html \page examples-activeqt.html \page qdeclarativeexamples.html \page declarative-cppextensions-reference.html \page declarative-cppextensions-qgraphicslayouts.html \page examples-serialport.html \page qtwebkitexamples-index.html Change-Id: Ib272f6380cb694ad4acfc24a248266805cef05a8 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-1010-338/+497
|\ \ | |/ | | | | Change-Id: I64b13e135d58980ea4cf7429224aa1877778cb46
| * Wrap of getting the port properties on WindowsDenis Shienkov2014-07-091-50/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | It is reasonable to wrap implementation of getting properties of port from availablePorts() to the separate functions. It is simplifies a code and improves its understanding. Tested on Windows 7/8 with the on-board, virtual com0com, USB FTDI serial ports using Qt4 and then Qt5. Change-Id: I2345fa49b3633960412715b299e068daa8fdcfd0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Do not continue waitForReadyRead() if an error occurredDenis Shienkov2014-07-091-10/+3
| | | | | | | | | | | | | | | | | | | | This patch improves workaround implemented in the previous commit d34fce4a5d12789ded107631e22cb6ef54d35eee Change-Id: I013b19b47ee343ab00f242d7ee1021b92c07d18f Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Refactor of the QSerialPortInfo for OS XDenis Shienkov2014-07-092-193/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of the qserialportinfo_mac.cpp module is a little confused and complicated. It is reasonable to re-write it using some ready wrappers of CFTypeRef, CFStringRef and others objects from the private qcore_mac_p.h file. Thus, it will allow to bypass of manual releasing of the allocated resources (using the RAII idiom where it is possible), and also to simplify a code. Tested on OS X 10.8.4 with the on-board, USB PL2303, USB FTDI, USB Android serial ports and with the USB ZTE Modem using Qt4. Change-Id: Ibbac03a17fdd41bbaf530f863e7c690a15708bd2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Make independent implementation of QSerialPortInfo for OS XDenis Shienkov2014-07-094-13/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building in OS X uses some shared code from the serialportinfo_unix.cpp module with the OS X specific code from the serialportinfo_mac.cpp module. Thus, all code of the serialportinfo_unix.cpp module, which not related with the OS X, is shielded by a macro. It adds an excessive garbage for readability in this module and also some confusion in the *.pri file. It makes sense to make implementation of the serialportinfo_mac.cpp module completely independent, that will simplify maintaining of source code. Besides are added tests which can reveal declared but not implemented methods in building, and also to check a correctness of default values at running. Tested build on OS X 10.8.4 with Qt4, an then on Android with Qt5. Change-Id: I67935b64e2b623fb8d4c14d59e1b87f1eac71c3e Reviewed-by: Bernard Pratz <guyzmo+qt@m0g.net> Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Improve error handling for the waitForXX() methods on WindowsDenis Shienkov2014-07-083-27/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The slots _q_completeXX() returns empty values, therefore the waitForXX() methods continue to work even if occurs an error from the I/O completion. Is reasonable allow to return of boolean values for the I/O completion slots. Besides, it allows avoiding indirect detection of an error, comparing of the sizes of I/O buffers before and after the operation completion. Though, for the waitForReadyRead(), for this purpose it is necessary to add additional modifications in a following patches. Tested on Windows 7/8 with the virtual com0com ports using Qt4 and then Qt5. Testing was made using of autotests and examples. Change-Id: I95a76461af4595f6658f0cad766a4fff14eb7afc Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Unify handling of errors of the overlapped I/O resultDenis Shienkov2014-07-082-46/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each q_completeXXX() slot does call of GetOverlappedResult() and differently interprets an error depending on the type of I/O operation (read, write or communication). It is more reasonable to make it in the separate method handleOverlappedResult() which returns the number of the transferred bytes or -1 in case of error. Besides, this method accepts the additional integer parameter which expresses type of overlapped operation using the existing QSerialPort::Direction enumeration. The type of the communication operation has not separate value, so is used zero value for it. Tested build on Windows 7/8 using Qt4 and then Qt5. Change-Id: I8482392d06279bc430656e50b1e4392c513885c6 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Abort waitForReadyRead() when there is an errorPeter Kümmel2014-06-301-0/+4
| | | | | | | | | | | | | | | | | | | | When in readNotification() or completeAsyncWrite() an error is emitted and the loop is not exited, this error signal will flood the eventloop. Change-Id: I77b8a4c337041258862b19a07917bef059c11cc1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Improve the serial number handling on WindowsDenis Shienkov2014-06-301-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The standard USB CDC driver (usbser.sys) does not add information of serial number to the device instance identifier of the child devices (serial ports), so our algorithm returns an empty string. But information about a serial number is stored in the device identifier of the parental node. Thus, it is necessary to get this parent identifier, using these recommendations from MSDN: http://msdn.microsoft.com/en-us/library/windows/hardware/ff549417%28v=vs.85%29.aspx For this purpose is used the set of new functions from the "Configuration Manager Functions" family. Therefore it was necessary: * Rewrite the deviceInstanceIdentifier() function. Now this function accepts one DEVINST parameter and returns the corresponding device instance identifier string. * Add the new parentDeviceInstanceNumber() function. This function accepts a DEVINST of the child device and returns a DEVINST of the parent device. Thus, the new algorithm tries to extract a serial number from the current (child) device and in case it is empty, try to extract from the parent. Tested on Windows 7/8 with the Segger JLink device (provides the CDC serial port) using Qt4 (MSVC2010) and then Qt5 (MSVC2012, MinGW). Also are checked other devices for possible regressions: * on-board serial port * com0com virtual serial port * USB FTDI serial port no regressions found. Change-Id: Ic6afc258f45aa374ec77dc0b586d479b5286359f Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Improve the ResourceError handling on WindowsDenis Shienkov2014-06-291-21/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To the ResourceError handling we generally relied on triggering of the _q_completeAsyncCommunication(), in case of ejection of an USB device from a host. But it worked with not all USB devices (for example it did not work with the ZTE modems). Even when this worked (for example with the PL2303 devices), then we got the non informative "Unknown error" of the ResourceError string representation. It is more reasonable not to do any custom checks of an event mask when triggered of the _q_completeAsyncCommunication() method. We need allow to detect an errors with means of the ReadFile/GetOverlappedResult/WaitCommEvent syscalls on an invalid device handle. An important note is that returns the different error codes for a different types of devices. For example: * For the USB ZTE and the Samsung Android USB modem returns the ERROR_ACCESS_DENIED error code. * For the FTDI and the Samsung Android Diagnostic Serial Port returns the ERROR_OPERATION_ABORTED error code. * For the USB PL2303 device returns the ERROR_BAD_COMMAND error code. Thus, there is no universal solution of this issue. Each vendor of the driver implements it own way. Therefore for each new type of the device it is necessary to add processing its error code, if we have no it yet. Tested on Windows 7/8 with the USB ZTE and the Android modems, with the USB PL2303 and the FTDI devices and with the Android diagnostic serial port using Qt4 and then Qt5, no regressions found. Task-number: QTBUG-32020 Change-Id: I61c02078ee98221ecef18a27cde3d9bae3674d70 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Improve the I/O completion errors handling on WindowsDenis Shienkov2014-06-291-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * It is necessary to ignore the NoError error code. * In case of error from GetOverlappedResult() it is necessary to stop the I/O operation by a immediate return from the function, because I/O processing does not make sense. This is consistent behavior similar to starting I/O operations. * All errors from the read completion should be interpreted as ReadError. Exception is only the critical ResourceError error which it is necessary to leave without changes. This is also consistent behavior similar to starting I/O operations. * The write completion error handling should be similar to the read completion handling. * For the communication completion we have no specific error codes. Therefore error handling shall be without modification of their error code. Also were made small cosmetic fixes to the related start I/O methods. Tested on Windows 7/8 with the on-board, the PL2303 and the virtual com0com serial ports using Qt4 and then Qt5. Testing are made by means of examples of library and also by means of auto tests, no regressions found. Change-Id: I0d08b53627431c42ab5147d4330f1aaf819b4d63 Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Correct WinRT exclusion to top-level pro fileMaurice Kalinowski2014-07-082-1/+3
| | | | | | | | | | | | | | | | | | | | | | So far only the module was excluded, but not the examples. Adopt to a style which has been approved for other modules as well by using requires. Change-Id: I8a8bbeb8c5db1bdb2e508da0988a38bbb1789986 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>