Commit Graph

557 Commits (c5cb7e1a7c0562dd52c295583d859c5920abbbb7)

Author SHA1 Message Date
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
Alexander Gerasiov 09f6dc6d17 slcan_attach.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0023-slcan_attach.c-Reformat-help-usage-output-to-be-comp.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 8e6c11128d log2asc.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0022-log2asc.c-Reformat-help-usage-output-to-be-compatibl.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 276688f2ad jsr.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0021-jsr.c-Reformat-help-usage-output-to-be-compatible-wi.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 0155472ee0 jspy.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0020-jspy.c-Reformat-help-usage-output-to-be-compatible-w.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov 211c5cea49 can-calc-bit-timing.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0020-can-calc-bit-timing.c-Reformat-help-usage-output-to-.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov c1fdfb09fc jcat.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>

Gbp-Pq: Name 0019-jcat.c-Reformat-help-usage-output-to-be-compatible-w.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 506252e9bc jacd.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0019-jacd.c-Reformat-help-usage-output-to-be-compatible-w.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 89c66aba5f isotptun.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0018-isotptun.c-Reformat-help-usage-output-to-be-compatib.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov c61c9bc030 isotpsniffer.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0017-isotpsniffer.c-Reformat-help-usage-output-to-be-comp.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov 9240ccfcb7 isotpserver.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0016-isotpserver.c-Reformat-help-usage-output-to-be-compa.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 3d6a53550e isotpsend.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0015-isotpsend.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov 1cf4d86874 isotprecv.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0014-isotprecv.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 4db63e4b55 isotpperf.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0013-isotpperf.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Alexander GQ Gerasiov 24af048812 isotpdump.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0012-isotpdump.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 4568d4a180 cansniffer.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0011-cansniffer.c-Reformat-help-usage-output-to-be-compat.patch
2020-04-27 08:20:09 +03:00
Alexander Gerasiov 3e2c1d3cbd canplayer.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0009-canplayer.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov 65399166c1 canlogserver.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0008-canlogserver.c-Reformat-help-usage-output-to-be-comp.patch
2020-04-27 08:20:08 +03:00
Alexander GQ Gerasiov 1127609357 cangw.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0007-cangw.c-Reformat-help-usage-output-to-be-compatible-.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov f503097a38 cangen.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0006-cangen.c-Reformat-help-usage-output-to-be-compatible.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov c56259ab33 canfdtest.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0005-canfdtest.c-Reformat-help-usage-output-to-be-compati.patch
2020-04-27 08:20:08 +03:00
Alexander GQ Gerasiov 6db632531d candump.c: Reformat help/usage output to be compatible with help2man.
Gbp-Pq: Name 0004-candump.c-Reformat-help-usage-output-to-be-compatibl.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov f4a9e5b57d can-calc-bit-timing.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0003-can-calc-bit-timing.c-Reformat-help-usage-output-to-.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov 69865c8247 canbusload.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0002-canbusload.c-Reformat-help-usage-output-to-be-compat.patch
2020-04-27 08:20:08 +03:00
Alexander Gerasiov b740fb7fab asc2log.c: Reformat help/usage output to be compatible with help2man.
Signed-off-by: Alexander Gerasiov <gq@debian.org>

Gbp-Pq: Name 0001-asc2log.c-Reformat-help-usage-output-to-be-compatibl.patch
2020-04-27 08:20:08 +03:00
Oliver Hartkopp bceadb8696 cansniffer: fix colorization when notching relevant bits
When notching marked (and colored) bits with the interactive '#' command
the binary output omits colored bits - as intended.

But when switching back to the hex and ASCII output the bytes with
notched bits remained uncolored even when some bits inside the hex bytes
would have needed to be colored.

The check for the colored output was a logical AND operation which is
fine for the binary representation but needed to be a bit-wise operation
in the hex/ASCII byte mode case.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2020-04-26 15:56:08 +02:00