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>
The tool 'candump' is used to dump CAN traffic to stdout or logfile.
In early days where the in-kernel CAN gateway (can-gw) with the cangw tool was
not yet implemented the bridging functionality allowed to send received (and
filtered) CAN frames to another outgoing CAN interface.
As we now have can-gw and sending CAN frames from a 'reading tool' seems wrong
especially from the Unix philosophy "Write programs that do one thing and do
it well." this patch removes the obsolete functionality from candump.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This was used in the non mainline stack version.
Removing this call allows to use jacd without root permissions.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Upstream version of J1939 stack has different UAPI. To make documented
testj1939 examples work again we need at least boradcast flag.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Include err.h and remove the unneeded parameter errno and
its header include.
Fixes: 791b6de ("treewide: Fix compilation on libmusl, replace error() by err()")
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
When -Wformat-overflow= is enabled the gcc notes ...
"‘sprintf’ output between 30 and 82 bytes into a destination of size xx"
Increasing the buffer for the file name to 83 bytes removes the warning.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
As seen in https://github.com/linux-can/can-utils/issues/150 the logfile
format switch ignores the silent mode switch.
Fix this by checking the silent mode when using logfile format on stdout.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
As remarked by Victor in https://github.com/linux-can/can-utils/issues/150
the output in the case of silent mode has puzzled line feeds.
Reported-by: Victor Cushman <VictorSCushman@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>