3 years agoMerge remote-tracking branch 'origin/5.3' into 5.4 v5.4.0-alpha1
Frederik Gladhorn [Thu, 28 Aug 2014 14:18:59 +0000 (16:18 +0200)]
Merge remote-tracking branch 'origin/5.3' into 5.4

Change-Id: Id742521c303261262a87db4189d369851ed2078b

3 years agoAdd missing private headers warnings
Samuel Gaist [Sat, 16 Aug 2014 21:24:32 +0000 (23:24 +0200)]
Add missing private headers warnings

Change-Id: Ia60bf0d020d98a6fda8f689d631bb8681950d15f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoFix handling of writing at using of waitForReadyRead()
Denis Shienkov [Thu, 14 Aug 2014 18:35:03 +0000 (22:35 +0400)]
Fix handling of writing at using of waitForReadyRead()

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>
3 years agoMerge remote-tracking branch 'origin/5.3' into 5.4
Frederik Gladhorn [Tue, 12 Aug 2014 11:09:58 +0000 (13:09 +0200)]
Merge remote-tracking branch 'origin/5.3' into 5.4


Change-Id: If79f2f140e72f0a499f8e61e3897848f454a5042

3 years agoFix compilation of apps with QT_DISABLE_DEPRECATED_BEFORE=0x050300
Marcel Krems [Mon, 11 Aug 2014 14:51:12 +0000 (16:51 +0200)]
Fix compilation of apps with QT_DISABLE_DEPRECATED_BEFORE=0x050300

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>
3 years agoMove the synchronous loopback test from benchmarks to auto tests
Denis Shienkov [Sat, 26 Jul 2014 13:55:43 +0000 (17:55 +0400)]
Move the synchronous loopback test from benchmarks to auto tests

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>
3 years agoMake the QSerialPort::flush() non-blocking
Denis Shienkov [Sat, 19 Jul 2014 15:53:16 +0000 (19:53 +0400)]
Make the QSerialPort::flush() non-blocking

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>
3 years agoPass a length of string to QString::fromWCharArray
Denis Shienkov [Thu, 10 Jul 2014 12:46:28 +0000 (16:46 +0400)]
Pass a length of string to QString::fromWCharArray

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>
3 years agoFix leak of a descriptor after unsuccessful opening
Denis Shienkov [Fri, 25 Jul 2014 08:14:54 +0000 (12:14 +0400)]
Fix leak of a descriptor after unsuccessful opening

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>
3 years agoFix events handling in waitForBytesWritten() method on Windows
Denis Shienkov [Fri, 25 Jul 2014 21:31:28 +0000 (01:31 +0400)]
Fix events handling in waitForBytesWritten() method on Windows

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

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>
3 years agoUpdate QRingBuffer by recent version from qtbase
Alex Trotsenko [Sat, 26 Jul 2014 12:19:33 +0000 (15:19 +0300)]
Update QRingBuffer by recent version from qtbase

Fix some issues. Optimized for size and speed.

Change-Id: Ie7b55e3f01fb088999d3a5b10d0d941934fda162
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoAdd the synchronous loopback data verification test
Denis Shienkov [Fri, 11 Jul 2014 12:32:28 +0000 (16:32 +0400)]
Add the synchronous loopback data verification test

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
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>
3 years agoDoc: rename the end file for serialport docs
Thiago Macieira [Thu, 24 Jul 2014 17:59:36 +0000 (10:59 -0700)]
Doc: rename the end file for serialport docs

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>
3 years agoDoc: Edited example documentation.
Jerome Pasion [Thu, 10 Jul 2014 13:15:23 +0000 (15:15 +0200)]
Doc: Edited example documentation.

-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>
3 years agoReturn from the loop if a port name is found
Denis Shienkov [Thu, 10 Jul 2014 07:40:18 +0000 (11:40 +0400)]
Return from the loop if a port name is found

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>
3 years agoMerge remote-tracking branch 'origin/5.3' into dev
Frederik Gladhorn [Thu, 10 Jul 2014 08:16:01 +0000 (10:16 +0200)]
Merge remote-tracking branch 'origin/5.3' into dev

Change-Id: I64b13e135d58980ea4cf7429224aa1877778cb46

3 years agoWrap of getting the port properties on Windows
Denis Shienkov [Wed, 2 Jul 2014 12:52:09 +0000 (16:52 +0400)]
Wrap of getting the port properties on Windows

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>
3 years agoDo not continue waitForReadyRead() if an error occurred
Denis Shienkov [Wed, 2 Jul 2014 23:23:17 +0000 (23:23 +0000)]
Do not continue waitForReadyRead() if an error occurred

This patch improves workaround implemented in the previous commit

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>
3 years agoRefactor of the QSerialPortInfo for OS X
Denis Shienkov [Wed, 2 Jul 2014 08:28:11 +0000 (12:28 +0400)]
Refactor of the QSerialPortInfo for OS X

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>
3 years agoMake independent implementation of QSerialPortInfo for OS X
Denis Shienkov [Tue, 1 Jul 2014 14:57:59 +0000 (18:57 +0400)]
Make independent implementation of QSerialPortInfo for OS X

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

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>
3 years agoCorrect WinRT exclusion to top-level pro file
Maurice Kalinowski [Mon, 7 Jul 2014 09:58:34 +0000 (11:58 +0200)]
Correct WinRT exclusion to top-level pro file

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>
3 years agoImprove error handling for the waitForXX() methods on Windows
Denis Shienkov [Mon, 30 Jun 2014 14:38:04 +0000 (18:38 +0400)]
Improve error handling for the waitForXX() methods on Windows

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>
3 years agoUnify handling of errors of the overlapped I/O result
Denis Shienkov [Mon, 30 Jun 2014 09:35:50 +0000 (13:35 +0400)]
Unify handling of errors of the overlapped I/O result

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>
3 years agoDoc: Removing url variable from qdocconf file.
Jerome Pasion [Fri, 4 Jul 2014 12:48:49 +0000 (14:48 +0200)]
Doc: Removing url variable from qdocconf file.

-url inherited from the url variable set in qtbase/doc/global

Change-Id: I16bde5a3c34540c448a10903e4efde69a9d3585c
Reviewed-by: Martin Smith <martin.smith@digia.com>
3 years agoAbort waitForReadyRead() when there is an error
Peter Kümmel [Mon, 16 Jun 2014 18:59:22 +0000 (20:59 +0200)]
Abort waitForReadyRead() when there is an error

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>
3 years agoImprove the serial number handling on Windows
Denis Shienkov [Tue, 10 Jun 2014 13:49:02 +0000 (17:49 +0400)]
Improve the serial number handling on Windows

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:


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>
3 years agoImprove the ResourceError handling on Windows
Denis Shienkov [Sat, 7 Jun 2014 11:18:15 +0000 (15:18 +0400)]
Improve the ResourceError handling on Windows

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

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

* For the FTDI and the Samsung Android Diagnostic Serial Port returns

* 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>
3 years agoImprove the I/O completion errors handling on Windows
Denis Shienkov [Sat, 7 Jun 2014 10:04:12 +0000 (14:04 +0400)]
Improve the I/O completion errors handling on Windows

* 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

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

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>
3 years agoMerge remote-tracking branch 'origin/5.3' into dev
Frederik Gladhorn [Thu, 26 Jun 2014 15:27:19 +0000 (17:27 +0200)]
Merge remote-tracking branch 'origin/5.3' into dev


Change-Id: Ib1727ebdc69ab673d782c39ba9f1b5f51c192d4b

3 years agoBump version
Oswald Buddenhagen [Tue, 17 Jun 2014 22:36:41 +0000 (00:36 +0200)]
Bump version

Change-Id: I50ea328c903f3ba0c78f9570b6b6b892bb38f976

3 years agoFix mixed up vendor and product identifiers v5.3.1
Oleg Shparber [Fri, 13 Jun 2014 21:53:47 +0000 (14:53 -0700)]
Fix mixed up vendor and product identifiers

Caused by I1a66164c.

Change-Id: I78973a509ff91a1302f435b1a23ecce432e56dd4
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoMerge remote-tracking branch 'origin/5.3' into dev
Sergio Ahumada [Sat, 14 Jun 2014 19:58:29 +0000 (21:58 +0200)]
Merge remote-tracking branch 'origin/5.3' into dev


Change-Id: Ib9551beb8dc9d2d9c9ff50b7fe4702287f1854cd

3 years agoRemove the exception notifier handling for *nix
Denis Shienkov [Sat, 7 Jun 2014 23:22:19 +0000 (23:22 +0000)]
Remove the exception notifier handling for *nix

The exception notifier does not do any useful operation while processing
I/O but only complicates error handling. It has been thoughtlessly
introduced at beginning in hope that in the future it can it is useful,
but the practice showed that it not so.

Problem is that in case of ejection of an open USB device from a host
there is the infinite triggering of the exception notifier that leads to
program hangup. We could stop an exception notifier in this case, but it
not rationally because after the exception notifier is triggered the read
notifier which also enters the infinite loop.

Thus the read notifier anyway duplicates the exception notifier, as for
functionality and as for an error code. Therefore more rationally to
completely remove the exception notifier. So in case of the ResourceError
we need just to stop of the read notifier, because it is a critical
error. Then an user will be notified on the ResourceError appearance and
must to close the device himself.

Though work was checked only on Linux, but we can do not worry, and to
refuse from this notifier in MacOSX also. Because anyway in MacOSX this
type of notifier is not supported, at least from the Qt 5.1 and above:


Besides in documentation on QSocketNotifier is recommended do not
use the Exception mode:


Tested on ArchLinux 64 bit with the USB PL2303 device, ZTE modem,
Android serial port using Qt4 and then Qt5.

Task-number: QTBUG-36727
Task-number: QTBUG-35829
Change-Id: I4ea6db2a1c7f10c096d57817c00edefc4f0595ff
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoMerge remote-tracking branch 'origin/5.3.0' into 5.3
Oswald Buddenhagen [Thu, 12 Jun 2014 08:35:31 +0000 (10:35 +0200)]
Merge remote-tracking branch 'origin/5.3.0' into 5.3

Manually adjusted:
    to remove isCustomBaudRateSupported

Change-Id: I22480b57d8c1b91ea7ea4a1da4ba3060e1a5f93f

3 years agoMerge remote-tracking branch 'origin/stable' into 5.3
Sergio Ahumada [Wed, 11 Jun 2014 08:06:39 +0000 (10:06 +0200)]
Merge remote-tracking branch 'origin/stable' into 5.3

Change-Id: I65f7cd2fdeced526c8bd7dc5bc4081e7687e7310

3 years agouclibc sets ENOENT when one tries to open a non-existing device
Peter Kümmel [Sat, 7 Jun 2014 20:36:58 +0000 (22:36 +0200)]
uclibc sets ENOENT when one tries to open a non-existing device

Change-Id: Ia5bcc1230af988f06923447f8cb1de5a8d585518
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoRefactor the availablePortsByUdev() in favor to readability stable
Denis Shienkov [Tue, 3 Jun 2014 18:06:31 +0000 (22:06 +0400)]
Refactor the availablePortsByUdev() in favor to readability

Implementation of the availablePortsByUdev() function is a little
complicated by excess "if/else" conditions and also too long lines,
that worsens readability.

It is reasonable to make the following:

* To get rid of the big "if {...}" blocks in favor to immediate return
from function in case of an error. It will allow to reduce a quantity
of lines and will shift code alignment to the left.

* To split declaration of some long variables and functions into separate
lines, with length at least up to 80~100 characters.

* To drop of the 'struct' keywords and the '::' global namespace
operator for variables.

Tested on ArchLinux 64 bit with the on-board and PL2303 serial ports
using Qt4 and then Qt5.

Tested build on Android x86 using Qt5.

Change-Id: Iddc2a9511230e56e4a9d01a4c22af7b2eaeae60c
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoUse QScopedPointer (RAII) to do not care of the udev resources
Denis Shienkov [Mon, 2 Jun 2014 23:38:37 +0000 (23:38 +0000)]
Use QScopedPointer (RAII) to do not care of the udev resources

It is a good idea to get rid from the manually releasing of the
allocated udev resources.

Tested on ArchLinux 64 bit with on-board and PL2303 serial ports using
Qt4 and then Qt5.

Change-Id: Ib25e100bea37ad3cc0bee015b7de6d4de762f2cc
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoSimplify of the availablePortsByUdev()
Denis Shienkov [Sun, 1 Jun 2014 14:48:59 +0000 (14:48 +0000)]
Simplify of the availablePortsByUdev()

There is no sense to use udev_device_get_subsystem() for comparing with
the predetermined names of subsystems (like "pnp", "usb" and so on).
This idea was preliminary and required further revising after
accumulation of some statistic.

The main ideas in favor of refactoring are given below:

* It seems that reasonable to use the "ID_MODEL", "ID_VENDOR" and others
identifiers to query of properties for all types of serial ports. We
lose nothing, because in the worst case the getUdevPropertyValue()
function will simply return an empty string, as before.

* Earlier we excluded from the list all ports which have a subsystem
with the "platform" name. Practice showed that for these devices is used
the serial8250 driver. Therefore it is reasonable to exclude this type
of devices by the name of drivers instead of by the name of subsystems.

Also are made related changes:

* Is added the resolving of chars for the new udev_device_get_driver()

* The functions of getting properties are wrapped for reduction of
length up to 100 characters.

Tested on ArchLinux 64-bit with the on-board, PL2303 serial devices
using Qt4 and then Qt5.

Tested build on Android x86 using Qt5.

Change-Id: I1a66164ca1893180e1ed97524cff98b4a933a63b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoFix waitForReadyRead() on windows
Denis Shienkov [Tue, 27 May 2014 15:34:06 +0000 (19:34 +0400)]
Fix waitForReadyRead() on windows

The commit 2360c401ae2012ed1b5a2b470a088cbbdb0d7f27 introduced an
regression into waitForReadyRead(). Before this commit each read
transaction was started again until the zero number of bytes will
returns from FIFO. When FIFO is empty, all data has been read, and
only then the waitForReadyRead() return true. I.e. condition
"qint64(readBuffer.size()) != currentReadBufferSize" does not mean
that reading is finished.

But after that commit this condition is incorrect, because now each
read operation started once and can not return zero bytes (in case
the number of read bytes less than ReadChunkSize). Thus it led to
returning of TimeoutError error.

Now, this issue has been fixed. Also is added the set of auto-tests
to testing of the waitForReadyRead() method.

Tested on Windows 7/8 using Qt5 and then Qt4.

Task-number: QTBUG-39314
Change-Id: I8abbf986c2a1cc77af634ddbc1747fb46f416a39
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoImprove the setStandardBaudRate() on Linux
Denis Shienkov [Sat, 31 May 2014 16:51:45 +0000 (20:51 +0400)]
Improve the setStandardBaudRate() on Linux

* The ASYNC_SPD_CUST flag shall be cleared only if it was earlier
set; otherwise it is not necessary to touch of the serial struct.

* Seems, that is more reasonable to return an error code when
writing back of the serial struct is failed. In this case it is
an error, because we know that serial struct is supported, since
we got it successfully earlier.

Tested build on Archlinux 64 bit using Qt4 and then Qt5.
Tested build on Android x86 using Qt5.

Change-Id: I54ca4772dc770dabac5e3555e6cb42ecc23255a4
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoFix the error message for TimeoutError on Windows
Denis Shienkov [Thu, 29 May 2014 13:13:12 +0000 (17:13 +0400)]
Fix the error message for TimeoutError on Windows

At timeouts from the waitForX() methods are set a wrong
error string. Thing in that the WAIT_TIMEOUT constant is
not a system error, therefore call of GetLastError()
returns a code of a system error which was set by someone

Thus, it is necessary to extract text representation of
an error directly from the WAIT_TIMEOUT constant without
relying on GetLastError().

Tested on Windows 7/8 using Qt4 and then Qt5.

Change-Id: Id7fdc71c1b64c39eed658148bb1b66ac8806f119
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Dyami Caliri <dyami@dragonframe.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoDon't emit error in destructor of QSerialPort.
Samuel Bryner [Fri, 30 May 2014 13:36:43 +0000 (15:36 +0200)]
Don't emit error in destructor of QSerialPort.

QSerialPort::~QSerialPort() calls close() which emits an error if the
port is already closed. This error signal may then call slots of
already (partially) deleted objects.

Task-number: QTBUG-39369
Change-Id: I28bf94564ae120619054c6920779da974dccdad6
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoMove out processing of ResoureError from processIoErrors()
Denis Shienkov [Mon, 26 May 2014 14:55:01 +0000 (18:55 +0400)]
Move out processing of ResoureError from processIoErrors()

Handling of the ResourceError is moved directly to
_q_completeAsyncCommunication() method.


* The processIoErrors() should handle only the
EV_ERR event.

* The handling of ResourceError in the processIoErrors()
it is the old heritage when the event processing logic
was into the notifiers.

Also the method processIoErrors() is renamed in favor to
handleLineStatusErrors() for readability, according to
documentation on EV_ERR mask:

Tested build on Windows 7/8 using Qt4 and then Qt5.

Change-Id: I6dc331933155f1e182b21f40885e47d574c4ed9f
Reviewed-by: Dyami Caliri <dyami@dragonframe.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoRefactor unix setBaudRate() error handling
Rafael Roquetto [Wed, 14 May 2014 12:16:25 +0000 (09:16 -0300)]
Refactor unix setBaudRate() error handling

Return QSerialPort::SerialPortError instead of bool

Change-Id: I79d731c1a0178ef0238495d7e9bb3e1b866e82c0
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoDisable automatic header precompilation for QtSerialPort
Thiago Macieira [Sat, 1 Mar 2014 19:10:47 +0000 (11:10 -0800)]
Disable automatic header precompilation for QtSerialPort

There are two source files for this module only. Adding a header
precompilation is more expensive than the benefit.

Change-Id: I27f0756693ec655f56a781f94d14840ce48f71b4
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoAdd test for the waitForBytesWritten() method
Denis Shienkov [Wed, 16 Apr 2014 12:30:15 +0000 (16:30 +0400)]
Add test for the waitForBytesWritten() method

Change-Id: I4a6767196d205cf1f0715edfb9ea117a2d7fa5c9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoFix compilation of qserialport auto-test with Qt4
Denis Shienkov [Sun, 18 May 2014 16:13:47 +0000 (16:13 +0000)]
Fix compilation of qserialport auto-test with Qt4

1. The QCOMPARE macro can not make type cast between "int" and
"qint64", though on qt5 there are no problems.

2. The QSKIP macro should accept two input parameters.

Tested build on Lixux 64bit and Windows with Qt4 and then Qt5.

Change-Id: I1f8497201e8d704098faea789bc61829f0d2f9e4
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoAdd support for PCI vendor/device information
Sergey Belyashov [Thu, 15 May 2014 07:11:56 +0000 (11:11 +0400)]
Add support for PCI vendor/device information

Tested on Linux x86_64 with Qt 5.1.1

Change-Id: Ibea1204ece921c2c18ee37992380fbc33897be8d
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoInitialize dataTerminalReady and requestToSend.
Dyami Caliri [Mon, 19 May 2014 23:59:29 +0000 (16:59 -0700)]
Initialize dataTerminalReady and requestToSend.

QSP::open should read values of DTR/RTS after a successful open,
not try to write them. The user should not expect to set DTR/RTS
before opening the port (unlike the other settings).

Tested on Mac OS X 10.8.5.

Task-number: QTBUG-38640
Change-Id: Iffea464f412c6972aa26a408ba01e304fa813c76
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoInspect lock file to determine busy state.
Dyami Caliri [Wed, 30 Apr 2014 16:36:53 +0000 (09:36 -0700)]
Inspect lock file to determine busy state.

QSPI was relying on QLockFile.isLocked() to determine if the port
was in use. This was due to a misunderstanding of the QLockFile
class design.

Ideally the code in QSPI.isBusy() should be moved into a new method,
QLockFile.available(), since it contains implementation details of
that class.

Note that isBusy() is for information purposes only, since checking
for a lock without obtaining it is always racy.

Change-Id: I675bd4033e4228e6bf864bf2e7a00a2520ccc50e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoFix compilation of qserialport auto-test with Qt4
Denis Shienkov [Sun, 18 May 2014 16:13:47 +0000 (16:13 +0000)]
Fix compilation of qserialport auto-test with Qt4

In qt4 the macro QCOMPARE can not make type cast between "int" and
"qint64", though on qt5 there are no problems.

Tested build on Lixux 64bit with Qt4 and then Qt5.

Change-Id: I258f8ee4d26b65cc81720d66714ef69df23e7266
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoMove the WinCE implementation into separate module
Denis Shienkov [Mon, 5 May 2014 13:43:54 +0000 (17:43 +0400)]
Move the WinCE implementation into separate module

WinCE implementation was mixed a common code with the Win32
implementation that caused some problems with maintenance.

More correct decision is moving a common code which was used
in *win.cpp into *wince.cpp module without modifications.

Now the Win32 and the WinCE implementation are independent
from each other.

Tested build with Qt5 on "win32-msvc2012" and then with Qt4
on "wincewm50pocket-msvc2008" configurations.

Change-Id: I63f687468beffa9a75b534a4fbe536b854b12210
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoFix the waitForBytesWritten() behavior on Windows
Denis Shienkov [Tue, 15 Apr 2014 15:11:43 +0000 (19:11 +0400)]
Fix the waitForBytesWritten() behavior on Windows

The slot _q_completeAsyncWrite(), which is used inside of
waitForBytesWritten(), returns void. To define the status
of write completion method was used the last error code,
where any value are not equal to NoError was interpreted
as an error.

But this behavior was incorrect because the error code
number could be set by any other previous I/O operation
and remained not cleared. Therefore waitForBytesWritten()
always returns false.

A good solution it is to compare size of the writeBuffer
after completion of each write operation with zero, because
the buffer should be empty.

Tested on Windows 8 with the on-board and the USB serial
ports and the cwritersync example using Qt5.

Task-number: QTBUG-36758
Change-Id: I2cf6f9e08056d2e237211b19cff59990aac53bc1
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoUse QTimer to defer starting of writing on Windows
Denis Shienkov [Tue, 15 Apr 2014 14:50:53 +0000 (18:50 +0400)]
Use QTimer to defer starting of writing on Windows

The Win32 API has not possibility to do same behavior as on *nix to defer
a write operation to next event-loop. In *nix implementation enabling of
the write SocketNotifier guarantees that write operation will begin on the
following cycle of event-loop in case the TxFIFO of the driver is empty.

It give an feature of deferred data transfer where is possible to use chain
of the QSerialPort::write() methods which just accumulate data in
writeBuffer. Also it gives the chance to simple implement of the
waitForBytesWrite() method.

But in Windows implementation the first call of the QSerialPort::write()
leads to startup of data transfer. And the subsequent calls of this
method simply accumulate data while the previous operation won't completed.

It leads to a payload data are transferred by chunks and to increase of
loading of the write notifier. Also it complicates implementation of the
waitForBytesWritten() method which works not in compliance with

The decision is use of additional QTimer with a zero interval which
launches data transfer on the following event-loop cycle.

Tested on Windows 8 using the virtual com0com serial ports and set
of the cwriter(a)sync examples with use Qt5.

Change-Id: Iaea404198e440f6cb191f168561c977d18e9f4ca
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoReturn after an error of the async write operation
Denis Shienkov [Sat, 12 Apr 2014 13:40:03 +0000 (17:40 +0400)]
Return after an error of the async write operation

Tested on Windows 8 using the on-board and the USB serial
ports and using Qt4 and Qt5.

Change-Id: Idd25b81c9b6b2cd0b94e83fe30e6e7dad4dddfd6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoQNX: Enable custom baud rate
Rafael Roquetto [Fri, 25 Apr 2014 22:30:16 +0000 (19:30 -0300)]
QNX: Enable custom baud rate

Change-Id: Iec4124886514c5bdeae1cf00e3b2e9432a2c75ee
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoRefactor QSerialPortPrivate::setBaudRate()
Rafael Roquetto [Fri, 25 Apr 2014 22:20:56 +0000 (19:20 -0300)]
Refactor QSerialPortPrivate::setBaudRate()

Split platform specific functions into their own setCustomBaudRate() methods to
improve readability.

As a side-effect, remove isCustomBaudRateSupported flag.

Change-Id: Ia26d5472219756fbf186c78aa049bba72966d7b5
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoFix setting custom baud rates under Linux v5.3.0
Sergey Belyashov [Tue, 13 May 2014 08:40:47 +0000 (12:40 +0400)]
Fix setting custom baud rates under Linux

This regression was caused by 7c737e0edcb93585856c65890ef34e5c5a28ee6b.
The initialization of the (current) serial port info was removed in that commit.

Tested on Linux x86_64 with Qt 5.1.1 and 4.8.6.

Task-number: QTBUG-38961
Change-Id: Idd3c5dc7eb37093848f33387563ff14567ac54fe
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
3 years agoUse Q_NULLPTR for null pointer purposes with NULL fallback for Qt 4
Laszlo Papp [Fri, 9 May 2014 16:10:40 +0000 (17:10 +0100)]
Use Q_NULLPTR for null pointer purposes with NULL fallback for Qt 4

Change-Id: I5422376a26111f7c8e084791a059215238a16868
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Steven Ceuppens <steven.ceuppens@icloud.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoMerge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging...
Frederik Gladhorn [Tue, 13 May 2014 13:26:34 +0000 (15:26 +0200)]
Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable

3 years agoAdd a unit test to verify flush()
Denis Shienkov [Sat, 19 Apr 2014 16:07:21 +0000 (16:07 +0000)]
Add a unit test to verify flush()

On Windows a test will be skipped since flush() does not work there

Change-Id: Ibda38401aff5f1c50644c6d61f9802217146a4fb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoMerge remote-tracking branch 'origin/release' into stable
Frederik Gladhorn [Thu, 8 May 2014 16:32:01 +0000 (18:32 +0200)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: I26db36a638685472296001d9982a157b8a6616b5

3 years agoFix the default constructor test case
Denis Shienkov [Tue, 22 Apr 2014 14:05:25 +0000 (18:05 +0400)]
Fix the default constructor test case

Commit 7c737e0edcb93585856c65890ef34e5c5a28ee6b introduced
this regression by changing the default baud rate from 0 to 9600.

Change-Id: If20315eb53c3416646541dda82add0f4fc12d4a3
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoEnsure both input and output baud rates are set. v5.3.0-rc1
Dyami Caliri [Thu, 1 May 2014 21:22:00 +0000 (14:22 -0700)]
Ensure both input and output baud rates are set.

QSerialPortPrivate::setBaudRate() wasn't trying to set the output
baud rate for the port after successfully setting the input baud rate.

Also, some devices (such as FTDI chips) on Mac don't respond
properly if you call updateTermios() with mismatched baud rates,
even if you later set them to be the same.

Change-Id: I507fe10cba221bb4e43ded650dc44cc974de2414
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoMerge remote-tracking branch 'origin/release' into stable
Frederik Gladhorn [Thu, 1 May 2014 10:47:41 +0000 (12:47 +0200)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Idadda494181f643ef1b7fc2b2fb16dc5d215e83a

3 years agoFix the serial number display in the terminal example
Denis Shienkov [Thu, 17 Apr 2014 12:35:49 +0000 (16:35 +0400)]
Fix the serial number display in the terminal example

The display code was left out in commit

Tested using FTDI device on Windows 8 with Qt5 and
then on Windows 7 with Qt4.

Change-Id: I9f665b2826ba03877346b25a569ca89b6a3dc4af
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoEnable QtSerialPort on QNX
Rafael Roquetto [Fri, 18 Apr 2014 18:52:25 +0000 (15:52 -0300)]
Enable QtSerialPort on QNX

On QNX, the combination (IHFLOW | OHFLOW) is equivalent to the CRTSCTS flag.
Only /dev/ser* ports can be enumerated.

Tested on SVTronics UEVM5432 Omap5 board with QNX 6.6

Change-Id: I64b149258a525835e63f231b5291fa86637e3d2a
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoMark the settingsRestoredOnClose property deprecated since 5.3
Denis Shienkov [Wed, 23 Apr 2014 07:50:09 +0000 (11:50 +0400)]
Mark the settingsRestoredOnClose property deprecated since 5.3

Commit bc0a65234440b6a08d862840a48ebae0d3421fbc incorrectly
marked this api as deprecated since 5.2

Change-Id: Ia4ea3d7a394376a16511a3bf2ad8ba6e051bc24d
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
3 years agoMerge remote-tracking branch 'origin/release' into stable
Jani Heikkinen [Wed, 23 Apr 2014 09:46:34 +0000 (12:46 +0300)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Ibbec2e6f136f9d7fa0362944d5f98a40814cd202

3 years agoFix the flush regression on Unix
Kijam Lopez [Tue, 15 Apr 2014 08:16:15 +0000 (03:46 -0430)]
Fix the flush regression on Unix

Currently, flushing is not flushing the buffer to the device because
it is calling the wrong function.

Before flush() is invoked startAsyncWrite, but this did not flush the buffer
when it was not empty. The only possible way to fix this is by invoking the
function completeAsyncWrite, it first checks for pending information in the
buffer for sending and then invokes startAsyncWrite if necessary.

The following change caused the regression: 21f5049

Test Environment: Qt 5.3.0-beta1 and Qt 4.8.2.
S.O.: 3.12.6-2kali1 i686 GNU/Linux.
Fiscal Machine: SRP350 Bixolon.
USB Adapter Serial Port: CH341
Task-number: QTBUG-38339
Change-Id: I5159b48f073d537a396b65484fcc2c3d37e4908c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoBump MODULE_VERSION to 5.3.1
Sergio Ahumada [Thu, 17 Apr 2014 15:29:17 +0000 (17:29 +0200)]
Bump MODULE_VERSION to 5.3.1

Change-Id: I46e1e634142ec2b34041ca876ca12bb10b52a9b6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
3 years agoDoc: Set example install path in documentation config
Topi Reinio [Tue, 15 Apr 2014 11:34:33 +0000 (13:34 +0200)]
Doc: Set example install path in documentation config

Correct example install path is required for the example
manifest file to contain valid paths to the .pro files.

Task-number: QTBUG-38359
Change-Id: Ibfe98ed4f3402f2e1534b578d0caecf3676a6f36
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoDo not start async read again if FIFO has no more data
Denis Shienkov [Mon, 10 Feb 2014 14:21:47 +0000 (18:21 +0400)]
Do not start async read again if FIFO has no more data

The FIFO reading currently happens in chunks. The current
operation starts reading again even if there is no byte
available instead of waiting. This increases the overhead
of the library needlessly.

The correct thing to do is to wait instead of start reading
again when the last chunk is already handled.

Tested on Windows 8 using the on-board and the USB serial
ports and using Qt4 and Qt5.

Change-Id: I1926b853d1666b273d6d67b4a3f40261f1ed54ff
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Fri, 11 Apr 2014 12:16:02 +0000 (14:16 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I3ebef8a82de36532e5f56da334f1e391b32430d2

3 years agoDon't remove -framework on Mac.
Marcel Krems [Wed, 2 Apr 2014 16:07:55 +0000 (18:07 +0200)]
Don't remove -framework on Mac.

"LIBS -= -framework QtSerialPort" removes all occurrences of -framework
which breaks the build if you use a framework together with QtSerialPort.
To avoid this we skip the call to qtAddLibrary under Mac.

Task-number: QTBUG-37989
Change-Id: I53b71ad433e93c8c59d17c526ef2424db47bca15
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoRemove the noisy comments from the terminal example
Laszlo Papp [Sun, 30 Mar 2014 11:13:48 +0000 (12:13 +0100)]
Remove the noisy comments from the terminal example

If anything, this should be made clear in a different way, like proper variable
names, inline convenience functions for naming, example documentation extension,
and so on.

This is also consistent with the other examples not using "water can" comments.

However, these comments mostly add noise to the code without much benefit as far
as I can tell.

Change-Id: I9c4121d91ca2671d44c08cf986232422f136a785
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
3 years agoMerge remote-tracking branch 'origin/stable' into dev
Iikka Eklund [Tue, 1 Apr 2014 08:47:15 +0000 (11:47 +0300)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: Ie29d66293c92fb69f2b2ca257dd8c1b411b139ec

3 years agoSkip qt4support when generating documentation.
Friedemann Kleint [Tue, 25 Mar 2014 08:04:39 +0000 (09:04 +0100)]
Skip qt4support when generating documentation.

Fix warnings:
qtserialport/src/serialport/qt4support/src/qlockfile.cpp:57: warning: Overrides a previous doc
qtbase/src/corelib/io/qlockfile.h:53: warning: (The previous doc is here)

Change-Id: I75c93fd6dbd9bebfa506b2f606aeb8511a892305
Reviewed-by: Laszlo Papp <lpapp@kde.org>
3 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Mon, 24 Mar 2014 15:08:16 +0000 (16:08 +0100)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I734425a9f778b730616e117ae454300e0ce23aee

4 years agoUse QScopedPointer (RAII) for avoiding the memory leak for udev v5.3.0-beta1
Laszlo Papp [Mon, 17 Mar 2014 21:07:55 +0000 (21:07 +0000)]
Use QScopedPointer (RAII) for avoiding the memory leak for udev

Task-number: QTBUG-37578

Change-Id: I9e9146a1f7339a88c63cb320a47f63f069a6120e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoSet the port settings before open in the examples
Laszlo Papp [Fri, 7 Mar 2014 02:39:47 +0000 (02:39 +0000)]
Set the port settings before open in the examples

Change-Id: I946a3f1d3a64a9b8c0d901347aa8ff5959ebc601
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoMerge remote-tracking branch 'origin/stable' into dev
Sergio Ahumada [Tue, 11 Mar 2014 08:27:18 +0000 (09:27 +0100)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: Id1ab0adc63aa025dc5ed8a05b313f2f295c91c77

4 years agoFixed info update for FTDI devices on Android
Luke Andrew [Tue, 4 Mar 2014 21:40:35 +0000 (14:40 -0700)]
Fixed info update for FTDI devices on Android

Added check for Q_OS_ANDROID.  If connected to Android, look for a valid TTY_USB id.

Task-number: QTBUG-36296
Change-Id: Ic99b0ddd7afc6621e795e2f6cf2952cae6634fb0
Reviewed-by: Luke Andrew <codereview@lukeandrew.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoObsolete the "settings restore on close" API
Laszlo Papp [Fri, 7 Mar 2014 03:11:36 +0000 (03:11 +0000)]
Obsolete the "settings restore on close" API

Now that the settings detection is removed, it would be better to make this API
deprecate because it does not make much sense anymore. It was a bad idea to add
this, but we cannot remove it for now, hence the obsoletion.

Change-Id: I5e02959cb54281995b911ff0f64bd2fa36b80060
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoSwap the open and configure error reporting in the terminal example
Laszlo Papp [Fri, 7 Mar 2014 02:48:36 +0000 (02:48 +0000)]
Swap the open and configure error reporting in the terminal example

It seems they were accidentally misplaced, and it was not caught by anyone while
testing and using this example. Although, I have seen users doing this mistake
on Stack Overflow, so I was wondering where they would get the idea from. It is
possible they have done such mistakes due to a copy/paste operation from this
old example.

Change-Id: Iaa25ae47c5f161856930801611a3dc7ff0aa3b0a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoMake it possible to set the port values before opening
Laszlo Papp [Sun, 2 Mar 2014 14:35:37 +0000 (14:35 +0000)]
Make it possible to set the port values before opening

This patch also changes the behavior of the open method. We do not use port
detection anymore for good. It has been a broken concept, and it is very
unlikely that anyone has ever relied on it. If anyone had done that, they would
be in trouble anyway, getting noisy warnings needlessly and all that.

The other option was also considered to keep this behavior optionally as the
default, but that would complicate the API too much without not much gain.

The default port settings are now also the sane 9600,8,N,1, and no flow control.
Also please note that the serial port is closed automatically in the open method
if any of the settings fails.

Several subsequent changes can follow this one, namely:

* Changing the examples to show this usage.

* Add a QSerialPortSettings data structure as it seems to be common currently in
client codes.

* Add the QML plugin with only thin wrapper declarative classes and all that.

* Deprecate the restore settings on close API.

* Remove the internal current and restored data representations.

* Add further error values to the API for the fine tuning of the error reporting
when there are setting errors on open.

* Add proper test coverage.

In short, this change opens the gate up for many interesting subsequent changes
that would be useful for the module overall.

In general, this change makes it possible to reach the feature parity with
QextSerialPort so that we are not much worse anymore. We could do the same that
QextSerialPort could do many years ago, already.

Task-number: QTBUG-33774

Change-Id: I8527672f8b0bb2581fa7054ccffda66ab7fa4a85
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse early return on error in the open method
Laszlo Papp [Tue, 4 Mar 2014 06:47:33 +0000 (06:47 +0000)]
Use early return on error in the open method

It was done like that for consistency with QFile, probably, but it is not a good
style in Qt overall.

Change-Id: I5233a7f0f03cab947b061520fe2ec64585632920
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoAdd API for querying the serial number
Laszlo Papp [Sat, 27 Jul 2013 15:57:08 +0000 (16:57 +0100)]
Add API for querying the serial number

Thanks go to Massimo Callegari for the initial patch and the request to remind
us again. Thanks also go to Denis and Sergey for working on the windows serial
number parser.

Task-number: QTBUG-31981
Change-Id: I60d882280f481eb99d275e0a9c81da50292b1c61
Reviewed-by: Massimo Callegari <massimocallegari@yahoo.it>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoDo not use the deprecated method in the "See also" section
Laszlo Papp [Sat, 1 Mar 2014 16:04:49 +0000 (16:04 +0000)]
Do not use the deprecated method in the "See also" section

Change-Id: I2a73e9dc19e93c678d803d4aaf2e03c19e7613fb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoRename the flow to flowControl for consistency
Laszlo Papp [Sat, 1 Mar 2014 15:58:26 +0000 (15:58 +0000)]
Rename the flow to flowControl for consistency

Change-Id: Ida3c4ff049f21bd96fd64b41c66787b3961ada5e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Mon, 24 Feb 2014 19:04:35 +0000 (20:04 +0100)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I6b339cfcfcc8cebab09991b634076bc854229e28

4 years agoAdd the minimal set of the base auto tests v5.3.0-alpha1
Denis Shienkov [Thu, 23 Jan 2014 15:17:52 +0000 (19:17 +0400)]
Add the minimal set of the base auto tests

Added two types of tests: the constructing tests and the opening tests.

The construction tests are checking of the getters to return of default values.
Also are checking a correctness work of the constructor of class with different
types of a port name.

The opening tests are checking the open() method with the valid/invalid open
modes and with the valid/invalid port names. The results are compared with the
expected behavior (with the error codes and the return values).

Change-Id: I503adf629cf613844bf9b96d8704ff017ea5fcdb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
4 years agouse private linkage where appropriate
Oswald Buddenhagen [Mon, 25 Nov 2013 11:14:44 +0000 (12:14 +0100)]
use private linkage where appropriate

Task-number: QTBUG-35781
Change-Id: I24b5ec010525da2c1f1be63996193ac31dcd3808
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoBump module version to 5.4.0
Thiago Macieira [Wed, 19 Feb 2014 20:20:48 +0000 (12:20 -0800)]
Bump module version to 5.4.0

Change-Id: I6bf5c8d40b53a25f761c0638d7a08c20557ecead
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Mon, 17 Feb 2014 10:35:40 +0000 (11:35 +0100)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: Ifff35473fe07ee5d94f9fb4f0125ee125c109c76

4 years agoSet error if the file buffer flushing fails on Windows old/5.2
Laszlo Papp [Fri, 14 Feb 2014 13:38:48 +0000 (13:38 +0000)]
Set error if the file buffer flushing fails on Windows

Change-Id: I58cf61540bc53e314988753a252cbc71003ce581
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUse Q_GLOBAL_STATIC for the udev symbol loading QLibrary instance
Laszlo Papp [Sun, 16 Feb 2014 01:01:03 +0000 (01:01 +0000)]
Use Q_GLOBAL_STATIC for the udev symbol loading QLibrary instance

Even though this has been introduced in 5.1, officially, we can rely on it in
the previous versions even if private API that it was.

* Global variables are better avoided.

* Q_GLOBAL_STATIC is thread-safe in Qt 5.

* QLibrary depends on QCoreApplication and we need to make sure that is
initialized afterwards, respectively.

The instantiation is now moved into the corresponding source file so that if it
is included at more than one place, it will not be instantiated each time it is
used in a new source file including this header.

Task-number: QTBUG-36870

Change-Id: I96de1257e5836b69d0c48b717d7c2e708d6b0fee
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse the qt_safe_* methods for open/read/write/close
Laszlo Papp [Sat, 15 Feb 2014 18:35:24 +0000 (18:35 +0000)]
Use the qt_safe_* methods for open/read/write/close

This makes the operation thread-safe. It also helps with preventing the leaks
for child processes. Also, there is now some protection against EINTR when the
system call has to be restarted.

Thanks go to Thiago Macieira for providing the original patches.

Task-number: QTBUG-36824

Change-Id: I90cac87c5e1c55a57e5ba6c20313446c43c6d242
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Fri, 14 Feb 2014 14:07:11 +0000 (15:07 +0100)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I111ca7fd67979152329f290d45bd5b47551a404a