Commit Graph

28 Commits (7b7331976a05b21ac39246b6878f781020086ded)

Author SHA1 Message Date
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Oliver Hartkopp 4c8fb05cb4 can-utils: remove strict-aliasing compiler warning
GitHub user 'crossband' raised an issue regarding the strict-aliasing compiler
warning in his specific setup: https://github.com/linux-can/can-utils/issues/42

In fact memcpy() and memset() are a better solution than the former pointer
magics, so remove the issues and the compiler warning flag too.

Reported-by: crossband (https://github.com/crossband)
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-07-01 19:01:01 +02:00
Oliver Hartkopp 5109ca4f3c cangen/cansend: fix typo 'ist' -> 'is'
Reported-by: Stanislavs Rogozins <stanislavs.rogozins@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2017-06-29 19:55:52 +02:00
Ramesh Shanmugasundaram 42ee04ff64 cangen: reset frame flags at the start of iteration (#16)
This patch fixes a bug in cangen.c

Bug: When used with -m option, if a CAN FD frame with BRS option set is
sent, that flag never gets cleared for the subsequent frames.

Fix: Reset frame.flags at the start of iteration.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
2016-06-30 21:33:16 +02:00
Sven Schmitt 4a154cf3c4 cangen: added -b switch enabling bitrate switch in canfd frames.
Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-10-14 21:22:35 +02:00
Sven Schmitt 3f04e8a1fe cangen: fixed coding style
Signed-off-by: Sven Schmitt <sven.schmitt@gmx.net>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-10-14 21:21:20 +02:00
Konrad Anton 667356cc36 cangen: use long long in time computation for -g to support >2.1s
The computation of nanosleep times for the "-g" option (delay between sends)
overflows when more than 2100ms are given.

Signed-off-by: Konrad Anton <konrad.anton@awinia.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2013-02-07 13:57:49 +01:00
Oliver Hartkopp 836d3cc012 remove obsolete SVN ID tags
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-11-14 20:57:16 +01:00
Oliver Hartkopp e7631bd7f9 canfd: upgrade tools to support CAN FD for Linux 3.6
This is a major upgrade of the basic tools to handle CAN FD frames.
The library to parse and print CAN frames and logfiles has been extended.

In detail:

 asc2log.c      |    5 +
 candump.c      |   24 ++++---
 cangen.c       |  172 +++++++++++++++++++++++++++++++++------------------
 canlogserver.c |   28 +++++---
 canplayer.c    |   25 ++++---
 cansend.c      |   55 ++++++++++++----
 lib.c          |  189 ++++++++++++++++++++++++++++++++++++++-------------------
 lib.h          |  109 ++++++++++++++++++++++++--------
 log2asc.c      |    8 +-
 log2long.c     |   26 ++++++-
 10 files changed, 440 insertions(+), 201 deletions(-)

asc2log.c / log2asc.c
- updates for new lib functions
- still can only handle CAN2.0 frames (no new info about ASC file layout)

log2long.c / canlogserver.c / canplayer.c
- updates for new lib functions to handle CAN FD

lib.h / lib.c
- reworked lib functions to handle CAN FD
- parse_canframe() now returns CAN_MTU and CANFD_MTU on success, 0 at failure
- added can_dlc2len() and can_len2dlc() helpers
- moved hexstring2candata to hexstring2data to support simple byte buffers
- in the long CAN frame representation use %03X/%08X instead of %3X/%8X
- introduced unified buffer size definitions for ASCII CAN frames
- updated documentation

cangen.c
- support CAN FD frames (added -f option to create CAN FD frames)
- added -m option ('mix') to create random extended / RTR / CAN FD frames
- fixed the 'fixed data' option which was zero'ing the payload by the time
- updated help text

candump.c
- support CAN FD frames (print, bridge, log)
- distinguish frame types by length info: [0] = CAN2.0 [00] = CAN FD frame

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-11-14 19:47:21 +01:00
Oliver Hartkopp 9b99fafe1a cangen: Enable sending of RTR CAN frames
Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-07-22 13:06:06 +02:00
Oliver Hartkopp 98930f1403 cangen: allow double value for gap
This way a user can specify a gap below 1ms. This is somehwat similar
to setting the gap to 0, but the ENOBUFS are greatly reduced, so a given
amount of CAN messages by -n is still usefull and useable.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2012-07-13 07:36:52 +02:00
Oliver Hartkopp 8197afe2c1 cangen: set unused payload to zero 2012-01-28 17:30:33 +01:00
Marc Kleine-Budde 722a09116d treewide: replace berlios contact email by linux-can@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2012-01-11 12:14:15 +01:00
Oliver Hartkopp d262a552bb cangen: set seed value for pseudo random numbers
As pointed out by Andre Naujoks the pseudo random generator should be
initialized with a seed to prevend this ugly behaviour:

$ ./cangen vcan2 -v & ./cangen vcan1 -v
[1] 5995
  vcan2  567#69.98.3C.64.73.48
  vcan1  567#69.98.3C.64.73.48
  vcan2  451#4A.94.E8.2A.EC.58.55.62
  vcan1  451#4A.94.E8.2A.EC.58.55.62
  vcan2  729#BA.58.1B.3D.AB.D7.7E.50
  vcan1  729#BA.58.1B.3D.AB.D7.7E.50
(..)

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2011-01-19 17:35:37 +00:00
Oliver Hartkopp 5d1dbedd19 cangen: Added '-n <count>' commandline option analogue to candump tool.
Inspired by Uwe Bonnes.
2010-11-29 18:58:12 +00:00
Oliver Hartkopp afa14f102d When sending a sequence, we need to resend the same frame when poll() returns.
Fixed that to be a valid data source e.g. for ptx cansequence.
2010-02-26 08:38:47 +00:00
Oliver Hartkopp e089e5d0ba Added commandline option '-p <timeout>' to enable polling on the writing socket.
Inspired by Marc Kleine-Budde :-)
2010-02-25 20:53:19 +00:00
Oliver Hartkopp 7a2544a169 Fix commandline parameter handling for fixed canframe.data[] . 2008-06-20 09:16:06 +00:00
Oliver Hartkopp adbe6f9bee Whitespace fixes. Indented the code following Linux styleguide to fix
the mess between tabs and spaces.
2008-06-03 08:46:57 +00:00
Oliver Hartkopp 0df736ca51 Added hint about hexadecimal data representation. 2008-05-11 11:46:00 +00:00
Oliver Hartkopp 5769d708e4 Updated new 'cangen' and 'candump' in the trunk. 2008-05-05 12:20:34 +00:00
Oliver Hartkopp d72681c442 Reverted most of the changes since r500 except the changes in
drivers/net/can/* after discussion with Urs.
TODO: Documentation & new Version.
2007-10-01 05:48:50 +00:00
Oliver Hartkopp 6689e9600d Changed loopback to echo in CAN RAW sockets. The binary interface does
not change through this renaming of CAN_RAW_LOOPBACK to CAN_RAW_ECHO.
2007-09-30 13:00:42 +00:00
Oliver Hartkopp d0b24ffc10 Fixed contradiction in Sourcecode discalimer.
See details at
http://marc.info/?l=linux-netdev&m=119074747913703&w=2
2007-09-27 12:29:32 +00:00
Oliver Hartkopp a121452698 Changed option name '-l' to '-x' as this option should also go into canplayer.
Cosmetics in print_help().
2007-06-22 08:25:34 +00:00
Oliver Hartkopp c2c6579bd6 Added option '-l' to disable local loopback for generated data. 2007-06-22 08:04:48 +00:00
Oliver Hartkopp f1e643f8f1 Added program exit on SIOCGIFINDEX error. 2007-06-18 20:04:23 +00:00
Oliver Hartkopp f95fc47ec8 - added error frame support in lib.c
- added sprint_* functions for CAN-frame output in lib.c / lib.h
- added comments / cosmetics

candump.c:
- removed support for the output in ASC representation (moved to log2asc.c)
- added option '-l' for logfile creation e.g. 'candump-2007-01-01_164123.log'
- added funtionality to terminate candump by pressing [ENTER] (not only ^C)
- added error frame support
- added color support even when reading from 'any'
- three different color levels (e.g. -c -c -c)
- making use if lib.c

cangen.c:
-  CAN frames generator for testing purposes (e.g. on vcanx)
(nice when you're on vacancy at the baltic sea and have no real CAN source :)

log2long.c:
- convert compact CAN frame representation into user readable representation

log2asc.c:
- convert compact CAN frame logfile to ASC logfile for 3rd party CAN tools

Next step: Create a tool to replay candump logfiles.
2007-01-01 18:29:52 +00:00