| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Following code snippet:
QSerialPort serial("/dev/ttyUSB0");
serial.open(QIODevice::WriteOnly);
serial.write("ABCDEF");
serial.waitForBytesWritten(-1);
causes an application crash if some of data will be received by the
serial port.
Reason is that qt_poll_msecs() triggered with POLLIN event, even if the
device is opened with O_WRONLY flag. In this case the readNotification()
handler is called, which trying to reserve some space from the
uninitialized read QRingBuffer, that causes an assertion.
Solution is to don't use the POLLIN event if device is open with
O_WRONLY flag.
Change-Id: I205be31608359f52b5ef286a33dd266ed11a2649
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
examples/serialport/blockingmaster/masterthread.h
examples/serialport/blockingslave/slavethread.h
Change-Id: I6b6bf25b41ff0f1b0b9632069d3b13f6c47c6421
|
| |
| |
| |
| |
| |
| |
| |
| | |
Qt includes should be added before platform-specific includes.
Change-Id: Ie8bcf306c9e0f3d5d719ee57bcddc8bd2967f5cb
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It makes sense to use the
QStandardPaths::writableLocation(QStandardPaths::TempLocation)
directory for any of Unix-like platforms, as a 'last resort'
to store the lock-files, if no other preferable directory
was found.
Change-Id: Ifd1a5789c014388509b29837171d3fdc440d63e6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
| |
| |
| |
| |
| |
| | |
Change-Id: I844f5102077e7b4d5240947a614bfb163c8b7890
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
|
| |
| |
| |
| |
| |
| | |
Change-Id: I12da9eb3a57fc312fb4b029714166af10755ca76
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
|
|/
|
|
|
|
| |
Change-Id: Ia7491b477bac319a8e0ee1a3e20778c8078edb15
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
.qmake.conf
src/serialport/qserialport_win.cpp
Change-Id: Icc832e218a1135cb82e780ccaa63abd990289eaf
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the user calls setReadBufferSize() with a value lesser than the
current size of the read buffer, then we get UB in readNotification():
readFromPort(nullptr, some_negative_value);
Change-Id: Iddf5838c84c8615670285e9883c48f29faacc07e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Read notifications should be enabled all the time while the device is
opened unless the buffer size limit is reached. To enable the read
notifier again, the user needs to read the data or enlarge the buffer
with a setReadBufferSize() call.
According to that scenario, it's very likely that the device will
toggle the state of notifier twice (on->off->on) in one notification
cycle. This patch prevents this unnecessary toggling by:
- unconditionally setting the notifier's state in setReadBufferSize()/
readData();
- deferring the notification disabling in readNotification() on Unix
and in completeAsyncRead() on Windows to the next notification
cycle.
Change-Id: I97fc041bb705c034a7e73d1437e64b9b34dc2c18
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|/
|
|
|
|
|
|
|
|
|
| |
This reduces the number of syscalls and thus the CPU load when dealing
with fast ports. And 32KiB seems still small enough to be no concern on
modern hardware even if it's excessive for a given port.
Change-Id: I4749e4255627d3abf2393323216e01ac6436413b
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
| |
Change-Id: I77f015100f2b9ed5e1a16ebd1ba0b28216282085
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the user calls QSP::close() in a slot which is connected to the
QSP::error() signal, then the application is crashed. The reason is that
we emit the QSP::error() signal before than we call QRingBuffer::chop()
of an internal read buffer, which becomes invalid after the
QIODevice::close() called. Therefore, we need just call
QRingBuffer::chop() before than the QSP::error() signal will be emitted.
Task-number: QTBUG-55847
Change-Id: If536f9cf5cbc1b813d3642bdf9be0867e06368e8
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
... to add the data to the internal QIODevice's buffer,
that simplified the code and is more reliable.
Change-Id: I61e6c7be3259cd754e4bbe6a3142dcdd6d33f7b6
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the method QSP::open() several times calls the system
functions to get/set of DCB/termios structures for each parameter.
It is not rational and should be minimized as possible, in ideally
to once executed.
Change-Id: If1f308176a82f3c8896fc648bf656f089e099f3f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
We can use nullptr since Qt 5.7.
Change-Id: Id5354280d6a94b2c1f4c5967c65a22db878eca3e
Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|\
| |
| |
| | |
Change-Id: I2e0737fab1c12657d8dc7de5d1882ecb73bbb5f2
|
| |\
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
.qmake.conf
Change-Id: I6a4c3e446633e6f142b87c268096b1bdc1598a62
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
... as deleting of a null-pointer it is a valid operation.
Change-Id: Ia4ffd8b69ab75b9e3b200ce2ce999ab2820b915e
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
|
| | |
| | |
| | |
| | |
| | |
| | | |
Change-Id: I057267982ac946ce1ec863a79120cd21cd563c4b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
... due to 'forever' is planned to be deprecated in Qt,
and as 'for' is standard keyword.
Change-Id: I05bec96d637389a22a2633e4b2bd8384ba17de10
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
|
| |
| |
| |
| |
| | |
Change-Id: I7228af796b440790862d22026fa99f96881e39c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
|/
|
|
|
|
|
|
| |
Update old header.LGPL3 to header.LGPL
Change-Id: I1b17b6f798ee521d2e3bd8c37024df7cd65ee0c4
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the error signal is connected to a slot which calls QSP::close()
and an error occurs in this method, this would lead to infinite recursion.
Other Qt I/O classes avoid this problem by not emitting errors while
closing the device, so we should not, either.
Task-number: QTBUG-50052
Change-Id: Icfbcb19c32b8bd7fc586ab5253dc754e78829f11
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: I1f7b5436a00dec545f6256d15147abd43f92767b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the Android x86 NDK, the termios2 struct is already defined.
On ARM, it isn't defined until android-21, which is not what we
build against by default.
We should probably look for a more robust solution to this, to
support platforms where this is defined, but for now the main
issue is fixing the build.
Change-Id: I6084a90f664f9f778e6d1689106a3fb9a7ad0b2f
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
| |
We need to use the Q_OS_OSX macro instead, because Q_OS_MAC is deprecated
and also includes iOS, which we do not support.
Besides, the *_mac file is renamed into *_osx.
Change-Id: Id8a55f4d159e6a301f508cfce37ae5e39a0b9b2a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Commit qtbase/ed0c0070f9b05c647019270dfc42073d071c830a
introduces a new helper function qt_subtract_from_timeout()
which can be used to reduce a code duplication.
Change-Id: I5c4941360f524225c14eac8c308fb16a546c802f
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
|
|
|
|
|
|
| |
Change-Id: Ida5f8f8b3374d52b6e20e560aff97cbdc1fe8776
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now it is used the qt_safe_select() function similar to the Qt socket
engine.
Tested on Linux (kernel 4.1.7) with the USB and virtual tty0tty
serial ports.
Change-Id: Icd7a443ee5e0b5d6453a6e9973930f41e1313eeb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
When the read buffer with a limited size is used, the read notifier
becomes disabled when the buffer completely is filled. The notifier
should be enabled again when several bytes were read from the read
buffer.
Change-Id: I723253fb153a1144009579141fa0ce1aca93b648
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is impossible to implement all these features on all platforms,
and particular drivers may not support them, too.
Consequently, the user should handle such errors themselves by applying
platform-specific ioctls on the device descriptor and/or parsing the
stream's byte-stuffing.
This commit also deprecates ParityError, FramingError, and
BreakConditionError.
Tested on Windows and Linux with the virtual and the
USB serial ports.
Change-Id: I4ffc2f067787bc304a83326acb2a2421b428f986
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
It is impossible to use a custom speed on Linux and OS X for the
separate direction; the custom speed always sets for all directions at
once.
Change-Id: I3cc0df6c5fba6c6fde38e0d49987b632f1aa571f
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a long time the Linux kernel has support new version of
the termios structure (V2). To setup the user speed it is
necessary to do following steps:
* Query current content of termios2 by calling the ioctl() with
the TCGETS2 flag.
* Add to the c_cflag field the BOTHER flag.
* Set to the c_ispeed/c_ospeed fields an actual values of custom speeds.
* Write new content of termios2 back by calling the ioctl() with the
TCSETS2 flag.
This new method much simpler and is more transparent in implementation
than changes of a custom divisor. It is preferable and will be used
by default for all cases. If for some reason a current Linux kernel
doesn't support the termios2, then will be falling back to the old
method with changing of a custom divisor.
Tested with the on-board and the USB (PL2303) serial ports.
Task-number: QTBUG-48094
Change-Id: I49a5389b089980b616b4e2ff815ce0b579752d0e
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Massimo Callegari <massimocallegari@yahoo.it>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
It is better to read the current termios structure each
time before changing, than to have stored it locally.
Tested with the USB serial ports.
Change-Id: I63e0c2c1c320ee4b98c8423963d78396f72eb3c2
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The internal implementation of this is a little tangled. It is
reasonable to simplify it:
1. Remove the setBaudRate_helper() method, as it is equivalent to
setStandardBaudRate() method.
2. Now the setStandardBaudRate() and the setCustomBaudRate() are
self-sufficient methods (can setup a speed and an error codes
internally) and return a boolean values.
Also added the "loopback" test for check of different speeds.
Tested with the on-board and the USB serial ports.
Change-Id: I4320c2e29ad42a394e07753cbaea804d0faf6b78
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: I1275e80988274e2409455217d5ffb03014962604
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This avoid of the errors when the triggered notifier tries
to handle an already closed device descriptor.
Tested on Windows and Linux with the USB serial ports.
Change-Id: Iceb2e8c202b2b8d28fc87fa3a1b817df4caf39b9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to documentation on QObject::event(), we need to return true
in case the event was recognized and processed.
In addition, were made small modifications related to the Qt coding
style.
Tested on Linux with the virtual tty0tty serial ports.
Change-Id: Ic9a0e7e5f4957b1c1aa0a4a593ff4621792ba637
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: Ib1dcece468c8a92f63bb45af7970711c6e3f3a09
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: Ic083cbd58e4e775ede0cdf610f61407003834207
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes the error string would contain a wrong description which
did not correspond to the system error code. The reason was
qt_error_string() being called too late, when the system error
might have already been overwritten.
The error processing is now in QSPP::getSystemError(), which returns both
the error code and the error description as soon as possible.
* Now the QSPP::getSystemError() returns the new class
QSerialPortErrorInfo which contains all necessary fields.
* The new method QSPP::setError() which accepts the
QSerialPortErrorInfo as input parameter is used.
* The old private method QSP::setError() is removed, because
it is not used anywhere.
Change-Id: Ia7e4d617b863e2131175c52812cdf426ed963795
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Commit ad56086040e6b40565214380b083ecf986924f92 does not solve it,
because a lock-file path does not contain the device name, but now
this issue is fixed.
Task-number: QTBUG-45338
Change-Id: I876a588b035b8a8e97ff5af76f6833ae340bf7b5
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
It is not worth to spread the platform-specifics over multiple
files, as the difference are actually tiny and much better
expressed with an ifdef.
Change-Id: I5279e05d52ce5243ad3d0655c6353e1fb18891a1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because we now (in the Qt 5.5 branch) use QIODevicePrivate's internal read
buffer directly, there is no need to call buffer.read() in QSP::readData().
There is also no point in keeping the platform-specific implementations of
QSPP::readData(), so remove them.
Tested on Windows using the virtual com0com serial ports, and on
Linux usig the virtual tty0tty serial ports.
Change-Id: I136c6d10708cc6fc99a77c351c3945470530845d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When running the App Sandbox, a system has no any temporary directories
which can be shared between applications (or, maybe, it is configurable
option):
* https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AboutAppSandbox/AboutAppSandbox.html
In this case QSP::open() can not create a lock file that lead to fails
when opening.
Workaround it is to use the
QStandardPaths::writableLocation(QStandardPaths::TempLocation) for receiving
a temporal directory of application. Where the writableLocation() implicitly
uses the NSTemporaryDirectory function that is the recommended way
(see "The App Sandbox Container Directory") in here:
* https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW4
This will allow to open the serial port, but the locking feature will not
work properly.
Task-number: QTBUG-45338
Change-Id: Iea52aada11493126b0f58c40488c38c86f69fca5
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: I3943ff6b8fee2f651317ddbaa40ef0d27dac6475
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
For QLatin1String, startsWith/endsWith/append/operator==/... are overloaded,
so use QLatin1String instead of QStringLiteral in such cases.
Change-Id: Id040697480b7b7f195a2b83bb85ba7e0199d38e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
|
|
|
|
|
|
|
|
| |
It is the recommended coding-style which is used in the Qt core.
Change-Id: Id2efc3b2276b2d86d75fe0b7240077dbb61286f0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
|
|
|
|
|
|
|
|
| |
Silences the following Valgrind warning:
Conditional jump or move depends on uninitialised value(s)
Change-Id: I8fd8cfd6aa6f75ed515e6151cfc282faca508bdc
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|