summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix license headersJani Heikkinen2018-01-151-13/+19
| | | | | | | | old header.LGPL21 was used in some src files.Replace ones in src/ with correct header.LGPL one. Also remove unnecessary license files. Change-Id: I1d752c8361b8b23fcd3232818553da60bbdabfca Reviewed-by: Liang Qi <liang.qi@qt.io>
* Update include instructions in documentation overview pagesv5.10.0-beta4Andre Hartmann2017-11-032-4/+17
| | | | | | | | | The examples were already adopted to use <QSerialPort> instead <QtSerialPort/QtSerialPort>. Change-Id: Id9d3b0b04f31ac3d32554aa34941696903511577 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-301-2/+2
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/serialport/blockingmaster/masterthread.cpp Change-Id: I3716089bae99247f98ed02656d4418de5f866c1d
| * Update waitFor{ReadyRead|BytesWritten} documentation for timeoutsAndre Hartmann2017-09-291-2/+2
| | | | | | | | | | | | | | | | | | [ChangeLog][QSerialPort] Added a note to the documentation that waitForReadyRead() and waitForBytesWritten() never time out if the parameter msecs is -1. Change-Id: I5852da14faf1bba5a338db6a8764da582238aae7 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Fix order for some includesv5.10.0-beta3Denis Shienkov2017-10-251-9/+9
| | | | | | | | | | | | | | | | 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>
* | Allow more paths for lookup of lock-file directoriesDenis Shienkov2017-10-251-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Make some more d-pointers constDenis Shienkov2017-10-241-2/+2
| | | | | | | | | | | | Change-Id: I844f5102077e7b4d5240947a614bfb163c8b7890 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | Add missed 'explicit' keywordsDenis Shienkov2017-10-241-2/+2
| | | | | | | | | | | | Change-Id: I12da9eb3a57fc312fb4b029714166af10755ca76 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | Use C++11 member class initializationDenis Shienkov2017-10-124-94/+46
| | | | | | | | | | | | Change-Id: I427b993a3a71f199029a8956cdf0dc2c98f0e444 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* | Port QWinOverlappedIoNotifier to QDeadlineTimerThiago Macieira2017-08-154-28/+24
| | | | | | | | | | Change-Id: Ib57b52598e2f452985e9fffd1459eb18587c99e3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-074-7/+13
|\ \ | |/ | | | | | | | | | | | | Conflicts: .qmake.conf src/serialport/qserialport_win.cpp Change-Id: Icc832e218a1135cb82e780ccaa63abd990289eaf
| * QSPP::startAsyncRead(): set a correct type for variableAlex Trotsenko2017-05-041-1/+1
| | | | | | | | | | | | | | | | 'bytesToRead' takes the result of signed 64-bit computation which could be negative. So, its type should be qint64. Change-Id: Ib51129143fcb70475ad383df417ae4282c858e41 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Fix possible UB in ReadFile()v5.9.0-beta4Alex Trotsenko2017-04-251-1/+1
| | | | | | | | | | | | | | | | This patch replicates commit 225ef1baeb0e49f157f3ba1271915e623bd27dd9 for Windows. Change-Id: Ic4e3444183289e7ce1a487500633fb5ad95590b9 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * 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>
| * Fix bytesToWrite()Alex Trotsenko2017-04-221-2/+5
| | | | | | | | | | | | | | | | | | We should not add the size of the internal write buffer here because QIODevice::bytesToWrite() already checks it. Also, take into account the size of 'writeChunkBuffer' on Windows. Change-Id: I87dfcb4dd1cd9d2bbb6f82a084d79fb4db9323d8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Doc: Remove unnecessary \fn tag for the swap() functionDenis Shienkov2017-03-181-2/+1
| | | | | | | | | | | | | | ... as this function is implemented in cpp file. Change-Id: Ia5a0c262ebdb4b98b4575c85ab45fdc93742731f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
| * Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-101-0/+4
| |\ | | | | | | | | | Change-Id: Ib336529542ae9b78937ad1573fde71ccfcc4c1ad
| | * Doc: Describe limitations to use of QSP::setRequestToSend()5.8Denis Shienkov2017-03-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | The limitations were introduced by the commit 56c001b, but were not documented. Change-Id: I5e44ab78e2e5cce2477ebc1f83280fa8c22e0ef6 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Use local copy of QWinOverlappedIoNotifierDenis Shienkov2017-05-174-2/+524
| | | | | | | | | | | | | | | | | | | | | | | | ... as there are plans to remove it from the QtCore. Change-Id: I79a2250b7b392896fa1c7307488a74dd44d62736 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Improve read performance when the buffer size is limitedAlex Trotsenko2017-04-264-25/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-264-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Simplify QSPP::standardBaudRates() methodDenis Shienkov2017-04-091-72/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | We do not need to use the ifdef guards for the CBR_ constants, because constants are standard and always exists in native API. Change-Id: I75ae9ffc17b132786fe5e72791b3f7c82c72c76e Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Create notifier only in end of successful initializationDenis Shienkov2017-04-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | ... otherwise, this notifier's instance will be active even if the serial port is not open. Change-Id: Ieebb894a048f3ed89ac5d1c259e21bc790f5d387 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Get rid of originalEventMask memberDenis Shienkov2017-04-093-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The event mask variable is used only once in process of initialization, so we do not need to keep this variable as the class member. Change-Id: I1f97a312cc92345d435dee821fefb8c2de33665e Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Move settingFromBaudRate() function into common Q_OS_UNIX guardDenis Shienkov2017-04-091-4/+2
| | | | | | | | | | | | | | | | | | Change-Id: Ia9b0851ea7259bc4bc1aa709992b5eb215144a77 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Remove unused QThread forward declarationDenis Shienkov2017-04-091-1/+0
|/ / | | | | | | | | | | Change-Id: I0dc20fa836888d3caa678fd8f5b620625e00ec92 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> 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>
* Improve documentation a bitDenis Shienkov2017-01-042-49/+49
| | | | | | | | ... where has been added the '\c' tag where it is required. Change-Id: Ie346fc147deb535501eb365693a2ff5fe22a98f9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* qserialport.cpp: Silence deprecation warningFriedemann Kleint2016-12-081-0/+5
| | | | | | | | | qserialport.cpp: In member function 'void QSerialPort::setSettingsRestoredOnClose(bool)': qserialport.cpp:627:9: warning: 'void QSerialPort::settingsRestoredOnCloseChanged(bool)' is deprecated [-Wdeprecated-declarations] Change-Id: I4ed17403cd1692c4f965a69be711f0c5b03a8376 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-262-5/+13
|\ | | | | | | Change-Id: Ia83609bd366762621857a6c63bf935a6cd230742
| * Do not reset RTS after changing other properties on WindowsDenis Shienkov2016-09-231-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing any of serial port properties drops RTS, which has been set earlier, since the fRtsControl field of DCB structure always has RTS_CONTROL_DISABLE value (except hardware flow control). Thus, using one EscapeCommFunction() function inside of QSP::setRequestToSend() method is not enough. We need set there also the fRtsControl field to RTS_CONTROL_ENABLE(DISABLE) value and keep it unchanged. Task-number: QTBUG-55907 Change-Id: I7e407b0de9f970f5d11f61c0e360d4735a0acb84 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> 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>
* | Replace QCFString::to(CF/NS/Q)String usage with QString methodsv5.8.0-beta1Liang Qi2016-10-101-1/+1
| | | | | | | | | | | | | | Just follow 669add9 in qtbase. Change-Id: I080d6272541bf8bd8a209ffbf257578aa6a57ae8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Darwin: Fix deprecation warning on usage of QString(const char *)Erik Verbruggen2016-10-061-9/+9
| | | | | | | | | | | | | | | | By wrapping the kIOConstants in the CFSTR macro, this also prevents the creation of temporary QString objects. Change-Id: I04baf9e3f3076f0134e5eb924c2dbf5da011acad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-191-1/+15
|\ \ | |/ | | | | Change-Id: I4f2c44fa70f4f0905daf22c619c597a4a1972c85
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-171-1/+15
| |\ | | | | | | | | | Change-Id: I3c5b0052f5645ead630e33bce46b360fa0135061
| | * Add mention of QSP::waitForX() functions in documentationDenis Shienkov2016-08-051-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | ... otherwise the snippet with the blocking reading does not make sense logically. Change-Id: I5a037e7c44f50e57a1c48ab37764f9e7367a6dec Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Adjust to qtConfig() changes in qtbasev5.8.0-alpha1Lars Knoll2016-08-191-1/+1
| | | | | | | | | | | | | | | Change-Id: Ie6e27e8ae0dce6892ee6ab7561876bc439aed073 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Replace QSP::error signal with QSP::errorOccurredDenis Shienkov2016-08-092-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the name of the signal and the name of the getter unambiguous, which in turn allows the easy use of Qt 5-style connects. This commit message was taken from commit qtbase/4672e31. [ChangeLog][QtSerialPort][QSerialPort] Deprecated QSP::error() signal in favor of new QSP::errorOccurred() one. Change-Id: I3f04bb8b1ae686d5368d43741cd0e97748b31b8f Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-026-231/+265
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/serialport/qserialport.cpp Change-Id: I858fec6e426f5fd867b7eda7b1db69a2d447b357
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-013-22/+11
| |\ \ | | |/ | | | | | | | | | | | | | | | Conflicts: src/serialport/qserialport_win.cpp Change-Id: I8f3403d448ef2e51cf2870b331c61ab808393e34
| | * Detach buffer's segment for asynchronous write operationDenis Shienkov2016-07-203-22/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRingBuffer does not guarantee that the read pointer which is returned by QRingBuffer::readPointer() will stay valid after calling QRingBuffer::reserve() or QRingBuffer::append(). Thus, we need to detach the buffer's segment and pass it to the WriteFile() function to ensure it stays unmodified for the whole time of the asynchronous operation. Change-Id: I5a42086b4339a050a4df57c39348864502be2c74 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * | Remove mention of Windows CE supportDenis Shienkov2016-07-151-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | As Windows CE support has been stopped since Qt 5.7. Change-Id: I850c5e1e41508502a9e82491f89488facca40f51 Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * | QSerialPortInfo: Extract Method anyOfPortAnton Kudryavtsev2016-07-151-22/+11
| | | | | | | | | | | | | | | Change-Id: Ic0851ee8d491f29922d55f3c0530ccd21ed171a5 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * | Start the write timer only when it is inactiveDenis Shienkov2016-07-131-1/+2
| | | | | | | | | | | | | | | | | | | | | Change-Id: Ie6dd49bec6add204b45f15ff344ba6c92adedb0a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * | QSerialPortInfo: use delegate ctor to de-duplicate codeAnton Kudryavtsev2016-07-111-7/+1
| | | | | | | | | | | | | | | | | | Change-Id: I698b9afc7b15bdfca7176ea3ec823da1ba91957c Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * | Use append() instead of memcpy() where possibleDenis Shienkov2016-07-072-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... 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-073-169/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add missng default parameters to waitFor() methodsDenis Shienkov2016-07-282-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and adjust their documentation a bit. [ChangeLog][QtSerialPort][QSerialPort] Added missing parameters for waitFor() methods Change-Id: I95d7076bfef47dd75d37960ca8a719ae779737d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Reuse QIODevice's write bufferAlex Trotsenko2016-07-192-7/+2
|/ / | | | | | | | | | | Change-Id: Ieda6cd8452391a1fd3276a35c9854cf764dbb679 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>