The necessary iproute2 patch to play with the above 2 patches:
>From 310485c359b1e0d8f1e0e17aee5bca0b6cf10d30 Mon Sep 17 00:00:00 2001
From: Christian Pellegrin <[email protected]>
Date: Sun, 7 Feb 2010 09:58:42 +0100
Subject: [PATCH] bus-error tec rec
---
include/linux/can/netlink.h | 3 +++
ip/iplink_can.c | 14 +++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
index bd969a6..364ae21 100644
--- a/include/linux/can/netlink.h
+++ b/include/linux/can/netlink.h
@@ -81,6 +81,7 @@ struct can_ctrlmode {
#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
#define CAN_CTRLMODE_ONE_SHOT 0x8 /* One-Shot mode */
+#define CAN_CTRLMODE_BUS_ERROR 0x10 /* Bus-error support mode */
/*
@@ -93,6 +94,8 @@ struct can_device_stats {
__u32 bus_off; /* Changes to bus off state */
__u32 arbitration_lost; /* Arbitration lost errors */
__u32 restarts; /* CAN controller re-starts */
+ __u8 tec;
+ __u8 rec;
};
/*
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 5d0d82c..5bd1953 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -31,6 +31,7 @@ static void usage(void)
"\t[ listen-only { on | off } ]\n"
"\t[ triple-sampling { on | off } ]\n"
"\t[ one-shot { on | off } ]\n"
+ "\t[ bus-error { on | off } ]\n"
"\n"
"\t[ restart-ms TIME-MS ]\n"
"\t[ restart ]\n"
@@ -86,6 +87,7 @@ static void print_ctrlmode(FILE *f, __u32 cm)
_PF(CAN_CTRLMODE_LISTENONLY, "LISTEN-ONLY");
_PF(CAN_CTRLMODE_3_SAMPLES, "TRIPLE-SAMPLING");
_PF(CAN_CTRLMODE_ONE_SHOT, "ONE-SHOT");
+ _PF(CAN_CTRLMODE_ONE_SHOT, "BUS-ERROR");
#undef _PF
if (cm)
fprintf(f, "%x", cm);
@@ -148,6 +150,10 @@ static int can_parse_opt(struct link_util *lu,
int argc, char **argv,
NEXT_ARG();
set_ctrlmode("one-shot", *argv, &cm,
CAN_CTRLMODE_ONE_SHOT);
+ } else if (matches(*argv, "bus-error") == 0) {
+ NEXT_ARG();
+ set_ctrlmode("bus-error", *argv, &cm,
+ CAN_CTRLMODE_BUS_ERROR);
} else if (matches(*argv, "restart") == 0) {
__u32 val = 1;
@@ -253,11 +259,13 @@ static void can_print_xstats(struct link_util *lu,
stats = RTA_DATA(xstats);
fprintf(f, "\n "
"re-started bus-errors arbit-lost "
- "error-warn error-pass bus-off");
- fprintf(f, "\n %-10d %-10d %-10d %-10d %-10d %-10d",
+ "error-warn error-pass bus-off "
+ "tec rec");
+ fprintf(f, "\n %-10d %-10d %-10d %-10d %-10d %-10d %-10d
%-10d",
stats->restarts, stats->bus_error,
stats->arbitration_lost, stats->error_warning,
- stats->error_passive, stats->bus_off);
+ stats->error_passive, stats->bus_off,
+ stats->tec, stats->rec);
}
}
--
1.5.6.5
--
Christian Pellegrin, see http://www.evolware.org/chri/
"Real Programmers don't play tennis, or any other sport which requires
you to change clothes. Mountain climbing is OK, and Real Programmers
wear their climbing boots to work in case a mountain should suddenly
spring up in the middle of the computer room."
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users