summaryrefslogtreecommitdiff
path: root/src/serialport/qserialport_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-071-1/+1
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf src/serialport/qserialport_win.cpp Change-Id: Icc832e218a1135cb82e780ccaa63abd990289eaf
| * Fix possible UB in read() under UnixAlex Trotsenko2017-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | Improve read performance when the buffer size is limitedAlex Trotsenko2017-04-261-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Increase buffer chunk sizesDenis Shienkov2017-04-261-1/+1
|/ | | | | | | | | | | 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>
* Fix build with API >= 21BogDan Vatra2017-02-231-1/+7
| | | | | Change-Id: I77f015100f2b9ed5e1a16ebd1ba0b28216282085 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix crash after closing of ejected device on LinuxDenis Shienkov2016-09-211-3/+2
| | | | | | | | | | | | | | | 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>
* Use append() instead of memcpy() where possibleDenis Shienkov2016-07-071-1/+1
| | | | | | | | | | ... 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>
* Minimize number of system calls at openingDenis Shienkov2016-07-071-92/+129
| | | | | | | | | | | 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>
* Replace 'Q_NULLPTR' and 'NULL' with 'nullptr'Denis Shienkov2016-06-171-3/+3
| | | | | | | | | 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>
* Merge 5.7 into 5.7.0Oswald Buddenhagen2016-05-201-10/+6
|\ | | | | | | Change-Id: I2e0737fab1c12657d8dc7de5d1882ecb73bbb5f2
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-8/+4
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6a4c3e446633e6f142b87c268096b1bdc1598a62
| | * Remove superfluous check during removal of the pointerDenis Shienkov2016-05-041-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | ... 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>
| * | Replace 'Q_FOREACH' with the range-based 'for'Denis Shienkov2016-05-131-2/+2
| | | | | | | | | | | | | | | | | | Change-Id: I057267982ac946ce1ec863a79120cd21cd563c4b Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Replace 'forever' with 'for(;;)'Denis Shienkov2016-05-201-1/+1
|/ / | | | | | | | | | | | | | | ... 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>
* | QSerialPort: Replace select with poll on UnixLouai Al-Khanji2016-02-051-13/+11
| | | | | | | | | | Change-Id: I7228af796b440790862d22026fa99f96881e39c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Unify license header usageAntti Kokko2016-02-021-13/+19
|/ | | | | | | | 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>
* Suppress error emission when closingDenis Shienkov2016-01-111-8/+4
| | | | | | | | | | | | 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>
* Keep a fractional part of custom baud rate in a debug outputDenis Shienkov2015-12-311-3/+3
| | | | | | Change-Id: I1f7b5436a00dec545f6256d15147abd43f92767b Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix build on Android x86Eskil Abrahamsen Blomfeldt2015-11-061-0/+2
| | | | | | | | | | | | | 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>
* Do not use deprecated Q_OS_MAC macroDenis Shienkov2015-10-151-4/+4
| | | | | | | | | | | 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>
* Use qt_subtract_from_timeout() to reduce a code duplicationDenis Shienkov2015-10-101-3/+3
| | | | | | | | | | 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>
* Remove unused QSPP::baudRateFromSetting() methodDenis Shienkov2015-10-061-5/+0
| | | | | | Change-Id: Ida5f8f8b3374d52b6e20e560aff97cbdc1fe8776 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Use the qt_safe_select for waitForXX functions on *nixDenis Shienkov2015-10-051-3/+3
| | | | | | | | | | | | 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>
* Fix stalling of reading with the limited buffer size on *nixDenis Shienkov2015-10-011-0/+1
| | | | | | | | | | | 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>
* Cleanup remainders of code relating to data error policy handlingDenis Shienkov2015-09-241-130/+4
| | | | | | | | | | | | | | | | | | | 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>
* Return an error at trying to set custom speed for separate directionDenis Shienkov2015-09-091-6/+13
| | | | | | | | | | 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>
* Use the termios v2 to custom baud rate switchingDenis Shienkov2015-09-091-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Get rid of stored termios structureDenis Shienkov2015-09-081-67/+108
| | | | | | | | | | | 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>
* Refactor the speed configuration for *nixDenis Shienkov2015-09-071-78/+63
| | | | | | | | | | | | | | | | | | | | 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>
* Unify common error strings in QSerialPortErrorInfoDenis Shienkov2015-08-281-4/+4
| | | | | | Change-Id: I1275e80988274e2409455217d5ffb03014962604 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Delete the notifiers immediatelly on closeDenis Shienkov2015-08-061-4/+2
| | | | | | | | | | | 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>
* Fix proper handling of QSocketNotifier::event() methodDenis Shienkov2015-08-051-10/+16
| | | | | | | | | | | | | | 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>
* Do not use the Q_OBJECT macro when it is not requiredDenis Shienkov2015-08-031-4/+0
| | | | | | Change-Id: Ib1dcece468c8a92f63bb45af7970711c6e3f3a09 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Give custom descriptions to errors which had none beforeDenis Shienkov2015-07-091-11/+10
| | | | | | Change-Id: Ic083cbd58e4e775ede0cdf610f61407003834207 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Improve the processing of errorsDenis Shienkov2015-07-081-96/+74
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix the lock-file path when the App Sandbox is used on OSXDenis Shienkov2015-07-071-7/+4
| | | | | | | | | | | 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>
* Get rid of QSPP::bytesToWrite()Denis Shienkov2015-07-011-5/+0
| | | | | | | | | 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>
* Get rid of QSPP::readData()Denis Shienkov2015-06-301-5/+0
| | | | | | | | | | | | | | 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>
* Allow to open the device when using the App Sandbox on OSXDenis Shienkov2015-05-121-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add additional lock directories for *nix-specific platformsDenis Shienkov2015-04-051-0/+3
| | | | | | Change-Id: I3943ff6b8fee2f651317ddbaa40ef0d27dac6475 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Don't use QStringLiteral when QLatin1String is efficient.Debao Zhang2015-03-271-1/+1
| | | | | | | | | 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>
* Remove space between "if/elif defined" macro and its bracketDenis Shienkov2015-03-121-7/+7
| | | | | | | | 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>
* Unix: Clear serial_struct instancesv5.5.0-alpha1Jonathan Liu2015-03-091-0/+4
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-251-43/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/serialport/qserialport_unix.cpp src/serialport/qserialport_unix_p.h src/serialport/qserialport_win.cpp src/serialport/qserialport_win_p.h src/serialport/qserialport_wince.cpp src/serialport/qserialport_wince_p.h Change-Id: Ibb917652b132e66fbb90f437bf762c1094911dc0
| * Do not touch of the read notifier after its creationDenis Shienkov2015-01-061-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When are used the multiple opening and closing chains, then a read notification can be stalled. The reason is in old heritage of a code related to preventing of recursive calls. Thus, need just to remove this old code. It is not the in-depth investigation of an issue but just a workaround which can be improved in future. Tested on Linux with on-board and socat serial ports using Qt5. Task-number: QTBUG-43484 Change-Id: I04556fdde2775448b33d68f141f4328647c549c9 Reviewed-by: Laszlo Papp <lpapp@kde.org>
| * Use Q_NULLPTR where it is possibleDenis Shienkov2014-12-101-5/+5
| | | | | | | | | | Change-Id: I7261a92ea4405c8aeab7670f73e7225ed7e4d9d0 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Interpret ENOTTY as UnsupportedOperationError instead of ResourceErrorDenis Shienkov2014-12-051-1/+1
| | | | | | | | | | | | | | | | | | The ENOTTY is closer to QSP::UnsupportedOperationError, because it is decoded as "Inappropriate ioctl for device". Change-Id: Ibcbe09e201eeb5ede6daa417654a181dd380df5a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Setup an error when QSP::setBaudRate() fails on UnixDenis Shienkov2014-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | Inside of a method is missed setup of an error code, therefore always returns QSP::UnknownError (or some previous error). Tested on Linux with USB PL2303, using Terminal example (when trying to setup of an unsupported 14400 baud rate). Change-Id: I6b3143dd6d451a32024a5ca5239dac826ceb7af6 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Simplify and improve the QSP::TimeoutError handlingDenis Shienkov2014-11-281-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | It is reasonable to get rid of duplicating a code of TimeoutError handling. A common parts of a code can be moved to one place. Also, can be improved some of related if/else conditions. Tested on Windows 8 and Linux with virtual serial ports. Change-Id: I63112727faf42d4357f64f3450ea422167eaee90 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Handle EINVAL, ENOIOCTLCMD, ENOTTY and EPERM errorsDenis Shienkov2014-11-281-0/+20
| | | | | | | | | | | | | | | | | | | | | | According to TTY_IOCTL(4), the ioctl on tty device can return these errors, which we need to interpret to QSP::SerialPortError. For example, a virtual devices which are created by SOCAT, returns the EINVAL error when the ioctl does query of line states. Change-Id: Iece3b773fdc8fe4b97951ccf7cff9d2670f24694 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>