Commit Graph

783 Commits (7dd714907b3a90eb9e8a30cf049cfeb1f602ff4f)

Author SHA1 Message Date
Oleksij Rempel 1d3125bef2 j1939acd: do not exit on debug messages
Some debug messages were implemented using err(), which does not return,
but exit the program. This patches replaces the debug messages by
fprintf(stdout, ).

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
2020-06-12 14:24:58 +02:00
Oliver Hartkopp 62f995601e Android.mk: Introduce LOCAL_VENDOR_MODULE to build in AOSP tree
Change path for canutils modules from system/bin to vendor/bin in the
case of building in AOSP tree.

https://github.com/linux-can/can-utils/pull/204

Suggested-by: Pavel Salomatov https://github.com/PsycheEYE
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-04 18:02:10 +02:00
Oliver Hartkopp 647210ee1c Android.mk: Add missing targets
The J1939 tools and asc2log was missing in the Android build.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-06-04 18:02:10 +02:00
josemic eac93ced80 can-j1939-kickstart.md: fix example in documentation 2020-05-30 19:32:32 +02:00
Gary Bisson da42cf4bb5 Android.mk: fix Android 10 build
Android now uses clang with Werror by default which prevents from
building.
Removing Werror for the current warnings.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-29 17:58:23 +02:00
Gary Bisson 43610bd621 Fix arithmetic on a pointer warning
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-28 20:54:37 +02:00
Gary Bisson 46895a41c5 Fix comparison type mismatch warnings
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
2020-05-28 20:54:37 +02:00
Oliver Hartkopp 2c87dcf468 can-utils: fix unused variable warnings
As pointed out by Gary Bisson clang complains about unused variables in
some valid cases.

Reported-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-28 19:32:20 +02:00
Marc Kleine-Budde 8df3d1dd3f
Merge pull request #205 from josemic/patch-2
Update j1939acd.c
2020-05-27 09:07:24 +02:00
josemic 255e360233
Update j1939acd.c
Minor change, as jacd had been renamed to j1939acd.
2020-05-26 23:11:33 +02:00
Oliver Hartkopp d91288f754 README: cansniffer is now also 29 bit CAN ID capable
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-11 15:26:05 +02:00
Oliver Hartkopp 9b75c6020f asc2log: support milliseconds resolution in date/time string
While strptime() does not support fractions of seconds in the date/time
string some new asc files support the milliseconds resolution.

When detecting this new format the msecs are retrieved by a separate
sscanf() invocation and added to the timeval's tv_usec element.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 19:22:53 +02:00
Oliver Hartkopp 41c8ead6c0
Rework for CAN FD support and fixes for asc to log file conversion tools
Detailed change log:

log2asc:
- support CAN FD tags and Classic CAN frames
- support RTR frames including DLC values
- new option '-r' disable the RTR DLC value for potential compatibility reasons
- new option '-f' to use the CANFD format for Classic CAN too

asc2log:
- support CAN FD tags and Classic CAN frames
- be robust against fractions of seconds in date/time string
- fix reading of RTR frames including DLC values in Classic CAN parsing
- fix date/time string detection

cangen:
- new option '-E' to support ESI bit for CAN FD frame generation
(was needed for reference log file generation)
2020-05-10 16:45:21 +02:00
Oliver Hartkopp 3bb659d18d asc2log: fix handling for RTR frames in Classic CAN mode
Fix reading of the RTR representation without and with DLC (v8.5+ tools).

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 15:09:55 +02:00
Oliver Hartkopp 9cde2ebe8f asc2log: fix date string detection
The former check was too complex and did not catch all valid cases.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 14:41:34 +02:00
Oliver Hartkopp 7729c046c5 cangen: support ESI bit for CAN FD frame generation
The CAN FD frames support BTR and ESI as special flags. While BTR could
be generated by cangen the ESI bit could not be generated so far.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 12:03:35 +02:00
Oliver Hartkopp 61dbb56ef6 log2asc: support DLC values in Classic CAN RTR frames
RTR frames contain a valid DLC value which has not been exposed in the
ASC file format since v8.5 of the tools.

So log2asc will expose this DLC value by default which can be changed
by applying the '-r' option to create the former format.

It can be assumed that the tools pre v8.5 will ignore the value but
if not this switch will make sure to create the old format.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 11:45:03 +02:00
Oliver Hartkopp 3014d390b4 log2asc: support CANFD format also for Classic CAN
The CANFD tagged format also supports the encapsulation of Classic CAN
frames which is selected when logging on CAN FD capable CAN interfaces.

With a new option '-f' this CANFD format is selected.

Although this representation is even more inefficient it is seems to be
the common way and increases the readability for mixed CAN/CANFD logs.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 11:22:05 +02:00
Oliver Hartkopp ad9fc28f9e asc2log: add sanity checks for search pattern
Add some more sanity checks and increase readability for the sscanf()
procedure to read a CANFD tagged line.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-10 10:44:11 +02:00
Oliver Hartkopp 9a079942cd log2asc: support CANFD asc file generation
The CANFD asc format adds information about the CAN controllers bitrate
settings, CRCs and message length (in bits) and its duration.

The plan is to provide static values for these attributes that we can not
get from the log file anyway and stay on the 'old style' format for
classic CAN frames - which has been successfully tested on the latest tools.

The remaining drawback is that the 'old style' format is not able to
provide a DLC information for RTR frames.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-09 22:08:19 +02:00
Oliver Hartkopp ed9c646608 log2asc: reorder code to prepare CAN FD support
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-09 19:04:53 +02:00
Oliver Hartkopp df0b25c17e asc2log: support CANFD tagged asc file content
Handles CANFD asc files with classic CAN and CAN FD frames.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-09 18:42:55 +02:00
Oliver Hartkopp 3c8197e4d1 asc2log: make date time sting milliseconds aware
strptime() does not support milliseconds but the latest ASC logfile
also provides a fraction of seconds, e.g.

date Fri May 8 08:49:04.052 pm 2020

Read the value into the year variable before parsing the real year.
We will therefore omit the milliseconds resolution for now.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-09 18:19:24 +02:00
Oliver Hartkopp 43a3cca54d asc2log: reorder code to prepare CAN FD support
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-09 13:10:27 +02:00
Oliver Hartkopp becc0fc6cc cansniffer: fix buffer length in readsettings()
The Android build discovered a char buffer overflow in readsettings().

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-05-07 18:49:20 +02:00
Oliver Hartkopp c5cb7e1a7c
Merge pull request #200 from hartkopp/29bit-cansniffer
cansniffer: support EFF frames with 29 bit CAN IDs

Convert cansniffer from CAN_BCM to CAN_RAW sockets and handle the
content filter in user space. Conversion CAN_RAW including slot
concept and sorting contributed by @coryjfowler.

Functional changes visible to users:
    
- New format for settings file (using 'r' and 'w' interactive commands)
- New command '8' to switch in a compact binary view for 80 columns view
- New head line layout
- The gap time between CAN frames is displayed in milli seconds (ms)
- The interactive filters support 29 bit CAN IDs
- New interactive command to clear/redraw the screen (<SPACE><ENTER>)
- New interactive commands to enable/disable SFF/EFF frames
    a<ENTER>        - enable 'a'll SFF CAN-IDs to sniff
    n<ENTER>        - enable 'n'one SFF CAN-IDs to sniff
    A<ENTER>        - enable 'A'll EFF CAN-IDs to sniff
    N<ENTER>        - enable 'N'one EFF CAN-IDs to sniff
- Fixes in bit change colorization and gap calculation detected at rework
2020-05-07 18:35:50 +02:00
Rasmus Pedersen 729e346d31
cangen.c: added -c option for bursty output. (#201)
added -c option for bursty output.
specify -c 100 to have 100 packets sent in burst before a gap.
use for example -p 1000 to avoid TX buffer full errors
2020-05-05 10:14:58 +02:00
Oliver Hartkopp 7575d43fd2 cangen: fix doubled description in help text
The help2man conversion created a second application description.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 19:11:41 +02:00
Oliver Hartkopp 2a8867f3cb cansniffer: add short description in help text
Following other can-utils applications.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 19:06:57 +02:00
Oliver Hartkopp ab2e8ffe0e cansniffer: formatting and variable renaming
Some unification of code formatting and rename of a variable in
print_snifline() which does not represent a CAN ID anymore.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 18:56:25 +02:00
Oliver Hartkopp ac55db508a cansniffer: exit after displaying help text
Do not start the application when the user wants to read the help text.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 09:55:28 +02:00
Oliver Hartkopp 64e33bf9ad cansniffer: add new interactive commands to enable/disable SFF/EFF frames
With the new commands

a<ENTER>        - enable 'a'll SFF CAN-IDs to sniff
n<ENTER>        - enable 'n'one SFF CAN-IDs to sniff
A<ENTER>        - enable 'A'll EFF CAN-IDs to sniff
N<ENTER>        - enable 'N'one EFF CAN-IDs to sniff

the EFF/SFF frames can be added/removed with a single command.
Of course this could be done with the '+' and '-' filters too.
But 'N' is much easier to type then '-0000000000000000' ...

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 09:52:20 +02:00
Oliver Hartkopp adf29573f4 cansniffer: add interactive command to clear/redraw the screen
For efficiency reasons on slow embedded machines cansniffer usually
does not clear the screen but only writes updates on required lines.
Sometimes the written lines exceed the terminal lines and people
resize the window which is not detected by cansniffer.

With entering <SPACE><ENTER> in interactive mode the screen can be
forced to redraw after resizing the terminal window.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 09:51:33 +02:00
Oliver Hartkopp bd6ef44321 cansniffer: support EFF frames with 29 bit CAN IDs
Convert cansniffer from CAN_BCM to CAN_RAW sockets and handle the
content filter in user space. Conversion CAN_RAW including slot
concept and sorting contributed by coryjfowler.

Functional changes visible to users:

- New format for settings file
- New command '8' to switch in a compact binary view for 80 columns view
- New head line layout
- The gap time between CAN frames is displayed in milli seconds (ms)
- The interactive filters support 29 bit CAN IDs

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 09:48:52 +02:00
Oliver Hartkopp 6d112a7209 cansniffer: terminate when settings file is not found
Clean up readsettings() and terminate when the settings file
'sniffset.*' is not found when given on commandline.

The readsettings() status output could not be read anyway due to
instant redraw from CAN frames.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 07:18:47 +02:00
Oliver Hartkopp 6f44582c19 cansniffer: make use of if_nametoindex()
Simplify the code as in other can-utils applications.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 06:57:16 +02:00
Oliver Hartkopp 507ff82d81 cansniffer: remove CAN_BCM specific functionalities
Remove functionalities that are not supported resp. can not be implemented
after the CAN_BCM to CAN_RAW conversion of cansnifffer.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-29 06:49:39 +02:00
Oliver Hartkopp 1665abf46f can-utils: fix missing include of libgen.h
The basename() function needs libgen.h to be included as otherwise this
will fail to compile in some environments.

Reported-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-28 19:14:52 +02:00
Oliver Hartkopp 853989bed2 canplayer: make help text fit into 80 colums again
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-28 19:01:45 +02:00
Oliver Hartkopp f3ced10007 cangw: make help text fit into 80 colums again
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-28 19:01:07 +02:00
Oliver Hartkopp 819a03f6e2 candump: fix/unify help text indention
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-28 18:59:37 +02:00
Oliver Hartkopp e266422c54 isotpdump: make help text fit into 80 colums again
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-28 18:57:26 +02:00
Oliver Hartkopp 5ca66d7bea slcanpty: simplify tool decription in help text
Simplify tool description and format the empty lines like in other
(e.g. slcand) tools.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-27 11:09:05 +02:00
Oliver Hartkopp d007263021 cansend: simplify tool decription in help text
Simplify tool description and format the empty lines like in other
(e.g. slcand) tools.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-27 10:53:02 +02:00
Oliver Hartkopp f91b537c01
Merge pull request #69 from gerasiov/help-reformat
Reformat output of help/usage information - Thanks Alexander!
2020-04-27 09:16:13 +02:00
Alexander GQ Gerasiov b43d1b4d27 cansend.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0010-cansend.c-Reformat-help-usage-output-to-be-compatibl.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov f638cdc79b slcanpty.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0029-slcanpty.c-Reformat-help-usage-output-to-be-compatib.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov d89b38de8a jcat.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0028-jcat.c-Reformat-help-usage-output-to-be-compatible-w.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov d39cb046d1 testj1939.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0025-testj1939.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 9e491bc553 slcand.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0024-slcand.c-Reformat-help-usage-output-to-be-compatible.patch
2020-04-27 08:20:09 +03:00