summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2019-10-25 18:51:50 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-10-25 18:51:50 +0200
commitfaad2098334855365291610f15fbb13f0ce2351d (patch)
tree589c2d46d5a920ce7f8edabda297c0f88a7b8dd8
parent3437b75b308f256fe764801a2a6b0332b919a044 (diff)
downloadcanutils-faad2098334855365291610f15fbb13f0ce2351d.tar.gz
cansequence: receive snd show error frames
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--src/cansequence.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cansequence.c b/src/cansequence.c
index 87347d6..ce25009 100644
--- a/src/cansequence.c
+++ b/src/cansequence.c
@@ -95,12 +95,19 @@ static void do_receive()
uint32_t sequence_delta = 0;
uint32_t sequence = 0;
unsigned int overflow_old = 0;
+ can_err_mask_t err_mask = CAN_ERR_MASK;
if (setsockopt(s, SOL_SOCKET, SO_RXQ_OVFL,
&dropmonitor_on, sizeof(dropmonitor_on)) < 0) {
perror("setsockopt() SO_RXQ_OVFL not supported by your Linux Kernel");
}
+ /* enable recv. of error messages */
+ if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask, sizeof(err_mask))) {
+ perror("setsockopt()");
+ exit(EXIT_FAILURE);
+ }
+
/* enable recv. now */
if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, filter, sizeof(filter))) {
perror("setsockopt()");
@@ -120,6 +127,15 @@ static void do_receive()
exit(EXIT_FAILURE);
}
+ if (frame.can_id & CAN_ERR_FLAG) {
+ fprintf(stderr,
+ "sequence CNT: %6u, ERRORFRAME %7x %02u %02u %02u %02u %02u %02u %02u %02u\n",
+ sequence, frame.can_id,
+ frame.data[0], frame.data[1], frame.data[2], frame.data[3],
+ frame.data[4], frame.data[5], frame.data[6], frame.data[7]);
+ continue;
+ }
+
sequence_rx = frame.data[0];
if (sequence_init) {