qt:qtserialport.git
4 years agoDo not time out for -1 msec (wait methods) old/5.1
Denis Shienkov [Sun, 8 Sep 2013 18:43:57 +0000 (22:43 +0400)]
Do not time out for -1 msec (wait methods)

According to the documentation of QIODevice:

* http://qt-project.org/doc/qt-5.1/qtcore/qiodevice.html#waitForBytesWritten

* http://qt-project.org/doc/qt-5.1/qtcore/qiodevice.html#waitForReadyRead

these wait methods should not time out if msecs is -1.

Currently, the behavior does not match the expected behavior as the
negative values were overridden by zero. The operation returns as
soon as the event loop processing happens.

Now this problem is solved for Windows: the INFINITE flag has been
added to the WaitForMultipleObjects call. See the MSDN documentation
for details below:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025%28v=vs.85%29.aspx

Note: the check is added only for -1 to be consistent with the behavior
of other QIODevice subclasses. If it is any other negative integer, the
value will be cast to the corresponding positive value which will
indicate the waiting time.

Tested with Qt4 and then Qt5.

Change-Id: I2b8c8310723bca7beb9af0213edf4c855b5ac6ae
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoAdd support for BSD4 baud rates, i.e. not Unix compatible
Laszlo Papp [Wed, 20 Mar 2013 03:27:58 +0000 (03:27 +0000)]
Add support for BSD4 baud rates, i.e. not Unix compatible

1) These baud rates were revealed for BSD 4 based operating systems. The
relevant Qt macro might be added in the future once the grouping is fixed for
all the baudrates. As for the time being, no other UNIX operating system has
support for this that that is being awared of, other than BSDs, so that may
result an easily maintainable code.

2) For future reference, it may be groupped separately from the "truly standard
rates" as they are not yet present on Linux (and perhaps other Unix variants)
and so forth. Therefore, it might result a simpler maintainable and more compact
code snippet.

3) It is unknown if other UNIX variants add support for these in the future, but
based on the last few decades, probably not any soon.

4) See the following headers for further details about the BSD, Mac and so forth
termios.h content:

OpenBSD: http://fxr.watson.org/fxr/source/sys/termios.h?v=OPENBSD#L228
FreeBSD: http://svnweb.freebsd.org/base/head/sys/sys/_termios.h?view=markup
Apple: http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/termios.h

5) The following wikipedia page can also serve a good basis for checking what
the BSD 4 OS type includes for future reference if needed.

http://en.wikipedia.org/wiki/Berkeley_Software_Distribution#4.4BSD_and_descendants

6) The macros may be necessary in the future as a user might define the baudrate
on his own to get this right (i.e. with Qt4), but this can lead to confusion and
errors as the kernel will actually not support it. This remains to be seen.

7) Another change follows this one fixing the grouping for the baud rates
properly.

8) Thank you to Israel Lins Albuquerque for bringing up the topic on Gerrit.

Change-Id: I04afe63f956f4a03dc45a81c5431110b8754127d
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoDoc: language and standard review
Nico Vertriest [Mon, 16 Sep 2013 11:18:16 +0000 (13:18 +0200)]
Doc: language and standard review

Task-number: QTBUG-32173
Change-Id: I225bc1e4dfe3c12d3441c86002305c542377cf5d
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
4 years agoUse the term 'directions' for representing the directions
Laszlo Papp [Mon, 2 Sep 2013 07:13:06 +0000 (08:13 +0100)]
Use the term 'directions' for representing the directions

1) The previous 'dir' is incorrect because it should be plural for consistency
based upon the other variable names.

2) 'dir' can be misleading in the context where such a term is also used for
representing a directory, like in our case.

Change-Id: I650cc64c2669286a4d7ef071a2ab3b7b63228977
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix the compilation for Android with Qt 5.
Laszlo Papp [Mon, 2 Sep 2013 01:30:38 +0000 (02:30 +0100)]
Fix the compilation for Android with Qt 5.

1) The termios struct is basically copied and pasted from the documentation:
http://linux.die.net/man/3/termios

Since, it is just an interface without complicated methods, it is not
copyrightable, so it is safe enough.

2) This is also the same situation with the two defines we need for the kernel
interface. They are just interface numbers, and not something that
copyrightable. This has also been double checked and discussed with Lars in
email.

3) The ::tcdrain convenience method cannot be used on Android, so the fallback
"raw" ioctl syscall is used with the relevant parameters, e.g. TCSBREAK.

http://linux.die.net/man/3/tcdrain

5) cfsetspeed seems to be a BSD 4.4 extension based on the termios(3) man page:

http://linux.die.net/man/3/termios

"cfsetspeed() is a 4.4BSD extension.  It takes the same arguments as
cfsetispeed(), and sets both input and output speed."

... hence this is replaced with separate calls for input and output without a
specific Android "ifdef" in the code. It is actually also more consistent with
the setcfispeed and setcfospeed just right above that snippet.

Task-number: QTBUG-33139

Change-Id: If0abb8cec9e900fa2b6fc24df938cb778a344d55
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUnix: Deleting a duplicating call of a non-blocking mode on descriptor
Denis Shienkov [Wed, 21 Aug 2013 18:59:15 +0000 (22:59 +0400)]
Unix: Deleting a duplicating call of a non-blocking mode on descriptor

The call fcntl(fd, F_SETFL, FNDELAY) is superfluous because a flag FNDELAY
duplicates by functionality an existing flag O_NONBLOCK in open() function.
See more info, e.g.: http://linux.die.net/man/2/open

Tested on Gnu/Linux distro's with Qt4 and Qt5.

Change-Id: I01be72e78a9493af8077245cbf6a88e8c9d164ee
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoLinux: Are added the missed QLatin1Char into libudev implementation
Denis Shienkov [Sat, 24 Aug 2013 20:07:24 +0000 (00:07 +0400)]
Linux: Are added the missed QLatin1Char into libudev implementation

Change-Id: Ic125079bd9154f9094aaf2878c514eeac2753038
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoQt 4: Refactor the shell handling for header generation
Laszlo Papp [Fri, 23 Aug 2013 07:45:31 +0000 (08:45 +0100)]
Qt 4: Refactor the shell handling for header generation

It does not make much sense to use branches for only a minor difference, hence
there is now a precheck for the host os and the quote variable is set
accordingly.

This is a slightly modified version of what QtCreator's qtcreator.pro is using.
Basically, single quote is used here for the quote variable rather than double
quote as double quote is causing issues at least on my machine.

Task-number: QTBUG-33125
Change-Id: I9eb0a0a62e1404a095cfc3b1bd68c519552d23b8
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoWindows: acquire identifiers using the SetupDiGetDeviceInstanceId function
Denis Shienkov [Mon, 29 Jul 2013 13:57:20 +0000 (17:57 +0400)]
Windows: acquire identifiers using the SetupDiGetDeviceInstanceId function

This decision uses one identification string of the device instead of the
list of hardware identifiers. See more detail in MSDN:

* http://msdn.microsoft.com/en-us/library/windows/hardware/ff551106%28v=vs.85%29.aspx
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff541327%28v=vs.85%29.aspx

The device instance ID unambiguously identifies the device in system and
contains necessary values of identifiers, that allows to resolve some
issues:

* we can abandon a patch: https://codereview.qt-project.org/#change,61633
and Task-number: QTBUG-32684 automatically will be resolved
* we can apply a patch: https://codereview.qt-project.org/#change,61752
because instance ID also contains the serial number info

Checked on Windows 7 and 8 with USB PL2303 converter, USB Modem ZTE MF180,
USB Android Modems, USB Motorola CDC ACM device.

Change-Id: If3b67b5b34d65de060a0e7682ba426cd94a01fa7
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoLinux: removed the duplicated linking of libudev
Denis Shienkov [Fri, 16 Aug 2013 17:33:04 +0000 (21:33 +0400)]
Linux: removed the duplicated linking of libudev

Existence checking and linking of libudev is already carried out by means of
pkgconfig.

Change-Id: I5233ab2ce7ed342d95e8ba646b4024c8ad6b8a78
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoEliminate the "q_ptr->" call by using Q_Q(QSerialPort)
Laszlo Papp [Sat, 27 Jul 2013 13:01:00 +0000 (14:01 +0100)]
Eliminate the "q_ptr->" call by using Q_Q(QSerialPort)

Unfortunately, the q_ptr data member cannot yet be deleted from the internal
data class because QIODevicePrivate would need to be inherited then. That is not
a simple change considering the Qt4 support. Hence, that part of the logic is
put on hold, but can be expected in an upcoming change at some point, soon.

Change-Id: Ic8ba9621dd647f4afa1b91d01c858c836d1cc0c8
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoRemove the const modifier from the pinoutSignals internal methods
Laszlo Papp [Sat, 27 Jul 2013 12:31:12 +0000 (13:31 +0100)]
Remove the const modifier from the pinoutSignals internal methods

Logically, these methods set the error on their member, the public QSerialPort
class, hence these are not const methods similarly to the public variant.

Change-Id: I1580cf371556c820ce8e7df43121bc2800b08b40
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoRemove the unnecessary Q_DECLARE_PUBLIC from the data class
Laszlo Papp [Sat, 27 Jul 2013 12:15:32 +0000 (13:15 +0100)]
Remove the unnecessary Q_DECLARE_PUBLIC from the data class

Change-Id: I8293dfc6d492bac59fa830d499902cabdc8d95dd
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoPut Q_DECLARE_PRIVATE in the beginning of the class
Laszlo Papp [Sat, 27 Jul 2013 11:35:19 +0000 (12:35 +0100)]
Put Q_DECLARE_PRIVATE in the beginning of the class

This seems to be a usual practice by the majority of the Qt classes. There are
a few examples against it, but that is the minority.

Change-Id: I92f47f283a6cd279bc978761cb1ee375a514eeba
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoMerge remote-tracking branch 'origin/release' into stable
Sergio Ahumada [Fri, 26 Jul 2013 19:52:36 +0000 (21:52 +0200)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: Icf3f1dd9f471f33d129a74053c0599c6013170d7

4 years agoWindows: Add PCI vendor and device identifier detection v5.1.1
Denis Shienkov [Wed, 26 Jun 2013 15:53:04 +0000 (19:53 +0400)]
Windows: Add PCI vendor and device identifier detection

The PCI identifiers are different to the USB identifiers, as in:

* USB: VID_, PID_
* PCI: VEN_, DEV_

For more info see MSDN:

* USB: http://msdn.microsoft.com/en-us/library/windows/hardware/ff553356%28v=vs.85%29.aspx
* PCI: http://msdn.microsoft.com/en-us/library/windows/hardware/ff546262%28v=vs.85%29.aspx

Therefore, the method availablePorts() skipped processing of PCI prefixes.

Now, problem was resolved.

Task-number: QTBUG-32018
Change-Id: I098a35a170043b9c58b74cb278e4daff34b1f84e
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoCatch only the WinEventAct for the event notifier for process completion
Francisco Gonzalez [Sat, 27 Apr 2013 15:13:31 +0000 (17:13 +0200)]
Catch only the WinEventAct for the event notifier for process completion

This is necessary to filter out events like ThreadChange. The documentation
writes "The object is moved to another thread. This is the last event sent to
this object in the previous thread.". See the following url for details:

http://qt-project.org/doc/qt-5.0/qtcore/qevent.html#Type-enum

Change-Id: I091a4c1fe7f64337835e8ee1492c47cc73322fdc
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoDo not use the const specifier for Q_D inside non-const methods
Laszlo Papp [Sat, 20 Jul 2013 11:08:44 +0000 (12:08 +0100)]
Do not use the const specifier for Q_D inside non-const methods

Change-Id: Ife35ae9f83e63f14f6eb56351454848933e9f3db
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoBump MODULE_VERSION to 5.1.2
Sergio Ahumada [Tue, 23 Jul 2013 10:05:26 +0000 (12:05 +0200)]
Bump MODULE_VERSION to 5.1.2

Change-Id: Iecde0c3af8be02e73ba993bfb565dbba2a75ffa2
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
4 years agoDo not set an error for timeout as there is no timeout error handled yet
Laszlo Papp [Tue, 23 Jul 2013 20:26:39 +0000 (21:26 +0100)]
Do not set an error for timeout as there is no timeout error handled yet

This will need a proper extension later with a dedicated timeout error for 5.2
which will follow this change.

See the following QIODevice subclasses for details to get a rough idea:

http://doc-snapshot.qt-project.org/qt5-stable/qtcore/qprocess.html#ProcessError-enum
http://qt-project.org/doc/qt-5.0/qtcore/qfiledevice.html#FileError-enum
http://doc-snapshot.qt-project.org/qt5-stable/qtnetwork/qabstractsocket.html#SocketError-enum

This will also mean, we need to duplicate the qt_safe_select and
qt_core_unix.cpp etc files as qt_safe_select is exported, but only from a
private header. Anyway, more explain to come for that change.

Task-number: QTBUG-32016
Change-Id: If10cd7b5575636f0f7ee3368258e80bd4766ff3a
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd changes-5.1.1 file
Sergio Ahumada [Mon, 22 Jul 2013 11:39:23 +0000 (13:39 +0200)]
Add changes-5.1.1 file

Change-Id: Ie9cb797b15859da5e0a4dcfeba6736c6ab3245bf
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
4 years agoLinux: Added enumeration of Motorola IMX serial ports
Denis Shienkov [Fri, 19 Jul 2013 18:37:34 +0000 (22:37 +0400)]
Linux: Added enumeration of Motorola IMX serial ports

For Embedded "Freescale i.MX Linux" platform is added the filter for the
Motorola IMX serial ports.

These serial ports has names like "/dev/ttymxc*", see kernel sources:
* http://lxr.free-electrons.com/source/drivers/serial/imx.c?v=2.6.31

Task-number: QTBUG-32563

Change-Id: I97b33cdbc8f1a8ff72a171e52ddc10cc0f53b4a2
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse QT_INSTALL_HEADERS instead of QT_INSTALL_PREFIX/include
Laszlo Papp [Fri, 19 Jul 2013 05:36:10 +0000 (06:36 +0100)]
Use QT_INSTALL_HEADERS instead of QT_INSTALL_PREFIX/include

It is more accurate this way as there might be scenarios, like Red Hat, where
the headers are not installed into $$QT_INSTALL_PREFIX/include.

Task-number: QTBUG-31966
Change-Id: I4be31a4b218aed008fecba81e8d2b91616cea370
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
4 years agoRevert "Add property to set exclusivity"
Laszlo Papp [Sun, 7 Jul 2013 20:29:26 +0000 (21:29 +0100)]
Revert "Add property to set exclusivity"

This reverts commit 4c67500e5d14e561e37b4bdc056f059d3eefdfa4.

"dev: unfrozen branch, containing alpha-quality code that is ready to go into
beta testing at any time"

... from: http://qt-project.org/wiki/Branch-Guidelines

Please respect the basic principles. In doubts, do not approve changes yourself,
but ask for help.

Besides the illegit nature of this change, it has fundamental documentation
issues as well. It is summer, and this can wait until 5.2, so please do /not/
rush with approvals.

Change-Id: Ic2763394035c776088cb28f9c04086920cedb3a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
4 years agoAdd more "See also" references for the serial port info documentation
Laszlo Papp [Sun, 7 Jul 2013 20:46:28 +0000 (21:46 +0100)]
Add more "See also" references for the serial port info documentation

Change-Id: I90fbcd6ce4f88869528ea8757aa7dd428c3adaa3
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
4 years agoAdd a missing space to the code
Laszlo Papp [Sun, 7 Jul 2013 15:40:40 +0000 (16:40 +0100)]
Add a missing space to the code

Change-Id: I8e97e51801dbef8154f2dcba1bd2b9464486eccf
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse consistent style for local const
Laszlo Papp [Sun, 7 Jul 2013 15:48:19 +0000 (16:48 +0100)]
Use consistent style for local const

Should be:

* consistent name with the rest
* static as it is used only once inside the desired method
* const int instead of enum for sanity and consistency

Change-Id: I7a7a7b894a559d03b02a4358c87c464045950253
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoMerge branch 'release' into stable
Sergio Ahumada [Wed, 3 Jul 2013 14:02:34 +0000 (16:02 +0200)]
Merge branch 'release' into stable

Change-Id: I82f533fb54d2c32ab0831f709320d2044eccc70e

4 years agoWindows: Fix waitAnyEvent() method
Denis Shienkov [Mon, 6 May 2013 14:00:38 +0000 (18:00 +0400)]
Windows: Fix waitAnyEvent() method

Wrong comparison between unsigned variable waitResult and signed size of vector.
The waitResult variable was interpreted as signed data type, that led to an
wrong result of comparison (e.g. when waitResult = WAIT_FAILED (0xFFFFFFFF)).

The solution - convert the size of the array to an unsigned data type and
leave waitResult without conversion.

Thanks to "boo kan, ong".

Task-number: QTBUG-32017
Change-Id: Iff25304d3d0345f47e3edc363a999a7b979cb1bb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoAdd property to set exclusivity
Alex Henrie [Tue, 2 Jul 2013 05:51:18 +0000 (23:51 -0600)]
Add property to set exclusivity

Disabling the serial port driver's exclusive mode is necessary for
pseudo serial ports and some USB/serial adapters to work correctly.

Change-Id: I74d45feed619817b61e265b00aec8b0ebfae7a33
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoEnums intended as flags is moved to Q_FLAGS() macro
Denis Shienkov [Tue, 25 Jun 2013 17:59:18 +0000 (21:59 +0400)]
Enums intended as flags is moved to Q_FLAGS() macro

Task-number: QTBUG-31964
Change-Id: I771ace406cc549e9c48d84fe90974487202ee14b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoFix an erratic name of enum "Rate" on "BaudRate" in Q_ENUMS macro
Denis Shienkov [Tue, 25 Jun 2013 17:51:39 +0000 (21:51 +0400)]
Fix an erratic name of enum "Rate" on "BaudRate" in Q_ENUMS macro

Change-Id: I74ceefbb108c142fe260a5c86a9f610b0de91cde
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse debug_and_release_target for mixed release and build selection
Laszlo Papp [Tue, 25 Jun 2013 09:27:41 +0000 (12:27 +0300)]
Use debug_and_release_target for mixed release and build selection

It is more appropriate as it is a more abstract use case than just tightening it
to Windows.

Change-Id: I60d0ea472299b3048ad6762512d632d010366f95
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
4 years agoMerge remote-tracking branch 'origin/release' into stable
Frederik Gladhorn [Thu, 20 Jun 2013 14:28:35 +0000 (16:28 +0200)]
Merge remote-tracking branch 'origin/release' into stable

Change-Id: I08b51226675178ae62fa93c91bc8dd04d18bd62f

5 years agoWindows: Fix no longer receive data after EV_TXEMPTY triggered for CDC ACM device v5.1.0 v5.1.0-rc1 v5.1.0-rc2
Denis Shienkov [Fri, 7 Jun 2013 14:56:57 +0000 (18:56 +0400)]
Windows: Fix no longer receive data after EV_TXEMPTY triggered for CDC ACM device

A previous patch

* SHA1 ID: 2bcac223e64599eb74889975053f6547000b13cb

introduced a regression: after triggering of EV_TXEMPTY a reception of
data is stopped. The reason for this was an immediate return from the
handler processCompletionRoutine().

The solution - do not do an immediate return and let to call method
startAsyncRead().

Thanks to Dan

Task-number: QTPLAYGROUND-22
Change-Id: I1a6b358e6bbaba94527dc9db98a2ab046a8c6f05
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoWindows: Fix false ResourceError triggering for CDC ACM devices
Denis Shienkov [Thu, 6 Jun 2013 15:42:10 +0000 (19:42 +0400)]
Windows: Fix false ResourceError triggering for CDC ACM devices

When transmitted data to the USB serial port of the class CDC ACM, is
triggered an unexpected TXEMPTY event, which we didn't add to a mask of
events in SetCommMask(). In this case handler processCompletionRoutine()
interpreted it as ResourceError.

This DCD ACM devices over USB connection using the Microsoft USB serial
driver (usbser.sys). Thus, allegedly, this behavior identical for all
standard CDC ACM devices on Windows.

Solution - check on unexpected EV_TXEMPTY flag and immediately return
true from processCompletionRoutine().

Thanks to Josh Handley.

Task-number: QTPLAYGROUND-22
Change-Id: Iac3eccc79e243e5bbf1a34cd44458c9ad265a5db
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoBump MODULE_VERSION to 5.1.1
Sergio Ahumada [Tue, 28 May 2013 18:29:13 +0000 (20:29 +0200)]
Bump MODULE_VERSION to 5.1.1

Change-Id: I27019a0056156434a1151c09b3d5b38eba23897e
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
5 years agosync.profile: Point dependencies to an empty string
Sergio Ahumada [Fri, 24 May 2013 20:29:20 +0000 (22:29 +0200)]
sync.profile: Point dependencies to an empty string

This means that we are going to use the same branch name for the
dependencies as the branch of the repository under test.

If we are testing the 'stable' branch, all dependencies will point
to the 'stable' branch as well.

Change-Id: Ibb0cf31b90d04f280691859d66486803ff58cc78
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
5 years agoDoc: Updates based on sanity check v5.1.0-beta1
Venugopal Shivashankar [Fri, 12 Apr 2013 13:29:30 +0000 (06:29 -0700)]
Doc: Updates based on sanity check

- Removed redundant qdoc pages on supported
platforms, getting source, and building from source.
- Added a module page to list the C++ classes
- Removed unnecessary \module commands in several pages
- Made a few language edits to class documentation
- Updated the index page with some introductory content
- Fixed broken links to the examples

Change-Id: Ia7bd74b383f344426814db736f7bc4cd77c13992
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoUpdate the documentation and internal setBreakEnabled API
Laszlo Papp [Sun, 5 May 2013 20:03:58 +0000 (21:03 +0100)]
Update the documentation and internal setBreakEnabled API

The change 0add3b934b8405fc5b65efeba9f05cc1dc353e64 changed the API, and we had
a compromise in there to get the API changes in as soon as possible. This change
tries to address the suggested documentation and internal API changes.

Only tested on Linux with Qt 4.8.4 and Qt 5.1, so it might break on other
platforms.

Change-Id: I153e5a35d76beb26e04dbabf184bc9b90ef4b70b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoFix examples directory layout
Kai Koehne [Tue, 30 Apr 2013 12:46:08 +0000 (14:46 +0200)]
Fix examples directory layout

Move examples into a dedicated 'serialport' directory. This is
in line with what the other modules do, and makes sure that
the examples show up  in a sensible place even for the 'combined'
source packages.

Task-number: QTBUG-30912
Change-Id: Iefa2b634df3d2eb34f655b34f6fb24a224b78869
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
5 years agoRevert "Refactor the Windows port enumeration from GUID classes to devinterfaces"
Denis Shienkov [Tue, 30 Apr 2013 19:07:53 +0000 (23:07 +0400)]
Revert "Refactor the Windows port enumeration from GUID classes to devinterfaces"

This reverts commit 3bfe998860e0bfd3ce48784188eaa0d58bf86da1.

Patch with enumerating of devices through interfaces GUID's enters many
regressions, breaks universality and complicates realization.

For example, it breaks enumeration of CDC ACM devices. Moreover, some devices
(like Nokia phones) has incorrect registration in Windows registry so
workaround will greatly complicates code.

Decision with use of GUID's interfaces was worse than the previous with use of
setup GUID's. Thus, was made the decision to roll away changes on really
working decision with Setup Class GUID's.

Now tested for devices:

* built-in serial port
* USB/Serial converter on PL2303 chip
* USB/Serial converter on FTDI chip
* USB/Bluetooth dongle with standard MS bluetooth stack
* USB/CDMA Modem ZTE MF180
* Com0com virtual serial ports
* Eltima virtual serial ports
* Telit virtual serial ports
* CDC ACM serial port on Motorola E398 phone
* CDC ACM (and modem) serial port on Nokia E95 phone

on Windows XP/7/8.

Task-number: QTPLAYGROUND-27
Change-Id: Icc893e9e54e51dbf78da2d132dab6db986d94e03
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoEliminate the blocking terminal example notes as it still does not exist
Laszlo Papp [Tue, 30 Apr 2013 17:31:53 +0000 (18:31 +0100)]
Eliminate the blocking terminal example notes as it still does not exist

Change-Id: I28986ada705996ada22b30d10877ea9eed0dba8f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoAPI change: setBreak -> setBreakEnabled
Thiago Macieira [Sun, 7 Apr 2013 00:22:28 +0000 (17:22 -0700)]
API change: setBreak -> setBreakEnabled

setBreak(false) to disable breaks are a bad idea. clearBreak(false) to
enable breaks are an even worse idea. So rename the function to
setBreakEnabled(), which follows existing Qt patterns.

Change-Id: I5f76afc3c9e7039b55be231f6be4d5d20ec2e537
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoWorkaround for fix sending of data for WinCE platform
Denis Shienkov [Fri, 19 Apr 2013 15:10:38 +0000 (19:10 +0400)]
Workaround for fix sending of data for WinCE platform

The commit

* sha1: 544f927c3724344d01d45d19151d236c143f8c83

entered regression of implementation of data writing to the
serial port.

Regression is that after data writing to the internal ring
buffer of a class these data really aren't transferred to
the serial port and remain in this buffer because no event
EV_TXEMPTY triggered. This event will occur only after the
serial port will transfer at least one byte of data and the
FIFO buffer of the driver becomes the free for transmission
of the next portion of data from ring buffer of class.

Thus the simplest decision is the forced call of WriteFile()
of function after each addition of the internal ring buffer
to trigger EV_TXEMPTY sequence. In this case we launch
WriteFile() implicitly through the notifyWrite() method with
the WriteChunkSize parameter (instead of one byte) to optimize
transmission for speed (theoretically).

WARNING: This decision is just a workaround and not a real fix,
shall be decided in the future in more correct and effective
way.

Tested for target:

"-platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005"

on standard Pocket PC WM5.0 Device Emulator.

Task-number: QTPLAYGROUND-13
Change-Id: I4b3a36fa064dee92406a7511eb2b98b2a55e5315
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoFix of errors of compilation on WinCE platform
Denis Shienkov [Fri, 19 Apr 2013 12:30:46 +0000 (16:30 +0400)]
Fix of errors of compilation on WinCE platform

Some previous commits entered regressions in compile process,
namely:

* sha1: 544f927c3724344d01d45d19151d236c143f8c83

After implementation of a new concept of internal architecture
of library, is entered regression for the indefinite eventMask
variable in the waitForReadOrWrite() method.

Solution - to define a variable into this method.

* sha1: 3ea635d74d4035c9036c2b7208b162620f51aa8b

Entered the name space regression for the class CommEventNotifier.

Solution - not to use a name space for this class.

Tested for target:

"-platform win32-msvc2005 -xplatform wincewm50pocket-msvc2005"

Task-number: QTPLAYGROUND-13
Change-Id: I9dbcc0023f06c1b0e6d7b1b670828650382ab785
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoRefactor the Windows port enumeration from GUID classes to devinterfaces
Denis Shienkov [Fri, 12 Apr 2013 19:25:28 +0000 (23:25 +0400)]
Refactor the Windows port enumeration from GUID classes to devinterfaces

Earlier enumeration of devices was made through GUID classes. But
MSDN says that this approach became outdated (since Windows 2000),
and instead of classes it is necessary to use GUID interfaces.

See:

* http://msdn.microsoft.com/en-us/library/windows/hardware/ff545036%28v=vs.85%29.aspx
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff545046%28v=vs.85%29.aspx

Thus there was a changeover of:

* GUID_DEVCLASS_PORTS by GUID_DEVINTERFACE_COMPORT
* GUID_CLASS_MODEM by GUID_DEVINTERFACE_MODEM

Of course, flags for the SetupDiGetClassDevs() function changed also.

This approach decided the following:

* Use of newer API for enumeration
* There is no need GUID classes for non-standard "purely" the virtual
devices (like com0com and so forth)
* There is no need to check for name "LPT" existence, because
GUID_DEVINTERFACE_COMPORT belong only to serial ports devices (instead
of GUID_DEVCLASS_PORTS that include serial and parallel ports).

It is checked on devices:

* Built-in serial ports
* USB/Serial converters (PL, FTDI)
* USB Bluetooth serial ports (with standard MS stack)
* USB modems (ZTE MF180)
* Com0com virtual serial ports
* Eltima virtual serial ports
* Telit virtual serial ports

It is checked on OS: Windows XP/Vista/7/8

Change-Id: I9da51d815ac5081a95113659be2b38ebd31275a4
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoAdd further device filters on Linux without libudev
Denis Shienkov [Tue, 16 Apr 2013 15:09:25 +0000 (19:09 +0400)]
Add further device filters on Linux without libudev

Added:

* ttyAMA filter for AMBA serial ports, e.g. see
http://lxr.free-electrons.com/source/drivers/tty/serial/amba-pl011.c

* ircomm filter for infrared serial devices, e.g. see
http://www.tldp.org/HOWTO/html_single/Infrared-HOWTO/

Change-Id: I9e1cd04513a937f080978a7ecc7139a906de40f0
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agodoc: Minor changes to qtserialport.qdocconf
Sergio Ahumada [Fri, 5 Apr 2013 19:15:55 +0000 (21:15 +0200)]
doc: Minor changes to qtserialport.qdocconf

Organizing the file a bit to make it match other qdocconf files.
Also, renaming \title Qt Serial Port to match other modules.

Change-Id: I65938cad5184ca886765272294ce07d117f77b5a
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
5 years agoMentioning of Unbuffered mode in the open() method is removed
Denis Shienkov [Wed, 10 Apr 2013 17:30:38 +0000 (21:30 +0400)]
Mentioning of Unbuffered mode in the open() method is removed

At present the Unbuffered mode isn't supported, therefore the
mentioning is deleted.

Change-Id: I399dd7ac79f6571a5d0738957120a046b2422fef
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoAdd CMake unit tests for QtSerialPort.
Stephen Kelly [Mon, 8 Apr 2013 18:05:54 +0000 (20:05 +0200)]
Add CMake unit tests for QtSerialPort.

Change-Id: I406517f216e7c73c20439ca2f9a17e60709ef661
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoRemove the namespace doc as the namespace usage was removed
Laszlo Papp [Sun, 7 Apr 2013 14:42:20 +0000 (15:42 +0100)]
Remove the namespace doc as the namespace usage was removed

This file does not have any useful content either, and unlikely to have in a
foreseeable future.

Change-Id: I36da8a3599f308a42d5809168b0f48dc197df126
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix a typo in the example qdoc to eliminate the warning
Laszlo Papp [Sun, 7 Apr 2013 13:39:51 +0000 (14:39 +0100)]
Fix a typo in the example qdoc to eliminate the warning

Change-Id: Ia241ea3198a1e9deb3501de07fb510eea8dfd77c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix several documentation issues for the snippet qdoc keyword
Laszlo Papp [Sun, 7 Apr 2013 13:10:44 +0000 (14:10 +0100)]
Fix several documentation issues for the snippet qdoc keyword

As it can be seen in other submodule examples, the "example" prefix is
unnecessary, and it even causes warnings.

Change-Id: Id168108758cc7f6dbb0aebf753b757c4f67b3f47
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoUse the ingroup/title/example properly without the module keyword
Laszlo Papp [Sun, 7 Apr 2013 14:01:04 +0000 (15:01 +0100)]
Use the ingroup/title/example properly without the module keyword

This also eliminates several documentation warnings when trying to build that.
Planning to add \brief and other fancy stuff later, but the main purpose of this
change is to eliminate the documentation warnings.

Change-Id: Ib4048d0af691bac9ea70f6ca907649dce0f650db
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoUse the proper signature for the data error policy changed signal
Laszlo Papp [Sun, 7 Apr 2013 14:05:20 +0000 (15:05 +0100)]
Use the proper signature for the data error policy changed signal

Change-Id: Iaf6df920dfca65b80231bb702c0290bb5c0e00d9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix cast from ASCII in library code
Thiago Macieira [Sun, 7 Apr 2013 00:32:18 +0000 (17:32 -0700)]
Fix cast from ASCII in library code

Must always declare the source encoding. QtSerialPort must still compile
with Qt 4, so #define QStringLiteral to be QLatin1String there (even
though QStringLiteral is supposed to be UTF-8).

Note: this code is bad. It's not thread-safe outside of GCC. It should
use Q_GLOBAL_STATIC.

Change-Id: I938c2f836f9c3c1d2beaade20e67ce5ef142741e
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoRemove non-standard comma at the end of an enum
Thiago Macieira [Sun, 7 Apr 2013 00:41:21 +0000 (17:41 -0700)]
Remove non-standard comma at the end of an enum

Change-Id: I69ca34c159a267855977bee9670836ce7a249782
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agodoc: Removed the HTML template from the .qdocconf files
Sergio Ahumada [Fri, 5 Apr 2013 18:24:45 +0000 (20:24 +0200)]
doc: Removed the HTML template from the .qdocconf files

qt-module-defaults.qdocconf already contains the HTML template.

Change-Id: I831615cdfdb3d4df73393c6b6815fc837bc444d4
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agotests: Don't run manual tests in the CI system v5.1.0-alpha1
Sergio Ahumada [Thu, 4 Apr 2013 14:25:38 +0000 (16:25 +0200)]
tests: Don't run manual tests in the CI system

Manual tests are not suppossed to be run by the CI system, so
removing CONFIG += testcase from the .pro files.

Change-Id: I43a729a22a25d9656a1cf76cf3489b3abb893fbd
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoMac: Fixed the description() method for Bluetooth devices
Denis Shienkov [Tue, 26 Mar 2013 11:39:56 +0000 (15:39 +0400)]
Mac: Fixed the description() method for Bluetooth devices

At the moment, the description() method returns empty string, because
for Bluetooth devices does not exist the properties with the names
kIOPropertyProductNameKey and kUSBProductString into dictionary.

To obtain description information for the Bluetooth serial devices
can to use a separate property called "BTName". This property can also
be seen with the utility IORegistryExplorer.

In the current implementation, the name "BTName" is hard-coded in the
source code because I did not find any of its definition in the header
files XCode, in the Apple's developer site and in general, on the hard
drive. Thus, in the future it is possible to replace the hard-code to
a constant, if it exists.

Tested on MacOSX 10.6.8

Task-number: QTPLAYGROUND-25
Change-Id: I227aa2a1429660287ea83c1b142d2af3a11fd086
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoWin32: Truncate read buffer when ReadFile returns error
Denis Shienkov [Tue, 26 Mar 2013 17:35:12 +0000 (21:35 +0400)]
Win32: Truncate read buffer when ReadFile returns error

Previously reserved read buffer must be truncated
when reading error occurs.

Also reserve() method is moved down after method
lookupReadCompletionNotifier(). So we get rid of
an additional truncate() method when lookup can
return null pointer.

Change-Id: I843ff6043b31da892a93d93b8b4209ce8f10a7d2
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoUse explicit constructors where it is applicable
Laszlo Papp [Wed, 27 Mar 2013 17:59:51 +0000 (17:59 +0000)]
Use explicit constructors where it is applicable

Change-Id: I8619ef269b124357a164e7f771058deda6fcb419
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoremove dependence of working QSerialPortInfo
Israel Lins [Wed, 27 Mar 2013 17:25:04 +0000 (14:25 -0300)]
remove dependence of working QSerialPortInfo

On system with no support to QSerialPortInfo the constructor
QSerialPort(QString portName, QObject *parent) don't works.

Change-Id: I1a98e03f9153d2b963fa2985901e40ddf17717cf
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoAdd accessor methods for checking the availability of the PID/VID
Laszlo Papp [Sun, 24 Mar 2013 08:43:25 +0000 (08:43 +0000)]
Add accessor methods for checking the availability of the PID/VID

As mentioned in the previous change, this is necessary for those end users who
would like to explicitly know if the device on the serial port has a valid
vendor or/and product identifier.

This is now providing a nice and convenient API for having a dedicated boolean
method for making this query possible. It is a lot more readable and convenient
to use than other alternatives including the extended scope for the integer
query method and so forth. It is more explicit and clear about the intention
that one checks if the device has a valid identifier. It would be more vague
with error codes and so forth. One somewhat reasonable alternative could be
this, albeit this is also more inconvenient:

    a) bool vendorIdentifier(quint16 &vendorIdentifier) const;
    b) bool productIdentifier(quint16 &vendorIdentifier) const;

    ... as this would require an additional variable from the user, and this
    could not be used with ternary operators so easily, et cetera.

There are even worse ideas like how the exceptional conversion happens in
QString and so forth, but that also requires an explicit variable or zero if one
is sure the conversion should succeed. One can pass zero in there, but that is
still inconvenient and more than passing nothing, and zero can become unclear
what it supposed to present half or one year later.

The change has been tested on Linux with Qt4 and Qt5, and cenumerator works as
expected. The documentation has been added accodingly.

Task-number: QTPLAYGROUND-21
Change-Id: I905708ce0e67307bf89d69e645462486ad869b0c
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoAdd local echo support for the terminal example
Denis Shienkov [Sat, 23 Mar 2013 22:41:12 +0000 (22:41 +0000)]
Add local echo support for the terminal example

Earlier, by default when put a characters for the transfer, this
characters is always displayed on the console, i.e. can be said
that has always worked the local echo mode.

This led to the problem with duplication of input characters on the
console, in case if the remote device (e.g. a modem) was enabled the
echo mode by default. For example, when typing the command "AT", the
console displays "AATT".

To fix this problem, to the settings dialog was added the checkbox
"Local echo" in which can turn off the display of input characters
to the console.

Change-Id: Iebc9384bab97e313a954a8f8c00ea22129913280
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoFix crash the Terminal example when trying to select the custom baud rate
Denis Shienkov [Fri, 22 Mar 2013 18:35:56 +0000 (22:35 +0400)]
Fix crash the Terminal example when trying to select the custom baud rate

Attempting to choose from QComboBox the custom baud rate leads to
crash because the null pointer is returned to the QLineEdit and call
the method for setup the validator by null pointer.

Only editable combo boxes have a line edit, so trying to set a
non-editable is dereferencing a null ptr.

Change-Id: Ia9aaef64ef908b1b2d95090a203dc223d12f0b76
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoChange the return type of the vendor/productIdentifier() API
Laszlo Papp [Sat, 23 Mar 2013 18:45:26 +0000 (18:45 +0000)]
Change the return type of the vendor/productIdentifier() API

The API was established with a bit of insanity, namely: it returns raw strings
for the 16-bit vendor and product _numbers_. This brings lots of limitations
into the system aside from its silly nature, like how to handle lower and upper
case hex letters (a-f, A-F) and so forth.

Also, it is not clear whether the API should return zero aligned strings, or
whether or not to return the leading indicator of the hex format (0x). This is
now all being eliminated by switching to the 16-bit unsigned integer use.

There are mostly two use cases for the usage of this:

    a) Comparison or mapping to find the requested port and device

        This is getting very simple because it will mean a simple 16-bit
        unsigned integer comparison which is cross-platform by its nature for
        sure.

    b) Display the string to the end user

        This is for instance with an enumerator or terminal emulator
        application, but in this special case the user can format the output of
        the integer as wished. Then, it can easily become a cross-platform
        display. Even customizing is simple enough to provide the native look'n
        feel without the library forcing one particular type.

The documentation is being changed correspondingly. As for the future, if the
need even arises, the following methods could be considered for the info
provider class (QSerialPortInfo):

    bool hasVendorIdentifier() const;
    bool hasProductIdentifier() const;

... both can be added without any issues (i.e. in a binary compatible way).

The examples are updated now as well with presenting the usage of the new API.
The GUI emulator example got the string management a bit updated to be in line
with the console based emulator (cenumerator). In general, it is also a way more
reasonable way of putting a string together with so many placeholders. Also, the
argument and list management got a bit nicer formatting style per line break.

Testing: the change has been tested on Linux with Qt4 and Qt5.

Task-number: QTPLAYGROUND-21
Change-Id: I33683061787af94a797685794be9ebcfa90c499a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix the broken serialport information obtaining on Mac
Laszlo Papp [Sun, 24 Mar 2013 16:25:35 +0000 (16:25 +0000)]
Fix the broken serialport information obtaining on Mac

This regression was introduced by the following commit:
ca59808315342560b5b09687fd47dbe537787ef7

It is due to the fact that the static method provides the string for the return
value, and not in place for the "this" object. This was an oversight.

Change-Id: I5fa5a25562abe1567d9423022072e012b4e66b45
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoMake a good use of the new "override" C++11 specifier when available
Laszlo Papp [Sat, 23 Mar 2013 16:18:01 +0000 (16:18 +0000)]
Make a good use of the new "override" C++11 specifier when available

The usage of the specifier helps to catch mistakes in general and also
explicitly shows the intention.

Furthermore, leave the "virtual" specifier out as per Qt Coding Style:
http://qt-project.org/wiki/Qt_Coding_Style#fe675674b70cdaca505f3cff0244fbae

It does not make much sense in general with the override specifier either
anyhow.

Note: an empty define is still necessary as long as QtSerialPort supports Qt4
which is the current situation.

Change-Id: Iedf01071e6303d88305c140f4a767bb43059f593
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
5 years agoWindows: Add missed error code ResourceError processing
Denis Shienkov [Tue, 19 Mar 2013 18:24:28 +0000 (22:24 +0400)]
Windows: Add missed error code ResourceError processing

Previously, when pulled from the system the USB Bluetooth dongle (which
is associated with the opened serial port) don't cause emitting of signal
error() with code ResourceError. This reproduced only in case if through
already open the serial port was called the read operation, in this case
read operation returns fail with the system error code ERROR_DEVICE_REMOVED.

Now, this problem has been fixed and handled correctly by at least on
Windows XP, Vista, 7 and 8 (x32) with the Standard MS Bluetooth stack.

Seems, that it is common behavior for all the USB Bluetooth devices with
use the Standard MS Bluetooth Stack.

Change-Id: Ic19c850360d27a2729f72b438e1e185db09eeb97
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoUse the error string established for showing the error message
Laszlo Papp [Thu, 21 Mar 2013 20:16:23 +0000 (20:16 +0000)]
Use the error string established for showing the error message

Change-Id: Id34f2428641725ede6eda9505c9b577a21e94e1e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoDemonstrate the error notification through the terminal example
Laszlo Papp [Thu, 21 Mar 2013 10:11:15 +0000 (10:11 +0000)]
Demonstrate the error notification through the terminal example

I have received a couple of requests recently whether it is planned to support
error notification and hence I think it would be a good idea to demonstrate its
usage inside the examples as much as possible. Here you can find the first
attempt for that.

As the library aims to provide the error strings as well, all that has to be
done is to setup a handler for the notification and display a message box and
conditionally close the serial port in case of critical errors.

The string will also be provided by the library which makes the interface
unified across certain projects. However, the clients can also use their strings
if they wish. It is up to their decision. The error strings are already
localized and internationalized inside the library.

The handler is now also tagged properly for the documentation so that it is more
appropriate for end users reading the documentation to get these bits right as
it is probably a severe issue for many developers and end users.

This will also allow us to be very careful about the error strings inside the
library that is among my next goals to make it even nicer than before because
currently there is no "high-level" error message prepended to the more detailed
one. Hence, this could still be improved in the near future.

Some errors are already tested when opening the serial port. Hence, the example
can demonstrate both types of error management: sync and async. It might be
sometimes more feasible to have a sync error management in place even if async
can also work.

The change has been tested on Linux and Windows with Qt4, and with Qt5 on Linux
for the time being.

Thank you for Denis to revealing the importance of the issue even if this patch
is representing a bit different approach.

Change-Id: If0274e684fd5da08b32bbf0227bfb98784c3a78f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoDemonstrate the error notification through the terminal example
Laszlo Papp [Thu, 21 Mar 2013 10:11:15 +0000 (10:11 +0000)]
Demonstrate the error notification through the terminal example

I have received a couple of requests recently whether it is planned to support
error notification and hence I think it would be a good idea to demonstrate its
usage inside the examples as much as possible. Here you can find the first
attempt for that.

As the library aims to provide the error strings as well, all that has to be
done is to setup a handler for the notification and display a message box and
conditionally close the serial port in case of critical errors.

The string will also be provided by the library which makes the interface
unified across certain projects. However, the clients can also use their strings
if they wish. It is up to their decision. The error strings are already
localized and internationalized inside the library.

The handler is now also tagged properly for the documentation so that it is more
appropriate for end users reading the documentation to get these bits right as
it is probably a severe issue for many developers and end users.

This will also allow us to be very careful about the error strings inside the
library that is among my next goals to make it even nicer than before because
currently there is no "high-level" error message prepended to the more detailed
one. Hence, this could still be improved in the near future.

Some errors are already tested when opening the serial port. Hence, the example
can demonstrate both types of error management: sync and async. It might be
sometimes more feasible to have a sync error management in place even if async
can also work.

The change has been tested on Linux and Windows with Qt4, and with Qt5 on Linux
for the time being.

Thank you for Denis to revealing the importance of the issue even if this patch
is representing a bit different approach.

Change-Id: If0274e684fd5da08b32bbf0227bfb98784c3a78f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agobaudRateChanged not emitted when needed
Israel Lins [Mon, 18 Mar 2013 01:38:11 +0000 (22:38 -0300)]
baudRateChanged not emitted when needed

Change-Id: I5922871e546e50c61661a1a7c2251c0abc79fbde
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoWin32: Fix read sequence with considering the type of policy
Denis Shienkov [Sun, 17 Mar 2013 16:47:18 +0000 (20:47 +0400)]
Win32: Fix read sequence with considering the type of policy

Method startAsyncRead() should only be called in case of a policy
type IgnorePolicy installed. In other types of policies should be
re-trigger startWaitCommEvent() method for correctly catch
frame/parity errors for each char readed.

Change-Id: I94e002d0634fc6cc9763ac492972735393bbf3a2
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoWindows: Fix receive policies processing
Denis Shienkov [Fri, 15 Mar 2013 14:51:10 +0000 (18:51 +0400)]
Windows: Fix receive policies processing

Policies should be handled only with ParityError occurred
according to the description of the method setDataErrorPolicy().

Change-Id: Ie0dc9347e50d358508def5ba1a84dadbb0ead4be
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoRemove description for QSerialPort::close() method
Denis Shienkov [Tue, 12 Mar 2013 15:30:38 +0000 (19:30 +0400)]
Remove description for QSerialPort::close() method

Description of the method close() does not reflect the reality
in terms of flush data before closing, at current moment data
is not flushes and device closes immediately.

Thus, it is wiser to remove the description to the functionality
that does not exist at the moment. Moreover, that the question
of whether to do or not do flush, is to be considered later.

Change-Id: Ifb286c0c4a608b8dfea8b0380ce92bf3df9f3de3
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoDefine module version
Laszlo Papp [Thu, 14 Mar 2013 15:35:16 +0000 (15:35 +0000)]
Define module version

Task-number: QTBUG-29838

Change-Id: Ic2880bb15f134576f819db22443dc87163c922d4
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoUse fromUtf8 for the conversion instead of copy assignment
Laszlo Papp [Mon, 11 Mar 2013 22:38:53 +0000 (22:38 +0000)]
Use fromUtf8 for the conversion instead of copy assignment

Change-Id: I9f450a55c7fa33811aaa2181eddc0241ea3bbc42
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoAdd the console config due to Windows
Laszlo Papp [Mon, 11 Mar 2013 21:35:13 +0000 (21:35 +0000)]
Add the console config due to Windows

For new codes, it is better not to use scopes as it is less noise, and works
fine.

Change-Id: I0078e70e037aaa1ddd861de40542db7386f69dda
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoMac: Add missed check for CFStringGetCString/CFNumberGetValue return value
Denis Shienkov [Mon, 11 Mar 2013 15:02:04 +0000 (19:02 +0400)]
Mac: Add missed check for CFStringGetCString/CFNumberGetValue return value

Change-Id: Ie327c957517a383676004caa9a13c7e467153ee9
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years agoFix a typo for the output of the cenumerator example
Laszlo Papp [Mon, 11 Mar 2013 13:17:31 +0000 (13:17 +0000)]
Fix a typo for the output of the cenumerator example

Change-Id: Id0d2b28158e34aa6ea1c5d16cd41e3f2c6cd48b4
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoCommand line applications should not be placed into a bundle on OS X.
Jake Petroules [Mon, 11 Mar 2013 13:22:07 +0000 (09:22 -0400)]
Command line applications should not be placed into a bundle on OS X.

Change-Id: Idf872d769d683440ec6cb98ae722ba68b8715a86
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoPrefer the library built in the project tree for the examples and tests
Laszlo Papp [Fri, 8 Mar 2013 01:51:36 +0000 (01:51 +0000)]
Prefer the library built in the project tree for the examples and tests

This is necessary when the user has a previous QtSerialPort version installed
because the examples and tests will pick up the old installed version. That can
cause breakages for the "one shot" build in case of API breaks or behavior
changes.

For consistency, and more importantly for proper explicit usage without raw
INCLUDEPATH usage, QMAKE_INCDIR is introduced in place.

qtAddLibrary has to be moved to the beginning not to prepend the QtSerialPort
include later, and hence to avoid the issue for the example and test builds.

This change also removes a left-over line for Mac as it has just been tested
that the line is unnecessary.

Change-Id: If391b4398a323e0a3eb285bd79d98ec1dd410381
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
5 years ago*nix: Fix unexpected clear errno when I/O failed
Denis Shienkov [Thu, 28 Feb 2013 23:30:37 +0000 (23:30 +0000)]
*nix: Fix unexpected clear errno when I/O failed

This bug was detected on MacOSX 10.8 & FTDI serial device.

When removing a previously opened device from the system, triggered
readNotifier() and are trying to read() from the device, but call
returns -1 with errno = 6. It is correct behavior.

But then, when called decodeSystemError(), the now value of errno
is zero, so this method incorrect detect error as NoError.

This reset errno is due to the fact that between calls to read() and
decodeSystemError(), there are other system calls that are implemented
within QRingBuffer (e.g. access to memory).

Therefore, must do decodeSystemError() immediately after the failed
I/O calls, so need to move decodeSystemError() near to I/O calls.

Change-Id: Iad7e78247cf81a0a6ed5053ee996728881414558
Reviewed-by: Laszlo Papp <lpapp@kde.org>
5 years agoMac: Added check for return value for IOServiceMatching()
Denis Shienkov [Thu, 28 Feb 2013 23:00:27 +0000 (23:00 +0000)]
Mac: Added check for return value for IOServiceMatching()

Unfortunately, the Mac API does not provide further details when
an error can occur (i.e. anytime), so it may be logical to just
return before proceeding further.

See the following page for details API:

http://developer.apple.com/library/mac/#documentation/IOKit/Reference/IOKitLib_header_reference/Reference/reference.html

Change-Id: I7f7dc9083eec3a936505dbfc3c6526062f03685d
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix the missiing "\endcode" and the left-over "playground"
Laszlo Papp [Thu, 28 Feb 2013 07:36:41 +0000 (07:36 +0000)]
Fix the missiing "\endcode" and the left-over "playground"

Change-Id: Ic5974762a80cb6486d8350a5de48393081fc472b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix a few issues in the QSerialPort documentation (likely typo)
Laszlo Papp [Wed, 27 Feb 2013 22:51:47 +0000 (22:51 +0000)]
Fix a few issues in the QSerialPort documentation (likely typo)

Change-Id: I6a5f2b3b23a71eebb79f1521a587c1ee4cb5ca5f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoReplace the deprecated commands (\i, \o, \bold) with the new ones
Laszlo Papp [Wed, 27 Feb 2013 21:58:03 +0000 (21:58 +0000)]
Replace the deprecated commands (\i, \o, \bold) with the new ones

See the following page for details:
http://doc-snapshot.qt-project.org/qt5-stable/qdoc/27-qdoc-commands-alphabetical.html

Change-Id: I405deea5cf065075907ac7830e92bb064a1c72d0
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoMake the test .pro files more aligned and consistent to the other modules
Laszlo Papp [Wed, 27 Feb 2013 21:22:10 +0000 (21:22 +0000)]
Make the test .pro files more aligned and consistent to the other modules

Change-Id: I6c227b10dd4cb4f5cd8390fa5fae3a282b676f9e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoRevamp the documentation not to be broken for "make docs"
Laszlo Papp [Wed, 27 Feb 2013 21:20:44 +0000 (21:20 +0000)]
Revamp the documentation not to be broken for "make docs"

Change-Id: Ifce994b10c67eeefaf1791db2399716d6051cea4
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoFix the include guard for the global serial port header
Laszlo Papp [Tue, 26 Feb 2013 20:32:27 +0000 (20:32 +0000)]
Fix the include guard for the global serial port header

Change-Id: Iadd7fc49ad2dfdc9910b37f41056b0b66b532799
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years ago*nix: Added ENXIO errno code to detect ResourceError
Denis Shienkov [Sun, 24 Feb 2013 23:24:58 +0000 (23:24 +0000)]
*nix: Added ENXIO errno code to detect ResourceError

In MacOSX, when pull from the system is already opened USB/Serial
converter to returns ENXIO errno code. Seems it is a MacOSX specific (or
BSD specific) feature. So, now we can catch unexpected disappearance the
device from system on MacOSX.

Tested on MacOSX 10.6.8 & PL2303 converter.

Change-Id: I421e6936ca7b971a071ed6970538d01b23c888f0
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoRefactor the documentation management for the source
Laszlo Papp [Sun, 24 Feb 2013 18:29:36 +0000 (18:29 +0000)]
Refactor the documentation management for the source

* Other submodules use qtsubmodule.qdocconf instead of submodule.qdocconf

* They also use the QMAKE_DOCS variable to set that to the qtsubmodule.qdocconf

* They do not have .pri files for the doc folder

* They do not use the QT5DOC variable with "indexes" either. It should have been
indices with proper English, anyway.

* This also eliminates a warning about the "docs" target duplication

The docs is not fully complete yet, but the work is in progress. This is the
first step.

Change-Id: If33073d367fa7971fb57169d498f005766c166a9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoDo not add "core" to the QT variable as it is added by default
Laszlo Papp [Mon, 25 Feb 2013 20:31:31 +0000 (20:31 +0000)]
Do not add "core" to the QT variable as it is added by default

Change-Id: I8d30a47331bdb26f1531d214f5da830eca03d030
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoAssign a new method name for the port name setting API
Laszlo Papp [Thu, 21 Feb 2013 22:46:19 +0000 (22:46 +0000)]
Assign a new method name for the port name setting API

* This is more intuitive as it is not setting the port with all its settings
like baud rate, flow control, stop bits, parity, and so forth, but only the port
name.

* This will allow in upcoming change to establish a property for the port name
along with a port name changed signal to be useful from different threads, QML,
and so forth.

* Clean up the documentation not to provide internal information to the end
users, and also make the text a bit more concise and better readable.

* Examples are also changed accordingly, to use the new API.

Change-Id: Idbaa8ee2dee17c63fc0278f687ccc231c5ab670f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoDrop the Lines/Line terms in favor of PinoutSignals/Signal
Laszlo Papp [Wed, 20 Feb 2013 10:13:34 +0000 (10:13 +0000)]
Drop the Lines/Line terms in favor of PinoutSignals/Signal

Change-Id: Icc8c52dd32f918f13e9221e32ab7eeb11217f054
Reviewed-by: Ray Donnelly <mingw.android@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoRemove the device is not opened error handling
Laszlo Papp [Thu, 21 Feb 2013 22:38:48 +0000 (22:38 +0000)]
Remove the device is not opened error handling

1) DeviceIsNotOpenedError is wrong because it should be DeviceNotOpenedError to
be shorter without losing any part of the meaning.

2) QFileDevice does not have such a signal, so it is inconsistent and risky to
add on our own.

3) QFileDevice does not set any error either when trying to close a non opened
device.

4) I also think that, it is the correct operation because it is not an error
after all.

Change-Id: I6294754bf9f038d1e294b8f3b8aa2e1d53d81681
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
5 years agoMake the slots ordinary methods
Laszlo Papp [Thu, 21 Feb 2013 22:27:44 +0000 (22:27 +0000)]
Make the slots ordinary methods

* It does not make too much sense to have slots with boolean return value,
especially without calls.

* Q_INVOKABLE can be added later if the need arises.

* Other QIODevice subclasses do not have boolean slots either

* For the DataTerminalReady and RequestToSend mutators are pointless as they are
already bound to a property.

* The declaration fits closer to the accessors for those like with FlowControl,
Parity and so forth.

Change-Id: Ibc5123cd72323f73d9707be810550aeeb0c4cde0
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>