qt:qtserialport.git
4 years agoDo not remove obsolete enum values for gcc and clang v5.2.0
Laszlo Papp [Tue, 3 Dec 2013 16:41:48 +0000 (16:41 +0000)]
Do not remove obsolete enum values for gcc and clang

Do not try to work around the gcc/clang limitations with external variables
since some people have some concern that it may break the binary compatibility
due to the underlying representation layout.

Talk to upstream (gcc) if a warning for this is desired. It is out of scope for
us. C++14 will help with the [[deprecated]] attribute, but that is light years
ahead.

Task-number: QTBUG-35354
Change-Id: I1c4e0fb950469adceca85147084fa896503de78b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
4 years agoDeprecate further Unknown* property values similarly to UnknownParity
Laszlo Papp [Sat, 30 Nov 2013 19:21:37 +0000 (19:21 +0000)]
Deprecate further Unknown* property values similarly to UnknownParity

Task-number: QTBUG-35215
Change-Id: Id8175af00c431cc8f80f05d518b3a2ee0e8ac71b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoObsolete the QSerialPort::UnknownParity enum value in QSerialPort
Laszlo Papp [Fri, 29 Nov 2013 06:17:49 +0000 (06:17 +0000)]
Obsolete the QSerialPort::UnknownParity enum value  in QSerialPort

Task-number: QTBUG-35215
Change-Id: I53af65ba485216a6fde238245580fe0422a2ed9a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoObsolete the isValid() method in QSerialPortInfo
Laszlo Papp [Thu, 28 Nov 2013 03:48:05 +0000 (03:48 +0000)]
Obsolete the isValid() method in QSerialPortInfo

Task-number: QTBUG-35184
Change-Id: Ie822943bcaf071024bc4f9782441b0534fcbd43d
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix the detection of PCI serial ports with sysfs and without udev v5.2.0-rc1
Laszlo Papp [Sat, 23 Nov 2013 21:49:33 +0000 (21:49 +0000)]
Fix the detection of PCI serial ports with sysfs and without udev

Unfortunately, 0973537c5471288726b929250199a41435729bee caused a serious
regression for obtaining detecting PCI serial ports without udev. This was
working before since the hard coded fallback mechanism has been up to this task,
but the sysfs alternative took the precedence over.

A note has also been added to the udev part of the algorithm because we will
need to obtain the vendor and product identifiers in a separate block in the
future. The vid/pid will be fixed in a separate change once that is well-tested.
This patch has no any risk as far as I can tell since it is just adding a new
short block to the existing code without much implication.

I have tested the change on Linux for my use cases with Qt 4 and then 5, and I
cannot find any regression. Everything works as expected both with udev and
without, i.e. with sysfs.

Thanks go to Aaron Linville for reporting the issue.

Task-number: QTBUG-35064
Change-Id: Ieae6f3e94559fb61ede67ff1d8810bb686d46383
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Aaron Linville <aaron@linville.org>
4 years agoFix the properties counter declaration place
Denis Shienkov [Sat, 9 Nov 2013 18:50:38 +0000 (22:50 +0400)]
Fix the properties counter declaration place

The properties counter shall count quantity of the processed properties for
the each found device.

Tested on Mac OSX 10.9 with Qt5, no regressions found.

Change-Id: Ie665c52dfdea5a0f9c358909e903703c41144a60
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd an entry in the 5.2.0 change for the extended Android lock file support
Laszlo Papp [Sun, 10 Nov 2013 08:51:57 +0000 (08:51 +0000)]
Add an entry in the 5.2.0 change for the extended Android lock file support

This should have been added in the change
030f4f7d8839f1f5070fd1f4d385e775c0ef66bd, but unfortunately it has been omitted.

Change-Id: I36b5134846c32e6246f2b5ff36470a52ff267e3e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoAdd a new simple and command line async reader example
Laszlo Papp [Sat, 26 Oct 2013 12:06:40 +0000 (13:06 +0100)]
Add a new simple and command line async reader example

Change-Id: I4142d187c3ad37d1e7f5219df3d50679a9f35a8e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd /dev/ttyO* to get the native serial port listed on Android with Beagleboard
Laszlo Papp [Fri, 8 Nov 2013 15:20:47 +0000 (15:20 +0000)]
Add /dev/ttyO* to get the native serial port listed on Android with Beagleboard

This type of serial port seems to represent the OMAP serial ports.

Change-Id: Ie4279cad96f68e618d24bbcd64da9cbc218a9937
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUnify the QString creation from udev return values (char*)
Laszlo Papp [Sat, 2 Nov 2013 16:29:54 +0000 (16:29 +0000)]
Unify the QString creation from udev return values (char*)

Change-Id: Ic69fd0d62d3097685bc8c3e25a7d8f6c696d7e2a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd a fallback lock file path (r/w) for Android
Laszlo Papp [Thu, 7 Nov 2013 18:07:29 +0000 (18:07 +0000)]
Add a fallback lock file path (r/w) for Android

Not sure this is the most suboptimal solution, but since the QLockFile usage is
not optional in QtSerialPort as of now, it allows us to get going for the
release with Android.

Change-Id: I4ee2658f76f14061d2f7e69e218a152a7235e524
Reviewed-by: BogDan Vatra <bogdan@kde.org>
4 years agoEliminate the crash on Unix caused by the QLockFile usage
Laszlo Papp [Thu, 7 Nov 2013 14:04:39 +0000 (14:04 +0000)]
Eliminate the crash on Unix caused by the QLockFile usage

We should not check against null because swap should always take place.
Initially, we do not construct a valid pointer guarded by the QScopedPointer
because not every constructor takes the portname argument, so it is possible to
create a QSerialPort instance without portname, and set it later.

Hence, removing the check makes sense, otherwise the smart pointer will guard a
null raw pointer which will cause crash all of a sudden when trying to be used.

Change-Id: Ib383f6eef2761ca5822585b848b0d29cce4eeb45
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix the build on Linux with Qt4
Denis Shienkov [Thu, 7 Nov 2013 11:59:53 +0000 (15:59 +0400)]
Fix the build on Linux with Qt4

Change-Id: I7bb118399182d316403ce9a2aa4b082b03158c1e
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoDoc: Updating the Qt Serial Port URL.
Jerome Pasion [Tue, 5 Nov 2013 15:28:47 +0000 (16:28 +0100)]
Doc: Updating the Qt Serial Port URL.

When Qt 5.2 is released, it will be at
 http://qt-project.org/doc/qt-5.2/qtserialport-index.html

Change-Id: I2b81f8546e3df25c952eaa917954bc4a5100d6c9
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoDoc: Updated url variable in qdocconf files.
Jerome Pasion [Tue, 5 Nov 2013 12:33:55 +0000 (13:33 +0100)]
Doc: Updated url variable in qdocconf files.

In 5.2, the HTML output is in a flatter structure and when they are
hosted in qt-project.org/doc, the documentation will be found at
http://qt-project.org/doc/qt-$QT_VER

The url variable is used by projects outside of Qt 5 which need
to link to Qt 5 documentation, such as Qt Creator.

Task-number: QTBUG-34584
Change-Id: Ice4793cdedb1d6287ce863221a831526fbb0f0a5
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoDefine QStringLiteral when undefined (e.g. Qt 4)
Laszlo Papp [Wed, 6 Nov 2013 08:37:47 +0000 (08:37 +0000)]
Define QStringLiteral when undefined (e.g. Qt 4)

This will allow us Qt 5 style coding. QLatin1String replaced everywhere where it
works for Qt 4 and 5, namely: the direct literal passing.

Note that the "standard" typo has also been fixed in this commit as the line had
to change anyway, so it is not much of an additional noise.

Change-Id: I8b7e4fe5f337441000bd3d8f58db528fdd0e175b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoUse the QLockFile source on Unix only to avoid errors on other platforms
Laszlo Papp [Wed, 6 Nov 2013 08:19:58 +0000 (08:19 +0000)]
Use the QLockFile source on Unix only to avoid errors on other platforms

Change-Id: I406ec1dc0a7e131db5ea93060e9a2adc47c50489
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUse local QLatin1Char as opposed to a static QLatin1String
Laszlo Papp [Sat, 2 Nov 2013 15:50:39 +0000 (15:50 +0000)]
Use local QLatin1Char as opposed to a static QLatin1String

Change-Id: I3bf8a439bef4edc86943d19b3f0e8d2e0dcbe0c4
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoReplace the home-grown QTtyLocker with QLockFile
Laszlo Papp [Wed, 6 Nov 2013 07:04:22 +0000 (07:04 +0000)]
Replace the home-grown QTtyLocker with QLockFile

This can be more widely adopted later, and not just for the Linux backend. It
would be more than a few-liner change for stable, so this change change is kept
minimal (of course apart from the big file integration).

The only big problem with QLockFile currently is that we cannot change the file
name on the fly as it seems, just for construction. Even the copy constructor
and assignment operators are private. It means the class currently seems to be
non-eligible for QtSerialPort needs where it is necessary to change for open
anytime, and be accessible by open/serial for the before and after read/write
session for the same file name.

Also, I had to get rid of the QTemporary file internals because we cannot have
access to the internal engine with Qt 4. I also had to make a small thread class
for the protected msleep in QThread for Qt 4.

There was a small improvement for the hidden dependency problem with
gethostname. That was also sent to QtCore proper. Also, the windows backend for
the QLockFile class is not copied for simplicity. It would not be used as of
now.

There is also a short convenience around QLockFile established to handle
system-wide lock file paths. There is also some error handling added if the lock
directory paths are not readable or writable. This will end users identify the
problems like on Android.

Tested on Archlinux with Qt 4 and then 5.

Task-number: QTBUG-34474
Change-Id: I7adf29527c01ad331d3eeff5ae4c5a4113bde083
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoAdd a new simple and command line async writer example
Laszlo Papp [Sat, 26 Oct 2013 09:53:16 +0000 (10:53 +0100)]
Add a new simple and command line async writer example

Change-Id: I8f33126de5c78da9a4a0dbddd16eecde7044f0c5
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd /dev/ttyHS(L)* to the hard coded uart list on Unix
Laszlo Papp [Fri, 1 Nov 2013 13:21:15 +0000 (13:21 +0000)]
Add /dev/ttyHS(L)* to the hard coded uart list on Unix

Some information can be found on the following link:

http://www.anyclub.org/2012/05/8960-android-gsbi-uart-debug-tips.html

Change-Id: Ie57d58f5a01c168ff9498694564e43e43c7919e3
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoMark most of the the data error policy as deprecated
Laszlo Papp [Fri, 1 Nov 2013 03:47:13 +0000 (03:47 +0000)]
Mark most of the the data error policy as deprecated

Unfortunately, this is a bit bad heritage of the QSerialDevice project. It is
not well-thought, and it was added in rush. If this feature ever comes back,
it has to be rethought and maybe redesigned. Currently, it is not much usable
nicely. It is done similarly to the following change:

https://codereview.qt-project.org/#patch,all,43441,7

Having done this, the users will get a warning, and they will hopefully stop
using it. Then, the feature redesign it for 5.3 or later. It can get
undeprecated anytime in Qt 5.X, but it cannot be removed with bumping the
library version. That should be the last resort.

In fact, this feature is very likely not to be redesigned. It is unfortunately a
broken concept. The following long-living serial port frameworks do not provide
"Policy" API either which is a clear sign for its usage pattern:

* PySerial
* Java SerialPort
* C#/.NET SerialPort
* QextSerialPort

... so to recap: it was not a good idea to introduce it.

Unfortunately, the side effect is that we have got warnings for the deprecated
method since moc cannot handle it properly. It needs to call it for internal
reasons.

Note that enum and Q_PROPERTY cannot be deprecated because Q_PROPERTY simply
cannot be, and the enum cannot be deprecated either since that would cause
further warnings for the library itself due its usage for the accessor and
mutator, etc. However, they can be put behind the QT_DEPRECATED_SINCE macro so
that the users can get compilation errors if they define
QT_DISABLE_DEPRECATED_BEFORE to get rid of old deprecated symbols easily by
getting errors instead of warnings.

The following coding can be run to show the expected warnings when used from a
QtSerialPort based application or library:

main.cpp:

int main()
{
    QSerialPort serialPort;
    serialPort.dataErrorPolicy();
    return 0;
}

==============================================================================

1) Qt 5

g++ -fPIC -Wall -DQT_DEPRECATED_WARNINGS -I/usr/include/qt -lQt5SerialPort main.cpp

main.cpp: In function ‘int main()’:
main.cpp:6:32: warning: ‘QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const’ is deprecated (declared at /usr/include/qt/QtSerialPort/qserialport.h:222) [-Wdeprecated-declarations]
     serialPort.dataErrorPolicy();

Tested on Linux with Qt 4.8.5 and then Qt 5.1.1.

==============================================================================

2) Qt 4

g++ -fPIC -Wall -DQT_DEPRECATED_WARNINGS -I/usr/include/qt4/ -lQtSerialPort main.cpp

main.cpp: In function ‘int main()’:
main.cpp:6:32: warning: ‘QSerialPort::DataErrorPolicy QSerialPort::dataErrorPolicy() const’ is deprecated (declared at /usr/include/qt4/QtSerialPort/qserialport.h:222) [-Wdeprecated-declarations]
     serialPort.dataErrorPolicy();
                                     ^

==============================================================================

Task-number: QTBUG-34429
Change-Id: Ia183817b841fb172d232f550b8402f7a314b8492
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd an initial changelog for 5.2.0
Laszlo Papp [Wed, 30 Oct 2013 20:36:01 +0000 (20:36 +0000)]
Add an initial changelog for 5.2.0

Change-Id: Ibe5b597a490c37b43434624bdf6d1d5be05a7ce4
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
4 years agoDisable QNX build
Andreas Holzammer [Thu, 31 Oct 2013 13:11:43 +0000 (14:11 +0100)]
Disable QNX build

Nobody tested the serial port and it does not
compile as CRTSCTS is not defined. Lets disable
it until its fixed.

Change-Id: Ifc032194773b166a7fd9502f5d7f518019d80c7c
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoRespect the configure script run for udev
Laszlo Papp [Tue, 29 Oct 2013 13:07:10 +0000 (13:07 +0000)]
Respect the configure script run for udev

Configure does not currently have an argument for udev, but still: it will try
to detect it and if it is available QT_CONFIG contains the "libudev" word.

We should respect that for Qt 5. Unfortunate, the configure script is not
checking this for Qt 4, so we still need to fall back to pkgconfig for Qt 4.

Change-Id: I9e755ee015f4f584e945cb176f1788b6dbac7374
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
4 years agoMake the return value void for methods that would always return true
Laszlo Papp [Tue, 29 Oct 2013 21:17:37 +0000 (21:17 +0000)]
Make the return value void for methods that would always return true

Change-Id: Iaa869b8b618db630d46726d7ebeac83e8a826af3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoFix a typo (or copy/paste) error for the comment
Laszlo Papp [Tue, 29 Oct 2013 20:52:14 +0000 (20:52 +0000)]
Fix a typo (or copy/paste) error for the comment

It is incorrect English in there, and also incorrect content what it tries to
explain. Also, it is not consistent with the rest like QtNetwork, i.e
QAbstractSocket.

Change-Id: Ibfca1314145e1c49cda7a3e77d9d9ac97d2b6dd2
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoSet the error in the same method where the check against failure is done
Laszlo Papp [Tue, 29 Oct 2013 20:36:46 +0000 (20:36 +0000)]
Set the error in the same method where the check against failure is done

This is done for consistency with other QIODevice subclasses, like in QtNetwork.
It also makes the code shorter due to the eliminated unnecessary Q_Q macro
usage.

Change-Id: Ibbd2be08e7aeff2bd0687d542cb256efb05f59bc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoMake the enum value descriptions consistent
Laszlo Papp [Tue, 29 Oct 2013 21:02:19 +0000 (21:02 +0000)]
Make the enum value descriptions consistent

Currently, they are inconsistent and very hard to read. Hence, the minority is
changed to follow the majority, and also the "table" style used throughout Qt.

I also added a line break where the value explanation is long to have a mode
explicit separate between the values. Otherwise, the flow of the text is too
crowded, and the reader can lost the track.

Change-Id: Ia14162b162357ec2c85be1726b7f220e1e6b6ec6
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoAdd support for loading udev at run-time
Laszlo Papp [Thu, 24 Oct 2013 23:22:16 +0000 (00:22 +0100)]
Add support for loading udev at run-time

QtSerialPort is linked against udev by default if the development files can be
detected on the system. The reason for this is that, it is more common to link
against udev than loading it at run-time. People will usually use distribution
packages where there cannot be inconsistency between different versions, and
hence ABI breaks, etc.

The relevant LINK_LIBUDEV variable will be set. This can be overridden by
defining LOAD_LIBUDEV for qmake:

    qmake "DEFINES += LOAD_LIBUDEV" -r

It is also worth noting that the common code is separated into a private header,
and it can be included for either type of libudev usage. There is no need
for its user to handle the compile-time linking or run-time loading separately
on top of that.

Task-number: QTBUG-34329
Change-Id: I45ffaaede2a74498587a6452fbe3fec7eaf83483
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix the broken example qdoc keyword value
Laszlo Papp [Sat, 26 Oct 2013 12:24:48 +0000 (13:24 +0100)]
Fix the broken example qdoc keyword value

The "cwritersync" example has been introduced in commit
9f8f2d6dc6f38b54a91f4a3d7ebf4285891005d3, and the "creadersync" example has been
introduced in commit ccdf42d9d10a32ccdd4a12c643130ffdea498552.

Initially, the "cwritersync" example was called "cwriter", but then it got
renamed to reflect the functionality more explicitly based on its name.

Having that renaming done, I had to sync up the writer and reader terms
everywhere, but this instance has been accidentally left out. It is not
intentional to have this name, so this is a bug.

This is a somewhat critical bugfix because it may trigger the example
unavailable from the main example page. Thereby, a useful example could become
useless for the end users.

Change-Id: I0f483ea037fc76a362f1d174b521075e8e9b0a3a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix a typo in the message printed to the stdout (creadersync)
Laszlo Papp [Mon, 28 Oct 2013 10:44:28 +0000 (10:44 +0000)]
Fix a typo in the message printed to the stdout (creadersync)

Change-Id: Ide7ab7b0841977f1132d243c82206edd85cc699a
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoClose the standard input right after reading to avoid duplicate calls
Laszlo Papp [Sat, 26 Oct 2013 08:37:51 +0000 (09:37 +0100)]
Close the standard input right after reading to avoid duplicate calls

Change-Id: Idd4b5bf996d57f0cd22a30496af3841f7d5a806a
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd a new simple and command line reader example
Laszlo Papp [Thu, 24 Oct 2013 18:21:22 +0000 (19:21 +0100)]
Add a new simple and command line reader example

Change-Id: I69c05be5db564888986925d943aff32221f5b310
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd a new simple and command line writer example
Laszlo Papp [Thu, 24 Oct 2013 12:53:16 +0000 (13:53 +0100)]
Add a new simple and command line writer example

Change-Id: I5d893d18477790def27bfa1fa051d459a8193db5
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix a typo in the examples (patity -> parity)
Laszlo Papp [Thu, 24 Oct 2013 13:06:47 +0000 (14:06 +0100)]
Fix a typo in the examples (patity -> parity)

Change-Id: I92b6fbe5fbc1a402919a8339086f495e351ca6dc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoRemove qFind usage from QSerialPortPrivate
Joerg Bornemann [Wed, 23 Oct 2013 13:18:39 +0000 (15:18 +0200)]
Remove qFind usage from QSerialPortPrivate

qFind is deprecated by now. See discussion at
http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I18f5be8e803af645df21d47c41d820b8f7fecfa7
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoDo not call CancelIo() in the AbstractOverlappedEventNotifier destructor v5.2.0-beta1
Denis Shienkov [Thu, 17 Oct 2013 15:24:23 +0000 (19:24 +0400)]
Do not call CancelIo() in the AbstractOverlappedEventNotifier destructor

This function is used for "CreateFile" calls as opposed to "CreateEvent".
Hence, the usage has been erroneous in here.

See the MSDN links below for further details:

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

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

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

It is also observed with a bit of testing that CancelIo() returns
ERROR_INVALID_HANDLE for some reason. This has not been tracked down though,
so it may be red-herring.

Change-Id: Ic2aea712763907dd9c9a32169702fa06308a7ee8
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoReplace the reinterpret_cast to qobject_cast for the QObject's
Denis Shienkov [Thu, 17 Oct 2013 13:04:38 +0000 (17:04 +0400)]
Replace the reinterpret_cast to qobject_cast for the QObject's

Change-Id: I883838a264345a6b3a1d73725f1385981513870b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
4 years agoAdd the Q_OBJECT macro to the notifiers
Denis Shienkov [Wed, 9 Oct 2013 14:25:20 +0000 (18:25 +0400)]
Add the Q_OBJECT macro to the notifiers

The notifiers are derived from QObject and shall have the Q_OBJECT
macro.

Tested the build on Windows, Windows CE, Android with Qt4 and then Qt5.

Change-Id: Ie860a02cb5e73b9af62e0f0b5de379e34c077c0e
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoRevert the incompatible qwineventnotifier.h for Qt4
Denis Shienkov [Thu, 10 Oct 2013 13:53:19 +0000 (17:53 +0400)]
Revert the incompatible qwineventnotifier.h for Qt4

The change

50ab4d4a8ff5f882b9699cbde26ad9d8824a4824

sync'd up the header file in question with the updates, but those
changes are incompatible with Qt4. This unfortunately means, a mix
has to be applied from both version.

Tested on Windows with Qt4 (MinGW).

Change-Id: I0468c03ccfb276096cfc3adf80bfc0b3488c81f2
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoDo not print a warning for the serialport closure if it is not open
Laszlo Papp [Fri, 11 Oct 2013 11:31:45 +0000 (12:31 +0100)]
Do not print a warning for the serialport closure if it is not open

This is necessary because end users will get a warning needlessly if the serial
port is not open when using the library.

There are two alternatives:

* Close in the destructor only if it is open.
* Do not print a warning.

The latter approach is more consistent with the other QIODevice subclasses, so
it is better to stick to that for now.

Change-Id: I918c203b1f5c52fba20de1373c298b8527a0e5a1
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoEliminate the ifdef in the code for imported headers (qt4support)
Laszlo Papp [Sun, 6 Oct 2013 05:22:16 +0000 (06:22 +0100)]
Eliminate the ifdef in the code for imported headers (qt4support)

As I previously wrote on Gerrit, this idea of resembling the include hiearchy
inside qt4support has two advantages:

1) The includes are well-separated for Qt 4 that are imported.

2) The code is less complex due to the non-existence of ifdefs for major Qt
variants.

The only disadvantage is that the build system got one additional line, but the
benefits outweigh that.

This has been (only build!) tested on Linux (Arch) with Qt 4 and then 5.

Change-Id: Ic33632cd0e569693a65af094479dac0a02b1a7f7
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd warnings to the methods requiring open serial port
Laszlo Papp [Tue, 8 Oct 2013 20:32:25 +0000 (21:32 +0100)]
Add warnings to the methods requiring open serial port

Change-Id: I441dcc6c94c75ceada684262b7ab68b5c3471aec
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoDon't link against QtGui in cenumerator
Alejandro Exojo [Wed, 2 Oct 2013 14:53:28 +0000 (16:53 +0200)]
Don't link against QtGui in cenumerator

Change-Id: Ibc730410bae66a8547733a66daa4d1dcb5808534
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoReturn in certain methods if the device is not open
Laszlo Papp [Sat, 5 Oct 2013 05:40:41 +0000 (06:40 +0100)]
Return in certain methods if the device is not open

This is necessary for a couple of methods because they require the port being
open for being functional. Hence, if the port is not open, they now return
properly on their own, and set the "NotOpenError" error code .

This has been (only build!) tested on Linux (Arch) with Qt 4 and then 5.

Change-Id: Ifc77bea581dd1832e188fa7562c5c1b15c0532e3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd an "UnknownSignal" value for the pinout signals
Laszlo Papp [Sat, 5 Oct 2013 18:14:34 +0000 (19:14 +0100)]
Add an "UnknownSignal" value for the pinout signals

This needs to be added to the API because there are situations where the serial
line state is unknown. The two typical use cases are:

1) The syscall cannot retrieve the state for some reason.
2) The serial port is not open.

This has been (only build!) tested on Linux (Arch) with Qt 4 and then 5.

Change-Id: I471a68b2e335b54d9a94071f08b1b31a6fb0056a
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoSet the NotOpenError error code also for closing
Laszlo Papp [Sat, 5 Oct 2013 09:01:12 +0000 (10:01 +0100)]
Set the NotOpenError error code also for closing

Change-Id: Iacf0235bd64bca8fbe4e2ce2c652cd89d3136b2f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoDocument that the serial port parameters cannot be set before opening
Laszlo Papp [Thu, 3 Oct 2013 23:53:23 +0000 (00:53 +0100)]
Document that the serial port parameters cannot be set before opening

Task-number: QTBUG-33774

Change-Id: I21893547ff9debc3be9f972c77ce2a306fe60d7f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoFix a grammar issue of the open method documentation
Laszlo Papp [Thu, 3 Oct 2013 23:31:23 +0000 (00:31 +0100)]
Fix a grammar issue of the open method documentation

Change-Id: I158a5a66af5c07d4454a559d4e5d6b7a666f43a7
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoAdd a new error value called "NotOpenError"
Laszlo Papp [Thu, 3 Oct 2013 23:07:53 +0000 (00:07 +0100)]
Add a new error value called "NotOpenError"

This error message is used when the serial port parameter setters are called
even though the serial port is not open, and it should be.

The details are very similar to the previously introduced TimeoutError, as in:

1) The "\since 5.2" notion has to be added manually as qdoc has no support for
enumeration values in that regard.

2) The value itself has to be added at the end of the enumeration not to break
the binary compatibility unnecessarily. It is fine as long as the error
documentation for the end users can be kept in the order we wish to do.

Each method documentation already contains the information that the error is set
properly when that occurs, so this change can be considered as a bug fix rather
than a new feature. It is a behavior change of course just as any bug fix.

The previous operation was wrong to go ahead down to the syscalls even though
the serial port was not open. Thereby, that was a bit pointless.

Unfortunately, there is no similar error introduced for the existing QIODevice
subclasses just yet, but this term is at least inline with the open mode of
QIODevice which is "NotOpen".

For sure, when the parameter setters are called by the end user without the
device being open results false return value as per method documentation.

This change was tested on Linux with Qt 4 and then 5.

Change-Id: I1bc7309e34bdf59793f1de510866dae1bb48b539
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUse the "\note" qdoc command instead of the raw "Note" term
Laszlo Papp [Thu, 3 Oct 2013 23:57:57 +0000 (00:57 +0100)]
Use the "\note" qdoc command instead of the raw "Note" term

Change-Id: If9631df1be0a164140c95b52e8537fc849709ee9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoRefactor the blocking master documentation
Laszlo Papp [Fri, 27 Sep 2013 23:57:30 +0000 (00:57 +0100)]
Refactor the blocking master documentation

Change-Id: I67e1eb66c5661f6830389189a323aa7f97e474f9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoUpdate the git-archive export options
Sergio Ahumada [Fri, 27 Sep 2013 14:27:46 +0000 (16:27 +0200)]
Update the git-archive export options

The .gitattributes, .gitignore, .commit-template files do not need to be
present in packaged sources, as they are for people using the Git
repository.  People who download tarballs usually don't reimport into
Git -- they should just download the actual repositories.

Meanwhile, the .tag file is quite useful. Instead of making Git extract
to the useless SHA-1 of the "$Id$\n" string, ask git-archive to store
the SHA-1 of the commit being packaged.

Change-Id: I2473014da9053790099711d435317601085b8414
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
4 years agoDoc: Review QtSerialPort documentation
Nico Vertriest [Mon, 23 Sep 2013 11:12:30 +0000 (13:12 +0200)]
Doc: Review QtSerialPort documentation

Adapted to review comments

Task-number: QTBUG-32173

Change-Id: I41839934c3aea9ccf3ef596e2a869b479f3c75ba
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
4 years agoDoc: minor changes to index.qdoc v5.2.0-alpha1
Nico Vertriest [Tue, 24 Sep 2013 08:52:06 +0000 (10:52 +0200)]
Doc: minor changes to index.qdoc

index.qdoc of QtSerialPort

Task-number: QTBUG-32173
Change-Id: I0cc4a3fd0b469d344da952dfd1042e431e043a4b
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Martin Smith <martin.smith@digia.com>
4 years agoMerge remote-tracking branch 'origin/stable' into dev
Sergio Ahumada [Sun, 22 Sep 2013 20:13:32 +0000 (22:13 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I4694207fc852aefd7302c2db9153c37f304cc3c4

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 agoUse sysfs on Linux when available
Denis Shienkov [Tue, 27 Aug 2013 11:53:29 +0000 (15:53 +0400)]
Use sysfs on Linux when available

This change is the continuation of the previous:

* sha1: 4bdbbe4c87676ca94daae947ac5908d77966319b

The previous operation was to use the nodes in the "/dev" hierarchy.
The "sysfs" was only used for extending the information that cannot be
obtained from "/dev", like manufacturer, description of the device, etc.

This decision had a shortcoming of expansion of the list of filters in
case of appearance the new device with the new name. Besides, the Linux
kernel has a lot drivers, each of which provide a various names for an
serial devices, so we can't know all these names.

Now the sysfs is used directly, without filters. To search for devices
we use an appropriate "/sys/class/tty" directory that contains all
necessary info.

Notes:

* There are possible some regressions relating to enumeration of rfcomm,
ircomm devices. Because this devices can belong to other subsystems
which we do not process and skip at present. It needs to be checked and
submitted the set of next patches to fix it.

* If sysfs is not available, the fallback algorithm uses the "/dev"
hierarchy by having a predefined device entry list.

Tested on:

* Fedora 19 Desktop Edition (64-bit)
* Ubuntu 12.04.2 LTS (32-bit)

with on-board (PnP) and pluggable (USB) devices using Qt4 and then Qt5.

Change-Id: Ia242bb2ed81d17b6f826a187454bb9d2a12d40a9
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 agoMerge remote-tracking branch 'origin/stable' into dev
Sergio Ahumada [Wed, 18 Sep 2013 19:48:02 +0000 (21:48 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: Iac1dd793d34782bc2d208f17654c4962630d0da7

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 agoMerge branch 'stable' into dev
Sergio Ahumada [Fri, 6 Sep 2013 12:34:54 +0000 (14:34 +0200)]
Merge branch 'stable' into dev

Change-Id: Ie8f70b5101225453355a1eb6b0fdc3f3d8a34824

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 agoAdd a "manual since" for the TimeoutError introduced in 5.2
Laszlo Papp [Tue, 3 Sep 2013 20:14:20 +0000 (21:14 +0100)]
Add a "manual since" for the TimeoutError introduced in 5.2

The commit 0f13f6ff introduced this for 5.2, but then "since" tag was ignored as
there is no such support available by qdoc. Still, it is useful to make the end
users aware of this manually.

Change-Id: I46a642ddb8443f5c87d47709fa52921d7fd637a3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoRevert "Android: Fix compilation on Necessitas Qt SDK v 1.0.0"
Laszlo Papp [Tue, 3 Sep 2013 11:58:18 +0000 (12:58 +0100)]
Revert "Android: Fix compilation on Necessitas Qt SDK v 1.0.0"

This reverts commit b80b2eff9d4f0ce86ac168bc758580d6587d0b87.

This change is broken, and was integrated by misleading concepts. This has to be
reverted, and the proper fix will come from stable when the merge happens.
Otherwise, the merge will be painful for the people doing it without expertise
and external communication.

You can find the change on the following URL with the proper design to address
the issue:

https://codereview.qt-project.org/#change,64320

Change-Id: Ib77f2941a7c24a7b0597a4882e7f35b88b7802ee
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 agoAndroid: Fix compilation on Necessitas Qt SDK v 1.0.0
Denis Shienkov [Wed, 21 Aug 2013 20:34:04 +0000 (00:34 +0400)]
Android: Fix compilation on Necessitas Qt SDK v 1.0.0

It is the first experimental patch to start integration of support of
Android for QtSerialPort. Therefore for build of library it is necessary
to exclude examples and tests.

In this patch was corrected the tcdrain() function. The main problem is
that Android supports this function, beginning from version 4.2 and above:
* https://android.googlesource.com/platform/bionic/+/android-4.2_r1/libc/include/termios.h

I.e. for support of this function the Android API Level shall be more or
is equal 17, see:
* http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

Therefore for the smaller API levels we are stimulated to implement the
tcdrain() function manually, having simply copied its implementation from
the source codes of Bionic libc.

Task-number: QTBUG-33117
Change-Id: I05b5765a4044d24358a07d60bca1ef32b35f9630
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
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 agoAdd API for handling the time out errors when waiting for read or write
Laszlo Papp [Wed, 21 Aug 2013 05:21:06 +0000 (06:21 +0100)]
Add API for handling the time out errors when waiting for read or write

Task-number: QTBUG-32680
Change-Id: I1e69bea596b45867119c681bd22abba6dbb1861c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
4 years agoLinux: Getting properties of USB devices if has no libudev
Denis Shienkov [Fri, 19 Jul 2013 00:23:41 +0000 (00:23 +0000)]
Linux: Getting properties of USB devices if has no libudev

This decision is based on parse of contents of /sys directory.

Many distros of Linux use /sys as a virtual file system to export data
from the kernel to userspace applications. Thus this decision shall
work only at those kernels in which are this feature is enabled at
assembling.

The initial path are received from the symlink
"/sys/class/tty/<device name>", that points to the lowest kernel node
with the device properties.

For this path name is starting an analysis of matching to the
keywords of subsystems (e.g. "pnp", "platform","usb" and so forth),
which by implication characterize the type of the device.

The device type is used to define a choice of further algorithm of
passing each parent directory:

* For "pnp" devices (standard onboard devices): The device info with
empty properties is added directly to the resulting list. Because we
still can not get desired properties for "pnp" devices.

* For "platform" devices (pseudo terminals): Skip processing and don't
add to the list. Because pseudo-ports aren't support by the library.

* For "usb" devices: Pass each parental directory and look the "events"
key file. From this file it is reading contents and to find in it the
predetermined set of "magic" keywords. If all keywords are found, then
we can be sure that current directory is the required. Contents of
files "product", "manufacturer", "idVendor", "idProduct" is give
requested properties of the device.

* For other devices: Skip processing and don't add to the list.

This decision was tested in ArchLinux x64 and Fedora 19 x64 with the
onboard serial ports, USB PL2303 converter and USB modem ZTE MF180.

Change-Id: I5a736a98656e8767b713af837f8b52557176c236
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@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 agoAdd function to get serial port handle
Alex Henrie [Tue, 6 Aug 2013 05:46:25 +0000 (23:46 -0600)]
Add function to get serial port handle

Sometimes the Qt functions are just not enough, and for this reason Qt
provides functions like QFileDevice::handle(), QAbstractSocket::
socketDescriptor(), QWidget::winId(), and QProcess::pid(). QSerialPort
should do the same. In my case, I find that QSerialPort is easy to use
and works nicely with the rest of Qt, but my application needs to set
TIOCNXCL right after the serial port is opened.

Change-Id: Ie740e478b5825fa2e699ead079d78c514a0caef4
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Mika Korhonen <mika.j.korhonen@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
4 years agoMerge branch 'stable' into dev
Sergio Ahumada [Mon, 5 Aug 2013 08:30:57 +0000 (10:30 +0200)]
Merge branch 'stable' into dev

Conflicts:
.qmake.conf

Change-Id: Ie3c806147c8de043834f9a74b42a768e265d4529

4 years agoDoc: Setting \qtvariable in module page.
Jerome Pasion [Fri, 2 Aug 2013 12:05:48 +0000 (14:05 +0200)]
Doc: Setting \qtvariable in module page.

\qtvariable indicates the QT variable needed in .pro files.
QDoc will place the QT variable in the class documentation.

Change-Id: I22437154f6808f9eba810d0e35ccae59782fc051
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Martin Smith <martin.smith@digia.com>
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 agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Tue, 23 Jul 2013 09:15:51 +0000 (11:15 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I019d89af398aeef55b36dba4380ef0e65b627af2

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 agoMerge remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Thu, 11 Jul 2013 21:27:39 +0000 (23:27 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I421181abd989c88afad14763da25e2406762b7f3

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 remote-tracking branch 'origin/stable' into dev
Frederik Gladhorn [Thu, 4 Jul 2013 13:33:56 +0000 (15:33 +0200)]
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: I8911bb334d062892ef34cd555ce78badd5835969

4 years agoDoc: Setting navigation variables.
Jerome Pasion [Wed, 26 Jun 2013 11:23:00 +0000 (13:23 +0200)]
Doc: Setting navigation variables.

-For Qt 5.2, a navigation bar is implemented:
 b11cb96f282fb1037ad31fbafe279c9a8a8dfeda (qtbase)
-The navigation variables point to pages displayed on the
 navigation bar.

This commit follows the pattern in this commit:
200cad26f258a998d3dc8089445d2c6ae9639ab5 (qtbase)

Change-Id: I56f61af54c782f3167050b0a9d0699cd86936d52
Reviewed-by: Laszlo Papp <lpapp@kde.org>
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