mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-23 00:21:14 +02:00
candump: add option -e to dump error messages in human readable format
If "candump" is called with the option "-e", the error messages are
dumped in human readable format:
# candump -e any,0:0,#FFFFFFFF
...
can0 20000088 [8] 00 00 80 19 00 00 00 00 ERRORFRAME
protocol-violation{{error-on-tx}{acknowledge-slot}}
bus-error
error-counter{tx{128}rx{97}}
...
can0 2000008C [8] 00 08 80 19 00 00 00 00 ERRORFRAME
controller-problem{tx-error-warning}
protocol-violation{{error-on-tx}{acknowledge-slot}}
bus-error
error-counter{tx{128}rx{97}}
"candump" actually calles a library function snprintf_can_error_frame()
to do the formatting. It could be used for other purposes as well.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
This commit is contained in:
@@ -121,6 +121,7 @@ void print_usage(char *prg)
|
||||
fprintf(stderr, " -n <count> (terminate after receiption of <count> CAN frames)\n");
|
||||
fprintf(stderr, " -r <size> (set socket receive buffer to <size>)\n");
|
||||
fprintf(stderr, " -d (monitor dropped CAN frames)\n");
|
||||
fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
|
||||
fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
|
||||
@@ -235,7 +236,7 @@ int main(int argc, char **argv)
|
||||
last_tv.tv_sec = 0;
|
||||
last_tv.tv_usec = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldLn:r:h?")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldLn:r:he?")) != -1) {
|
||||
switch (opt) {
|
||||
case 't':
|
||||
timestamp = optarg[0];
|
||||
@@ -263,6 +264,10 @@ int main(int argc, char **argv)
|
||||
view |= CANLIB_VIEW_SWAP;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
view |= CANLIB_VIEW_ERROR;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
silent = atoi(optarg);
|
||||
if (silent > SILENT_ON) {
|
||||
|
||||
Reference in New Issue
Block a user