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>
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>
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>
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>
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>
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>
The gap between two consecutive frames of a specific has been calculated in
handle_timeo() instead of handle_bcm() which lead to values that where
at minimum the loop time of the display refresh.
The effect can be seen when displaying a 10ms gap CAN frame with a 200ms
display refresh (option -l 20 => default) in opposite to a 10ms display
refresh (option -l 1).
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Using j*smthng* for j1939-related tools is not very good for 2 reasons:
1. j prefix is not very informative;
2. jcat name is used by journal cat tool from popular sleuthkit toolkit;
2`. jacd sounds very similar to jackd.
2``. Possible future name conflicts for new tools.
Thus I renamed j* to j1939\1 to deal with this issue.
Signed-off-by: Alexander GQ Gerasiov <gq@cs.msu.su>
In commit da33f96edf ("isotpsniffer: Add support for llopts") the
setsockopt() syscall for the link layer options CAN_ISOTP_LL_OPTS
has been added.
Unfortunately the syscall has been invoked even if there were no values
given on the command line and 'zero values' have been passed to the
kernel which correctly answered with -EINVAL.
And a missing check for a mandatory non-zero value for the MTU.
Fixes: da33f96edf ("isotpsniffer: Add support for llopts")
Reported by: https://github.com/ikuyas
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
In commit da33f96edf ("isotpsniffer: Add support for llopts") the setsockopt
call has been executed twice. (copy & paste issue?)
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This avoids having the padding in the struct can_fame contain bogus
values, which are interpreted by "candump -x" as CAN-FD BRS and ESI
values.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>