summaryrefslogtreecommitdiffstats
path: root/src/plugins/canbus/socketcan/socketcanbackend.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | SocketCAN: use std::move for appendingAndre Hartmann2016-09-161-1/+1
| | | | | | | | | | Change-Id: Ia057def937d214bf49d0dea1f4d7121d552ba15b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | SocketCAN: constify dataAndre Hartmann2016-09-161-1/+1
| | | | | | | | | | Change-Id: I7dcdab5569310c0375826f79efe5d457bae94006 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | SocketCAN: Simplify TimeStamp creationAndre Hartmann2016-09-081-4/+1
|/ | | | | | | | | The TimeStamp constructor provides everything necessary. There is no need to call setSeconds() and setMicroSeconds(). Change-Id: Id4c4d0952be04ff4bb5a1c0a1bc72dd34f297392 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* CAN: Do not use QPointer class as it is overheadDenis Shienkov2016-05-041-2/+2
| | | | | | | ... and use the QScopedPointer instead, where possible. Change-Id: Ie503d5ff31af77cf6a495f324c1e93c34ff7d58b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* CAN: Correct spelling for "CAN" and "CAN FD"Andre Hartmann2016-05-021-5/+5
| | | | | | | | | ... in comments, user and debug output, and documentation. Change-Id: I76ddf418bc1612a7310f80ee2ce596e8d6ab0721 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix build: errno is declared in <errno.h>Thiago Macieira2016-04-131-0/+1
| | | | | Change-Id: Id75834dab9ed466e94c7ffff1444b0679c6f58a9 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make socketcan backend compile on pre 3.6 kernelsAlex Blasche2016-04-061-0/+24
| | | | | | | | | | | | | | | | The CanFD implementation was introduced by the Linux 3.6 kernel. This change makes the socketcan backend compile on the older Linux kernel build platforms. If a socketcan backend was compiled against the most recent kernel headers but run on an ancient kernel, the missing support is dynamically detected by virtue of returned error code from ioctl et al. Task-number: QTBUG-51932 Change-Id: I5c3601877fa6e882f24d7fa3588dae473a325b9b Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Remove use of Variable Length ArrayThiago Macieira2016-01-081-2/+4
| | | | | | | | socketcanbackend.cpp:160:45: warning: variable length array ‘filters’ is used [-Wvla] Change-Id: Ifd2454ffba454fd591d0ffff1425b27fdb24bd65 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Print more verbose type information in socketcan warningAlex Blasche2016-01-081-1/+1
| | | | | | | | Thanks to Q_ENUM the full type can be printed. Change-Id: If8ef8a3c5574ba3f9b67efb491cae4a10edeb4eb Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Don't attempt to write an invalid QCanBusFrameAlex Blasche2015-12-181-0/+5
| | | | | | Change-Id: I9b73c9bdfe933a74302b4871aa40d5a025496b8c Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QCanDevice: add CanFdKey configuration optionAlex Blasche2015-12-181-12/+31
| | | | | | | | | | This allows to configure if the underlying plugin may use CANFD frames. This currently is only supported with the socketcan plugin. Task-number: QTBUG-49675 Change-Id: Ibd10ef4da0a694dd96d3a3af6063240ba8aa0eed Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* socketcan plugin: remove needless check for 0Rolf Eike Beer2015-12-181-2/+1
| | | | | | | "delete 0" is fine. Change-Id: I235aeef101f9d8858e07e24e7512ad757a70e948 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* socketcan plugin: avoid checking for error frames if RTR is requestedRolf Eike Beer2015-12-151-3/+3
| | | | | | | | | The frame type can only be either RTR or error, with RTR frames being far more common to be sent. Reorder the code that the check for error frames is entirely avoided if an RTR frame is requested. Change-Id: Iee945d1de7158ec3266be760c3b65e762dbe2b8b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Linux/SocketCan: Fix writing of simple and extended can framesAlex Blasche2015-12-111-10/+32
| | | | | | | | | | Write CANFD frame if payload is beyond 8 bytes otherwise write CAN frame. Task-number: QTBUG-49675 Change-Id: I2c2826477cd290005fb24590d4d42ab7c8b5a19b Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QCanBusFrame: do not initialize payload byte by byteRolf Eike Beer2015-12-111-3/+1
| | | | | | | | The data is in a buffer that can directly be put into a QByteArray constructor, using a more efficient copy. Change-Id: I0b96969a881aa76e773eec73009e9511eea935ef Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QCanBusFrame: make sure not to read beyond end of frameRolf Eike Beer2015-12-111-0/+4
| | | | | | | | | | The header field that defines the payload length can encode more a greater number than the actual payload array. Make sure not to read beyond the end of the buffer by simply dropping all frames with an invalid length. Change-Id: Ida4433143a6c999ca5b4800505ad189e4e38d72b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* QCanBusFrame: remove needless initializationRolf Eike Beer2015-12-101-1/+1
| | | | | | | | This value is immediately overwritten, which may lead to warnings on some compilers. Change-Id: I18d9e7fe3757079a2984f3c5b2ef5cc532742b57 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Linux/SocketCAN: Permit the reading of 16 byte and 72 byte can frame MTUsAlex Blasche2015-12-101-3/+3
| | | | | | | | | So far only CANFD frames were permitted. Task-number: QTBUG-49675 Change-Id: Ie6fd54e26adb667f3c9a95e698ff76a91330c2d0 Reviewed-by: Rolf Eike Beer <eb@emlix.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Emit framesWritten() when using socketcanAlex Blasche2015-09-071-0/+2
| | | | | | | | | | For now the socketcan backend remains synchronously. There is no need to do it any other way. This means that enqueueOutgoingFrames() et al are not required. Change-Id: Ia098b893aab173e23ae362f844c4e069862f399b Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Improve the CanBus filtering APIAlex Blasche2015-09-071-22/+76
| | | | | | | | | The current Hash within List within QVariant is just not very intuitive. This patch introduces QCanBusDevice::Filter which proivides much more convenience. Change-Id: I8a8da848c8e0a57d4eec61bed90384c6bf45cffe Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* Optimize the CAN frames receivingDenis Shienkov2015-09-061-1/+5
| | | | | | | | | | | | | We do not need to emit a signal when each frame is received, this increases the load of the event loop. The input FIFO can contains more than one frame, thus we only need to emit the signal when all current frames were read. In this case this signal is renamed to framesReceived instead of frameReceived. Change-Id: If97cfd4304dae9549748f87dbd0b54eae4c0a0f2 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix some missing tr(...) calls.Karsten Heimrich2015-09-011-7/+6
| | | | | Change-Id: I23fedf6a4e102fbeea56cb7c53062a5959109a07 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Better support for configuration parameters in can exampleAlex Blasche2015-08-311-2/+3
| | | | | | | | | | This change permits the example to deal with ReceiveOwn, Loopback and error filters. Bitrate and raw filter lists are still missing. Change-Id: I4fbcc21fe55ff3c880050af0f0b85bee1f8bfa4a Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Adjust config param handling in socketcanAlex Blasche2015-08-311-17/+58
| | | | | | | | | | | | | | | The configuration parameter can be applied before and after a connect. So far the example application always handled the parameters after a connect. The recent can example changes set the params before connect. This lead to the result that the new params were ignored. This change makes it possible to store the params until they are needed. In the case of socketcan the params can only set after the connect when the can bus socket becomes valid. Change-Id: I983fa7d41a63d8f806d0510b4c013d967f039d51 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Fix wrong comparison.Karsten Heimrich2015-08-271-1/+1
| | | | | | Change-Id: Id366f176674090fc5d67157ba3622bee64231414 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Do not reset the configuration of socketcan based devicesAlex Blasche2015-08-311-2/+0
| | | | | | | | | The potentially modified configuration set by the user has to be kept. Change-Id: Ifa3cc64dd51288aa6602c8b32d6b12f4f52b08a6 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Move configuration data into QCanBusDeviceAlex Blasche2015-07-311-39/+16
| | | | | | | | | The derived classes react to changes by providing an overload for QCanBusDevice::setConfigurationParameter(). Change-Id: I465f9c41d8ddf399aaa3f88021a4722e1006affe Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Manage the readFrame() queue inside QCanBusDevicePrivateAlex Blasche2015-07-291-18/+1
| | | | | | | | API users access it via readFrame() and enqueueReceivedFrame() Change-Id: Ice6a9763d195d94a6b57037b15ba41d40967276b Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Rename QCBD::availableFrames() to QCBD::framesAvailable()Denis Shienkov2015-07-291-1/+1
| | | | | | | ... to be consistent with the QIODevice::bytesAvailable() name. Change-Id: I4f332a3d5d9e67ed0a353688c83fc5d38f6a1c74 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Add error description function to QCanBusDevice.Alex Blasche2015-07-281-0/+164
| | | | | | Change-Id: I074c6e3ff730ab4926ad43dea94d0263d91de160 Reviewed-by: Janne Hurskainen <janne.hurskainen@bitfactor.fi> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Improve error handling in can exampleAlex Blasche2015-07-281-1/+3
| | | | | | | | | | | 1.) Avoid crash if payload is misconfigured 2.) Use new QCanBusFrame::FrameError eFrame::FrameError eFrame::FrameError enum 3.) Ensure socketcan backend properly sets the error code 4.) Enable totally permissive ErrorFilter for the example Change-Id: I22e652b5513ba2038d6a50930be7bee9666d122f Reviewed-by: Janne Hurskainen <janne.hurskainen@bitfactor.fi> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Shift socketcan plugin to plugins/canbus dirAlex Blasche2015-07-271-0/+329
There will be more serialbus implementatins which are not canbus. The plugins should be grouped by type. Renames the can plugin to socketcan as that's really what it is. Change-Id: Id8698e12e2297a97aa76b49d1a052e71b1d1124c Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>