summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/tinycan
Commit message (Collapse)AuthorAgeFilesLines
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-061-1/+1
| | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I805f044a494f0ed3066c9c132767d541108c0e2d Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: Ibfa4f2f7788f83b7032406de634ca4fb635d2131 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-071-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I4702aec49e940c3a480b94cf8622155b9b688b9e Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-105-195/+15
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: Ie17b09db5a4aa7bb0d33906360f1125e9632425c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-11-305-55/+70
| | | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Change-Id: I2dd25a1a7d6ad3e3cbb06753bbc839e26f4a7b26 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* CMake: Use renamed qt6_add_plugin PLUGIN_TYPE optionAlexandru Croitor2021-08-101-1/+1
| | | | | | | Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: I1d462fa520ab01ae41c54aa5c44e2ade716b050a Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CAN: Implement QCanBusDevice::deviceInfo() in the pluginsAndre Hartmann2021-08-052-0/+6
| | | | | | | | | | | | | | * PasstruCAN: Untested * PeakCAN: Tested on Windows with PCAN-USB Pro FD. * SocketCAN: Tested on Linux with virtual and real hardware. * SystecCAN: Tested on Windows with USBcanmodul2. * TinyCAN: Untested * VectorCAN: Tested with the virtual Vector interface. * VirtualCAN: Tested on Windows and Linux. Pick-to: 6.2 Change-Id: I3836a81a9cb1570a22b6264b34fca88ccc0ab57e Reviewed-by: André Hartmann <aha_1980@gmx.de>
* QCanBusDeviceInfo: Add method to obtain the plugin nameAndre Hartmann2021-07-231-1/+2
| | | | | | | | | | | | [ChangeLog][QCanBusDeviceInfo] Added the CAN bus plugin name to QCanBusDeviceInfo. Custom plugins must be adopted to the changed QCanBusDevice::createDeviceInfo() method. Pick-to: 6.2 Change-Id: I44d658aaa6f873eecce447dd9ee4539c9fbe2043 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CMake: Explicitly link against the built QtNetwork libraryAlexandru Croitor2021-07-231-0/+1
| | | | | | | | | | | | | This is to ensure that the pre-existing QtNetwork library from the b2qt SDK sysroot in the CI is not picked up. This is likely a consequence of CMake not adding an -rpath-link flag when linking. See QTBUG-86533 for details. Task-number: QTBUG-86533 Pick-to: 6.2 Change-Id: Id05d49812f957c8a6c12c03f5ff633015bd63103 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QCanBusDevice: Consolidate createDeviceInfo()Andre Hartmann2021-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This protected function is used from the CAN plugins to create QCanBusDeviceInfo objects. We want to add another parameter (plugin) to the function in a follow-up commit, so let's first remove unneeded overloads that were created during Qt 5 times and only keep the very simple and the all-embracing one. While at it, remove the std::move calls as clang gives performance warnings here: socketcanbackend.cpp:149:23: error: moving a temporary object prevents copy elision socketcanbackend.cpp:149:23: note: remove std::move call here Pick-to: 6.2 Change-Id: Ie83db3cd3a9d6b40b2da4a9ce736861a0ee8359f Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CAN: Make functions that should be virtual suchAndre Hartmann2021-07-222-5/+2
| | | | | | | | | | | They were not during Qt 5 times due to our binary compatibility promise. Pick-to: 6.2 Change-Id: Ia5ddb114db9dc552515df5ab4b22d0c962a0a341 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* TinyCAN: Remove redundant size checkAndre Hartmann2021-07-191-19/+14
| | | | | | | | | | The frame payload size is already checked in TinyCanBackend::writeFrame and removing the check here makes the code more in line with the other backends. Change-Id: I045b01b7bf5ae21bacc0c5783b66dc51bff139be Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN: Fix overreading QByteArray bufferAndre Hartmann2021-07-191-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code did not take the size of the payload QByteArray into account, so that for small payloads read accesses outside the QByteArray data field occurred. While this should be no big problem in reality, memory checkers like Address Sanitizer will report such issues. We now only copy the bytes the payload QByteArray really provides. We can do this, as every derived QCanBusDevice::writeFrame() method already does a QCanBusFrame::isValid() check before enqueuing the outgoing frames, so that the maximum length of the payload field is always guaranteed, for CAN 2.0 as well as CAN FD. [ChangeLog][CAN] Fixed potential read buffer overflows when sending CAN frames in diverse CAN backends which were detected by Address Sanitizer. Pick-to: 6.2 Fixes: QTBUG-94695 Change-Id: I2e45f6c14ae0fe88ba83f52dd5db4ffe24dada58 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CMake: Don't give plugins PUBLIC usage requirementsJoerg Bornemann2021-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: Ia7a8f27d4eecf067055511577ec664ad857905cd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove QCanBusFactory and rename QCanBusFactoryV2 to QCanBusFactoryKarsten Heimrich2021-05-081-2/+2
| | | | | | | Fixes: QTBUG-93403 Change-Id: I1b8f3952284e7ec722716fa11e701b96d80a85f1 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QCanBusDevice: Replace int parameter with ConfigurationKeyAndre Hartmann2021-02-033-5/+6
| | | | | | | | | | | | | | | | | | They only place where this might break user code, is for custom plugins using custom configuration parameters. For most users however, this type safety makes the API easier to use. [ChangeLog][QCanBusDevice] All functions dealing with configuration parameters now take a QCanBusDevice::ConfigurationKey instead an int. Fixes: QTBUG-89839 Change-Id: I0a1de5fdcfc4292b23599d4770102740a2df1601 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Port to CMakeAndreas Buhr2021-01-272-17/+15
| | | | | | | Task-number: QTBUG-90399 Change-Id: I0521231e7d61809f38c44215b5cd923b292b9e02 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Push to more recent qtbase/qtserialport checkoutAlex Blasche2020-10-151-1/+1
| | | | | | | and fix resulting compile breaks. Change-Id: I3d8e15723eb86ec91552f93bb7a5de46858c0495 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Use QList instead of QVectorJarek Kobus2020-08-172-4/+3
| | | | | | Task-number: QTBUG-84469 Change-Id: I3a3cd127fb9fed7b25d543a9c5af75c734397806 Reviewed-by: André Hartmann <aha_1980@gmx.de>
* Init API structs without memsetAndre Hartmann2020-02-241-6/+3
| | | | | | | | Continuation of a3aa54e Change-Id: Ic6daa7a754f3c869094770ea3e47a097bf4afa84 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-261-4/+4
|\ | | | | | | Change-Id: I49240ebad0b08b728783a4e5137f12799cb5080c
| * Avoid conflicting class names if the plugins are linked staticallyAndy Shaw2019-10-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | QtSerialBus is already using QtSerialPort which has a WriteNotifier and ReadNotifier class in place. Therefore it is possible that if these were linked in together into one application that there would be multiple instances of the same class name which caused problems as it would think that the WriteNotifier in QtSerialPort was a QTimer and not a QSocketNotifier. So keep the names unique to be on the safe side. Change-Id: I8667e3d4230b316d47e266ad1b4319cf5e74444b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-242-2/+2
|\| | | | | | | Change-Id: I35dad8a57ea003c7d70f03651aa0604141c8b2db
| * CAN: Avoid symbol clashes on static buildsAndre Hartmann2019-09-232-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Having the same function name in a global namespace can lead the linker to pick an arbitrary one instead the right one. [ChangeLog] Fixed problems on static builds where an arbitrary version of resolveSymbol() was used instead the correct one. Fixes: QTBUG-78546 Change-Id: I0ff9bc3e5905b3b9694dfe9d446b2a52700f213f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* | Add QCanBusDevice::resetController() for CAN controller resetAndre Hartmann2019-05-023-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently missing: * VectorCAN: no information in the documentation found * PassthroughCAN: no documentation [ChangeLog][QCanBus][QCanBusDevice] Added the function QCanBusDevice::resetController() to reset a CAN controller from bus off state, as far as supported by the various plugins. Fixes: QTBUG-54943 Change-Id: Ic098054b012726c0c69970c0ae84f434c2b3964a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | CAN: Port qCritical in Tiny and Vector pluging to qCCriticalAndre Hartmann2019-04-291-2/+4
|/ | | | | | | | Seems we missed them when porting all other debug and warning messages. Change-Id: I3f083de2ed0c4d9bf73842a7e0c2e09f3883a3bb Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* remove pointless PLUGIN_EXTENDS stanzasOswald Buddenhagen2018-11-071-1/+0
| | | | | | | | there is no point in putting the owning module there. Change-Id: I9bc49ae323a4bbc8cd35d10493c899466645bd44 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-1/+3
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ibcb5508d7f131cbeba0d047111177a8dff1e5f68
| * Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-01-181-1/+3
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: If12daffe4655f71d9aea39e0ed9e0db405a09fe7
| | * TinyCAN: Intermediate fix for availableDevices()Andre Hartmann2018-01-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Currently there is no way to detect the available devices * The existing code lead to compile errors with MSVC2013 * Also fix the documentation while at it [ChangeLog][QCanBus][Plugins] The function availableDevices() now returns an empty list for the TinyCAN plugin. The code was never functional and always returned a hardcoded example list. The function will be changed in later Qt versions to return the correct values once QTBUG-62958 is solved. Task-number: QTBUG-65474 Change-Id: Iebb4c8d4baf3b021d8890c6b3f252e9050856fce Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-201-8/+15
|\| | | | | | | | | | | Change-Id: Ia04f54eee1264b659d8928b7f08d7221f587bc54
| * | TinyCAN: Fix usage of global static non-POD variablev5.10.0-beta3Andre Hartmann2017-10-241-8/+15
| |/ | | | | | | | | | | | | | | | | | | Found by clazy. Change-Id: Ic935fd2e9e351b1fd1399223f38afef840b623fc Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Improve checking for unsupported CAN FD framesAndre Hartmann2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for the correct data length is already done by QCanBusFrame::isValid. Plugins that don't support CAN FD should rather check for the CAN FD flag and discard CAN FD frames with payload length < 8 also. [ChangeLog][CAN bus plugins] The CAN bus plugins that don't support CAN FD now also discard CAN FD frames with payload length < 8. Change-Id: I5a699a497b79dab2b8960fadc7fa30dbda6c4a62 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Rolf Eike Beer <eb@emlix.com>
* | CAN: Introduce categorized loggingAndre Hartmann2017-11-132-5/+12
| | | | | | | | | | | | | | | | | | | | [ChangeLog][CAN bus] Introduced categorized logging to the CAN bus module which can be enabled by the "qt.canbus" and "qt.canbus.plugins.<pluginname>" filters. Change-Id: Ib39c0b2ebcd967cd7812602190807ad3488ccb18 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | CAN-Plugins: Fix Clang Semantic Issue -Wold-style-castAndre Hartmann2017-10-051-1/+1
| | | | | | | | | | | | | | | | | | warning: use of old-style cast note: expanded from macro 'RESOLVE_SYMBOL' Change-Id: Icd9ae4c8543e63f1c9cf99d130bf2c26012400be Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN-Plugins: Make some more d-pointers constAndre Hartmann2017-10-051-1/+1
|/ | | | | | Change-Id: I6483232da88963f6dd46d05ebf990fe798b0b45e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN: Remove unneded core-private dependency for pluginsv5.9.0-beta3v5.9.0-beta2Andre Hartmann2017-04-131-1/+1
| | | | | | Change-Id: I9f5c41a5c3cd0c83f3835d29de22b76ac367cdbb Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9v5.9.0-beta1Liang Qi2017-03-315-10/+10
|\ | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/canbus.pro src/plugins/canbus/vectorcan/vectorcanbackend.cpp Change-Id: I3625693784e88204c93479806242ae70c7ec7ff3
| * Updated copyright headersAndre Hartmann2017-02-025-10/+10
| | | | | | | | | | Change-Id: I7d38491c7ee15a1de788375acf9144c59b507d2a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | QCanBusFactory: Restore binary compatibility to Qt 5.8Andre Hartmann2017-03-301-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Added a new QCanBusFactoryV2 to load plugins with the new virtual function availableDevices(). To be able to still load plugins compiled against Qt 5.8, both factories have to be considered when loading plugins and creating devices. Change-Id: I843cdd0b82193e391699daa298454c8b9522e860 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Unify endless loopsv5.9.0-alpha1Andre Hartmann2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Replace the macro forever with its expansion "for (;;)", as forever will be deprecated in later Qt versions. Also change the place where another pattern "while (true)" was used, to have them unique (Vector and Systec already use "for (;;)". Change-Id: I3582f7b674c17c35c6954eb359bacf81d2c1faab Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Improve error handling codeAndre Hartmann2017-01-241-22/+22
| | | | | | | | | | | | | | | | | | | | | | * Add Q_UNLIKELY to error handling branches * Prefers qWarning("%ls", qUtf16Printable(str)) over qWarning() << str; Task-number: QTBUG-55045 Change-Id: I3e49380bdec0edb2ea00e1b5e3421464b295aacc Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Use C++11 class initialization where possibleDenis Shienkov2017-01-182-6/+5
| | | | | | | | | | Change-Id: I2aeeb762297707337273b0a1ecba8b3d13ed923f Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Eradicate Q_FOREACH loops and mark the module as Q_FOREACH-freeAndre Hartmann2017-01-111-2/+3
| | | | | | | | | | Change-Id: I4ec52799514b750c158e3cb8e6c38d1f1063c6c5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | CAN: Add QCanBusDeviceInfoAndre Hartmann2017-01-103-0/+13
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Returns: * a list of available devices for the chosen plugin * if the device is virtual * if the device is CAN FD capable Use this list in the CAN Example for interface selection. If information about virtual channels or CAN FD capabability is not available, false is returned. For SocketCAN, PeakCAN, VectorCAN and SystecCAN, the implementation is completed. TinyCAN only return the list of possible interfaces for now. This is can be changed later, but needs quite some refactoring of the TinyCAN plugin. [ChangeLog][QtCanBus] Added the new class QCanBusDeviceInfo for enumeration of available CAN interfaces and more information about them. Task-number: QTBUG-54298 Change-Id: I851bcc3b9ee41aaaf1164c6b4a5aaf6503cd8746 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/peakcan/main.cpp src/plugins/canbus/tinycan/main.cpp src/serialbus/qcanbusframe.h Change-Id: I7a38350688086b5f5cd7072acccb3fa38af76f88
| * CAN-Backends: Port qUtf8Printable to qUtf16PrintableAndre Hartmann2016-09-231-1/+1
| | | | | | | | | | | | | | | | | | This amends commit 0c63b3a441437a8bc42770d360a6696bbf11cd2d Change-Id: I934f90384ad9ec7d42e9437cb023b0c5edeb0437 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-192-2/+2
|\| | | | | | | | | | | | | | | Conflicts: src/plugins/canbus/peakcan/main.cpp src/plugins/canbus/tinycan/main.cpp Change-Id: Ia2dac20ddfc27ba96bb36cd70ba011e2d3764f2f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-172-2/+2
| |\ | | | | | | | | | Change-Id: I68fd539f6065c6a8351c1d9bdf52f8b01b4ea923
| | * CAN: Use qUtf8Printable() instead qPrintable() for warningsAndre Hartmann2016-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the qPrintable() help: "Note: qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect %s arguments to be UTF-8 encoded, while qPrintable() converts to local 8-bit encoding. Therefore qUtf8Printable() should be used for logging strings instead of qPrintable()." Change-Id: I724cc61659dd4f998617eade140b273dca841b35 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>