| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
This cleans up a small remainder related to data error handling.
Change-Id: I93a443b33ebe257977726ba1a25df51a16eae0b6
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Current approach with passing of the array's data pointer to a
Win API functions when the array is empty has potential danger.
Because the data pointer is invalid, and if a Win API function
tries to get access to this pointer then this can cause a crash
or an UB. Still this does not happens, but nobody guarantees
that this will be same in future.
It is better to pre-allocate the array with some size (e.g. with
the MAX_PATH size). In this case we can pass the data pointer
without any problem.
Besides, the Win API functions will return result with the first
pass if the array size is sufficient; otherwise it returns
ERROR_MORE_DATA error code and we can re-allocate the array with
required size and to return a result in the second pass.
We re-allocate the array with size more than required on some
bytes with filling of the array with zeros. This allows us to
convert it using QString::fromWCharArray() without specifying a
size, and to remove the toStringAndTrimNullCharacter() function.
(cherry-picked from 96b9590dbeb20e000d9d9308bee2162b1101a7e0)
Change-Id: I5976485286db4097514ea7b3a8adfc9a6a7cea4f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from 96b9590dbeb20e000d9d9308bee2162b1101a7e0)
Change-Id: Ida5f8f8b3374d52b6e20e560aff97cbdc1fe8776
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
| |
This fixes the build error which introduced from
ba204a95e6650a6992510530c1fa5a4dac2b5da8
Change-Id: I66a8a059826ede47f5ace9b86970bf91a2de1e26
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.
(cherry-picked from 23c89518d1404a4db570fe41f3cc04451703e16f)
Change-Id: I723253fb153a1144009579141fa0ce1aca93b648
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.
(cherry-picked from a1655d6ccf3f82508286b471819cc5e5cb64ff44)
Change-Id: I4ffc2f067787bc304a83326acb2a2421b428f986
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is impossible to fix the dataErrorPolicy property that it worked at
any platforms (this property does not work at all), besides, this
property was deprecated. Therefore we can use always only the
IgnorePolicy value for all cases, that will not be worse than it is.
It gives a chance to get rid of internal code, related to dataErrorPolicy
handling in favor to fixing of the Mark/Space parity handling, and the
Parity/Frame/BreackCondition errors handling.
(cherry-picked from 918b22aef140d293721f0d81ea8988c1d35db582)
Change-Id: Ib0c5d1396819aabe459002c5ca5cca5840052eff
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Now QSPI return a list of virtual serial ports
which are created by the tty0tty driver:
http://sourceforge.net/p/tty0tty/wiki/Home/
(cherry-picked from 55f39fe09aaf6208fd27c3c6060d4ab0171f77b1)
Change-Id: I7389b5ac656d54056baffd0922596feff9fe3788
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The virtual serial port drivers (such as com0com or tty0tty)
require all pairs of devices were open, otherwise any
I/O will fails. Seems, it is feature of com0com and tty0tty
drivers, and maybe others drivers of virtual devices.
There is only one waitForReadyReadWithTimeout() test which
opens the dummy device only in Windows. So, it is necessary
to open the dummy device on any platform.
(cherry-picked from 7fbc7cefcada03aa455bda305734663cf2b6a117)
Change-Id: I472238704fe200309b5015c2f9740d8e4b6cb41f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
It is not necessary any more. Now all tests with the
com0com serial ports are passed without this function.
(cherry-picked from ae4056a5e70df905a16716da3797ed297642a358)
Change-Id: I02b50ca5f28cf93e9e2731d3d0351607ffd2b814
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.
(cherry-picked from fbb9851fcf4a52220045f98a5e552ec5c04a978a)
Change-Id: I3cc0df6c5fba6c6fde38e0d49987b632f1aa571f
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.
(cherry-picked from eb0535c9701202d5f74fe1fc9b3b094bbecb8043)
Task-number: QTBUG-48094
Change-Id: I49a5389b089980b616b4e2ff815ce0b579752d0e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Testing of a single port with connected Tx and Rx pins doesn't
make sense since:
* It is necessary existence of a real physical port.
* It is impossible to set different speed for transmission
and reception (in common case).
Now the new test is deprived of these problems, it can reveal
real mismatch of speeds.
(cherry-picked from e07a665edef5a238e3f1b948bc3f5e3e244f2ab2)
Change-Id: I1c60a373b60198d9aa9cefc329c0817981232de8
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
| |
... such as baudRate, dataBits, parity, stopBits, and flowControl.
(cherry-picked from db27ac4672a0aa28abec2a301758ee14c385f350)
Change-Id: Ife5c2993e0c0302d06ef5f51a9fdc53f87f95896
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.
(cherry-picked from 23aedbb75bd6bb187756dc96157c49d79637362c)
Change-Id: I63e0c2c1c320ee4b98c8423963d78396f72eb3c2
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.
(cherry-picked from 3abd3ed07d2b30ecb2f8b9772ed5b3811bb9194b)
Change-Id: I4320c2e29ad42a394e07753cbaea804d0faf6b78
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
It is better to read the current DCB structure each
time before changing, than to have stored it locally.
(cherry-picked from 42fd000309fe72f0209b6432144bc1f3e6b2add2)
Change-Id: I487931469112d657c12d99a74aa577921c042f35
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
... because 500 msec is not enough for reopening of real USB serial port
in synchronousReadWriteAfterAsynchronousReadWrite test.
Tested with the USB serial ports from Prolific (PL2303).
(cherry-picked from 45bf94455c065b64dec65f354e62999b1c16cc7e)
Change-Id: Ic944567247d1b4a9971489289279b8191704d38c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
| |
Tested on Linux with the USB serial ports PL2303.
(cherry-picked from e21cd49963df7455fa4f11f9ad170b949c456dee)
Change-Id: I37b887c7f3a9abe98a83fbf8af9587de330097b3
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from 2610d81ead1fc755606e2bcd1418235bc0051d80)
Change-Id: I1275e80988274e2409455217d5ffb03014962604
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
| |
Change-Id: I518e1a4db36c21e04b1f52435f82ad447ff9ea03
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Commit a2758cf594dd08a21037873f64f72166a353aa29 introduced
a typo when the ParityError never will be detected.
(cherry-picked from 381e11d264cbb116d37ee83a4be2ed504bffb717)
Change-Id: I2e4948fab52ae9b9de482b15ecb630f1648c9978
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This error occurs at attempt to open an empty device name. In this
case we need to interpret it as QSerialPort::DeviceNotFoundError.
(cherry-picked from 8f7cd12c08095c17e96c3baf2076679529742023)
Change-Id: Icdf8cd5735bcc38e6ddc2ca9c326f0f993b5cd72
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
| |
(cherry-picked from f7d7eb2ca81905265fd428215b1d915d37142a94)
Change-Id: Ic85e246c6bd5a6684f44940fb1c229835083c9dc
Task-number: QTBUG-45391
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implementation based on the sysctl(3) system call,
in which undocumented features are used.
This implementation tested only with the USB devices,
because there is no opportunity to check it as well with
an other stuff.
Also still it is impossible to extract the description
and the manufacturer properties from the source, because
they are merged inside of one string.
Tested with the USB devices (FTDI, Prolific, ZTE, Samsung)
using FreeBSD v10.
(cherry-picked from 3e6308409dd679389e6231745e4d919d68d6487c)
Change-Id: I0091e4db70bfdfd4da199dd9d89dc78cf8f632b0
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
Change-Id: I643ee89df68a8a1673a4aa95dbad3bacfd34f9b5
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Commit 4328ab9709561842c680bc8bb7e4f2abc3ea3852 does not fix an issue,
because need to analyze ends of the deviceAbsoluteFilePath variable.
(cherry-picked from 78a66df196d0d99c3985f2247f010f36e350471a)
Change-Id: Idc16ab06bb06d5770fed2e05bd091fb53dd3307e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
There are no sense to keep the startAsyncWriteTimer object
when the device is closed. Because in next time the device
can be opened in read-only mode, and the startAsyncWriteTimer
will never used.
(cherry-picked from c0aebf3dfe3c6837db8f91d65ac4b6b7b44e100e)
Change-Id: I315ddfa88517087dcf708b0057a0e7c27cb1a3f1
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from 1d753e0b3a6aca6e506760962e500a0a701d378d)
Change-Id: I8057ab7b7a641c8f6abde8e9063fd2ee56fc1165
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.
(cherry-picked from 1651383fd030189366f2e13de4da3d37319e705e)
Change-Id: Iceb2e8c202b2b8d28fc87fa3a1b817df4caf39b9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from a72a6179f652385b24d63ffc8f68b23a0262c268)
Change-Id: I448179fd0ff07c45a3a7b74c675c8cc8e0579103
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
The receiver on other side should be opened even if it is not used;
otherwise the tests will be fails with the EINVAL error.
(cherry-picked from a5114f9a9249c5f3263c848d96600ea8e30f22da)
Change-Id: I85ff942c5b7e8276f22867921239bfc8933dac77
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.
(cherry-picked from 506370bfa0fc24a1fa1747fb28507d17b34dfcb4)
Change-Id: Ic9a0e7e5f4957b1c1aa0a4a593ff4621792ba637
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
| |
(cherry-picked from 4328ab9709561842c680bc8bb7e4f2abc3ea3852)
Task-number: QTBUG-47210
Change-Id: I0dbed3e4e4f09b40f07f700652a762e68c27711d
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
| |
... because earlier was used the temporal message which disappeared in
case of moving of the mouse cursor on the menu.
(cherry-picked from 0202ceea3a33f27c881a725ec9f7c1f35b8f9b49)
Change-Id: I7a7cb10120ffdd242a76e91ec08554db69e0f959
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
| |
Change-Id: Ib1dcece468c8a92f63bb45af7970711c6e3f3a09
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function toStringAndTrimNullCharacter() deletes only trailing zeroes
from right to left direction up to the first non-zero character were meet.
This can return the wrong string in case there are the zero characters to
the left of the non-zero characters.
We should look for the first zero-character from left to right direction,
and discard all right part of a string, including the zero-character.
(cherry-picked from 84de1b10d242551a51b6c4ce5eda657c4743bc63)
Task-number: QTBUG-47127
Change-Id: I4d101b49bbb153bddbe535a920d616b5fef130e9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from a2758cf594dd08a21037873f64f72166a353aa29)
Change-Id: Ic083cbd58e4e775ede0cdf610f61407003834207
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.
(cherry-picked from 8919ea86c80001be7e826f5363f1b7548c7a8091)
Change-Id: Ia7e4d617b863e2131175c52812cdf426ed963795
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If one wants to use the asynchronous approach (using the signals and
slots), and then - the synchronous (using the waitForXX functions) then
synchronous reading stalls because the waitForReadyRead() method
always returns the TimeoutError code.
The reason is that the signal readyRead() is emitted before the
startAsyncRead() (or the startAsyncCommunication()) called inside of
completeAsyncRead().
Need to emit the readyRead() only after the next asynchronous reading
(the startAsyncRead() or the startAsyncCommunication()) was cocked.
Now the behavior is similar to behavior of QWindowsPipeReader. Besides,
the auto-test which reveals this issue is added.
Tested with the virtual com0com serial ports, using the auto-tests and
set of the examples.
(cherry-picked from b32740001f735be9f0938f85d325dc2cf3dbe598)
Change-Id: I64bfb871d17c179f474d6672546e532566913a7f
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The method QSPP::initialize() calls the GetCommState() function,
which returns with the DCB.BaudRate field being 0. The subsequent
call of SetCommState() would fail because of that.
So, we need set DCB.BaudRate to any non-zero value (for example the input
baud rate, which defaults to 9600) before calling the SetCommState()
function.
(cherry-picked from 1eaa42c99d8442a40718b8560903b0bfeb401a0e)
Task-number: QTBUG-46993
Change-Id: I809246b13899733f9e0bd12b3667b23c0e43b00b
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Do not remove all read bytes from the input buffer,
but only the difference between the reserved ones
and the actual read ones.
(cherry-picked from 77c48a0e22c1048226832e6b845d72da9d5b317f)
Change-Id: Ib114e3972ec295f57d011ae9ffa6613313712e32
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Terminate the notifier thread instead of relying
that the 'running' member variable is evaluated.
Most of the time, the notifier thread is blocked
inside the ::WaitCommEvent() call, so even if the
main thread requests a close by setting 'running'
to false, the condition of the while loop is not
evaluated until some data come in on the serial
line, which might not happen in an acceptable time
frame.
WinCE supports proper termination of threads, so
there shouldn't be a problem with the new approach.
The code was tested on a WinCE7 system, closing and
reopening QSerialPort works as expected now.
(cherry-picked from 1c37490efc080593c2a1318e0c02f2f3c0b27dbf)
Change-Id: Ic311a1cc5d2a1f9a1aec6750faddd396e448dd46
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.
(cherry-picked from ad8b9773a2f996e988d7b0c4dd439a3e21ca8c09)
Change-Id: I5279e05d52ce5243ad3d0655c6353e1fb18891a1
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is make sense to check the returned QCFType<CFTypeRef> property on
the null-pointer and on the CFStringRef type to exclude of possible
exception.
Thanks to Orest Hera.
(cherry-picked from bc948f5f695908ad11a19b1336975d07ff1de0e1)
Change-Id: I09f784b9ce8aa471dfb53181798d0066945efc86
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CFTypeRef returned by IORegistryEntrySearchCFProperty sometimes may be
of unexpected type (as CFStringRef instead of CFNumberRef). In this case
the CFNumberGetValue() throws the exception.
The simplest fix is to check the type in searchShortIntProperty() before
calling CFNumberGetValue():
CFGetTypeID(result.as<CFNumberRef>()) == CFNumberGetTypeID().
Thanks to Orest Hera.
(cherry-picked from a7a4fa4b628526a5d9138ed56bb195be71bac118)
Task-number: QTBUG-46875
Change-Id: Id86993c008595f9762a08739bf4c5f5662643e92
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from b7f3086ef8f52a931ebe51fc065fcd813c913ef0)
Change-Id: I2b5b2ce8f193d09697f0a0b7e7cd1520cdf488bd
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The macro QT_DEPRECATED_SINCE was introduced in QSP because earlier any
branch of QSP had support both Qt4 and Qt5. But beginning from Qt5.5 the
Qt4 uses the separate branch, named as "qt4-dev".
Thus it is reasonable to replace all deprecation conditions on #ifdef
QT_DEPRECATED, similar to Qt4 sources for this branch.
Task-number: QTBUG-46154
Change-Id: Id8d008f2341cd14d0352293c4a2c00a367655afb
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
|
|
| |
This was missed since Qt 5.3.
(cherry-picked from 9177a6c473afde7207c53f4d72f015a16dbeeb5f)
Change-Id: Ifb00421dec915682fd35587128aae6bd36bd9c9e
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|
|
|
|
|
|
| |
(cherry-picked from da7a9e58a4b22ac7de087ed518139de5f06aebc5)
Change-Id: Iba0b5a63d225a469fd70125a90e306ef67f68cb9
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
|