Commit Graph

27 Commits (6f44582c19c8d7185dc1a4e2fd33874511f5d315)

Author SHA1 Message Date
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
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
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
Oliver Hartkopp eb639c1b3d cansniffer: fix gap calculation output
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>
2020-04-26 08:30:55 +02:00
Fabrice Fontaine e9590b1ca7 fix include to find SIOCGSTAMP with latest kernel
In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115
the asm-generic/sockios.h header no longer defines SIOCGSTAMP.
Instead it provides only SIOCGSTAMP_OLD.

The linux/sockios.h header now defines SIOCGSTAMP using either
SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. This linux only
header file is not pulled so we get a build failure.

canlogserver.c: In function 'main':
canlogserver.c:404:21: error: 'SIOCGSTAMP' undeclared (first use in this function); did you mean 'SIOCGRARP'?
     if (ioctl(s[i], SIOCGSTAMP, &tv) < 0)
                     ^~~~~~~~~~
                     SIOCGRARP
canlogserver.c:404:21: note: each undeclared identifier is reported only once for each function it appears in

Fixes:
 - http://autobuild.buildroot.org/results/363de7d9bf433be8bc47ba4ee52ae0bb80fa9021

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-07-14 22:14:10 +02:00
Yegor Yefremov 7b7331976a Add SPDX identifiers
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-06-19 12:24:24 +02:00
Yegor Yefremov 1ce4dc7b39 Add missing return value checks
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2018-09-18 13:43:29 +02:00
Heydar Elahi c45ee0cdbe omit extra sets and clears
old code does extra sets and clears in case of quiet==1 so I've changed if statement orders and used else if
2017-08-09 18:53:35 +04:30
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
Marc Kleine-Budde 18f8416a40 cansniffer: increase resolution for timeout values
As requested by Felix Seitz the timeout for screen updates should be
configurable to values smaller than 100ms. Marc Kleine-Budde provided the
original patch to increase the resolution of the timing relevant variables.

The rotating animation was replaced by a rolling screen update counter.
Additionally the CAN-ID is now printed in the same ASCII hex representation
as the CAN data.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2014-06-24 21:36:55 +02:00
Uwe Kleine-König cc82fd9737 cansniffer: fix file name in header
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
2013-08-17 19:04:48 +02: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
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 4369ac1c55 Consistencely allow '-?' to get a help text. 2009-01-13 09:32:45 +00:00
Oliver Hartkopp e7046e7fca Added interface name to parameter list in first line. 2008-11-17 10:23:42 +00:00
Oliver Hartkopp 5621884558 Added missing help test. 2008-07-10 11:01:37 +00:00
Oliver Hartkopp f33075946d Added -f option to filter only on the CAN-ID and not on the content.
This can be useful when the timestamp cyle needs to be displayed.
2008-07-10 10:59:37 +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 5f164d3414 - allow timout to be zero, which means timeout is off. 2007-12-10 15:47:01 +00:00
Oliver Hartkopp 12f9170338 Fixed checking of CAN interface name commandline parameter.
Cosmetics.
2007-10-07 14:39:52 +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 44fb4089c3 Update outdated comment. 2007-09-21 07:21:24 +00:00
Oliver Hartkopp 8d365bc5b0 Added the blanking of 'old' data when the can_dlc decreases between two
receiptions of the same can_id.
Thanks to Andre Naujoks for the bug report.
2007-07-16 09:52:43 +00:00
Oliver Hartkopp 01a8c5d32b Added -B option to display binary content with a gap after each data byte.
This option is similar to -b but may exceed the 80 char boundary.
2007-07-16 08:29:28 +00:00
Oliver Hartkopp 477c00752b Fixed compilation warning on 64bit architectures.
Thanks to Neal Probert for the hint.
2007-07-08 12:44:12 +00:00
Oliver Hartkopp 30426b2647 Renamed can-sniffer to cansniffer. 2007-02-08 13:18:07 +00:00