This patch adds a fourth string field in the can logfile format.
This new field contains the rx/tx direction information R/T as the
first entry (only one character separated from the CAN frame by space).
To generate the logfile format with this extra field candump has to be
called with the '-x' option for extra message infos,
e.g. 'candump -x -l can0' or 'candump -x -L can0'
log2asc and asc2log are extended to support the direction information
but still support the previous format without direction information.
The format extension does not affect legacy tools, e.g. the existing
canplayer ignores this extra information and does not need to be changed.
Therefore the existing logfiles remain valid and usable.
The extra message infos will be colon separated when there's need for
additional content beyond the rx/tx direction information, e.g. R:xx:yyy
Suggested-by: Pallavi Revanna https://github.com/brpallu
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
As reported by Oleksij Rempel here
https://github.com/linux-can/can-utils/issues/233#issuecomment-674818935
the representation of timeval timestamps are signed values which leads to
negative values on 32 bit machines addressing the year 2038 unix sec counter
overflow.
Fix the issue on 32 bit systems by converting the timeval values to unsigned
ASCII value representations.
Fixes: https://github.com/linux-can/can-utils/issues/234
Reported-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
../asc2log.c:264:8: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
ptr = strcasestr(buf, tmp1);
^
../asc2log.c:264:6: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
ptr = strcasestr(buf, tmp1);
^ ~~~~~~~~~~~~~~~~~~~~~
../asc2log.c:328:6: warning: implicit declaration of function 'strcasestr' is invalid in C99 [-Wimplicit-function-declaration]
if (strcasestr(date, " pm ") != NULL) {
^
../asc2log.c:328:31: warning: comparison between pointer and integer ('int' and 'void *') [-Wpointer-integer-compare]
if (strcasestr(date, " pm ") != NULL) {
~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~
../asc2log.c:336:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
if (!strptime(date, "%B %d %I:%M:%S %p %Y", &tms)) {
^
../asc2log.c:354:8: warning: implicit declaration of function 'strptime' is invalid in C99 [-Wimplicit-function-declaration]
if (!strptime(date, "%B %d %H:%M:%S %Y", &tms)) {
../slcanpty.c:476:7: warning: implicit declaration of function 'grantpt' is invalid in C99 [-Wimplicit-function-declaration]
if (grantpt(p) < 0) {
^
../slcanpty.c:481:7: warning: implicit declaration of function 'unlockpt' is invalid in C99 [-Wimplicit-function-declaration]
if (unlockpt(p) < 0) {
^
../slcanpty.c:486:14: warning: implicit declaration of function 'ptsname' is invalid in C99 [-Wimplicit-function-declaration]
name_pts = ptsname(p);
^
../slcanpty.c:486:12: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
name_pts = ptsname(p);
^ ~~~~~~~~~~
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
although it looks like a false positive:
/home/travis/build/linux-can/can-utils/j1939cat.c: In function ‘main’:
/home/travis/build/linux-can/can-utils/j1939cat.c:648:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
int ret;
^
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
although it looks like a false positive:
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c: In function ‘print_bit_timing.isra.6’:
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:42: warning: ‘tseg2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
unsigned int brp, tsegall, tseg, tseg1, tseg2;
^
/home/travis/build/linux-can/can-utils/can-calc-bit-timing.c:447:35: warning: ‘tseg1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
unsigned int brp, tsegall, tseg, tseg1, tseg2;
^
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 43610bd621 ("Fix arithmetic on a pointer warning") from
Gary Bisson.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Fix missing (recently introduced) j1939 files that have not been fixed
in commit 46895a41c5 ("Fix comparison type mismatch warnings") from
Gary Bisson.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>