From cb5ab07f34662e5a99ae65a14988c04a4491172c Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Fri, 24 Jan 2025 14:11:53 +0100 Subject: [PATCH] asc2log: handle and skip TxRq messages TxRq messages are internal measurement messages that document the time of a transmission request (to the CAN driver) to be checked against the real transmission time, when the CAN message has been sent. There is no such feature in the SocketCAN log format, so we detect this tag but skip TxRq messages in the ASC log files. Signed-off-by: Oliver Hartkopp --- asc2log.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/asc2log.c b/asc2log.c index 7d7291a..aef2929 100644 --- a/asc2log.c +++ b/asc2log.c @@ -143,7 +143,7 @@ static void eval_can(char* buf, struct timeval *date_tvp, char timestamps, int len = 0; int data[8]; char tmp1[BUFLEN]; - char dir[3]; /* 'Rx' or 'Tx' plus terminating zero */ + char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *extra_info; int i, items; unsigned long long sec, usec; @@ -172,13 +172,13 @@ static void eval_can(char* buf, struct timeval *date_tvp, char timestamps, /* check for CAN frames with (hexa)decimal values */ if (base == 'h') - items = sscanf(buf, "%llu.%llu %d %s %2s %c %x %x %x %x %x %x %x %x %x", + items = sscanf(buf, "%llu.%llu %d %s %4s %c %x %x %x %x %x %x %x %x %x", &sec, &usec, &interface, tmp1, dir, &rtr, &dlc, &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7]); else - items = sscanf(buf, "%llu.%llu %d %s %2s %c %x %d %d %d %d %d %d %d %d", + items = sscanf(buf, "%llu.%llu %d %s %4s %c %x %d %d %d %d %d %d %d %d", &sec, &usec, &interface, tmp1, dir, &rtr, &dlc, &data[0], &data[1], &data[2], &data[3], @@ -252,7 +252,7 @@ static void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, unsigned int flags; int dlc, dlen = 0; char tmp1[BUFLEN]; - char dir[3]; /* 'Rx' or 'Tx' plus terminating zero */ + char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *extra_info; char *ptr; int i; @@ -270,12 +270,12 @@ static void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, */ /* check for valid line without symbolic name */ - if (sscanf(buf, "%llu.%llu %*s %d %2s %s %hhx %hhx %x %d ", + if (sscanf(buf, "%llu.%llu %*s %d %4s %s %hhx %hhx %x %d ", &sec, &usec, &interface, dir, tmp1, &brs, &esi, &dlc, &dlen) != 9) { /* check for valid line with a symbolic name */ - if (sscanf(buf, "%llu.%llu %*s %d %2s %s %*s %hhx %hhx %x %d ", + if (sscanf(buf, "%llu.%llu %*s %d %4s %s %*s %hhx %hhx %x %d ", &sec, &usec, &interface, dir, tmp1, &brs, &esi, &dlc, &dlen) != 9) {