Updated Tx/Rx changes to be backward compatible
parent
8ea410d34f
commit
3125b3a975
|
|
@ -72,6 +72,8 @@ void print_usage(char *prg)
|
||||||
|
|
||||||
void prframe(FILE *file, struct timeval *tv, int dev, struct canfd_frame *cf, unsigned int max_dlen, char *msgdir) {
|
void prframe(FILE *file, struct timeval *tv, int dev, struct canfd_frame *cf, unsigned int max_dlen, char *msgdir) {
|
||||||
|
|
||||||
|
char buf[CL_CFSZ]; /* max length */
|
||||||
|
|
||||||
fprintf(file, "(%ld.%06ld) ", tv->tv_sec, tv->tv_usec);
|
fprintf(file, "(%ld.%06ld) ", tv->tv_sec, tv->tv_usec);
|
||||||
|
|
||||||
if (dev > 0)
|
if (dev > 0)
|
||||||
|
|
@ -79,9 +81,11 @@ void prframe(FILE *file, struct timeval *tv, int dev, struct canfd_frame *cf, un
|
||||||
else
|
else
|
||||||
fprintf(file, "canX ");
|
fprintf(file, "canX ");
|
||||||
|
|
||||||
fprintf(file, "%s ", msgdir);
|
sprint_canframe(buf, cf, 0, max_dlen);
|
||||||
|
fprintf(file, "%-25s ", buf);
|
||||||
|
|
||||||
|
fprintf(file, "%s \n", msgdir);
|
||||||
|
|
||||||
fprint_canframe(file, cf, "\n", 0, max_dlen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_can_id(struct canfd_frame *cf, char *idstring, int base) {
|
void get_can_id(struct canfd_frame *cf, char *idstring, int base) {
|
||||||
|
|
|
||||||
|
|
@ -706,9 +706,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* log CAN frame with absolute timestamp & device */
|
/* log CAN frame with absolute timestamp & device */
|
||||||
sprint_canframe(buf, &frame, 0, maxdlen);
|
sprint_canframe(buf, &frame, 0, maxdlen);
|
||||||
fprintf(logfile, "(%010ld.%06ld) %*s %s %s\n",
|
fprintf(logfile, "(%010ld.%06ld) %*s %-25s %s\n",
|
||||||
tv.tv_sec, tv.tv_usec,
|
tv.tv_sec, tv.tv_usec,
|
||||||
max_devname_len, devname[idx], (msg.msg_flags & MSG_DONTROUTE)?"Tx":"Rx", buf);
|
max_devname_len, devname[idx], buf, (msg.msg_flags & MSG_DONTROUTE)?"Tx":"Rx");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((logfrmt) && (silent == SILENT_OFF)){
|
if ((logfrmt) && (silent == SILENT_OFF)){
|
||||||
|
|
|
||||||
|
|
@ -227,10 +227,14 @@ int main(int argc, char **argv)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sscanf(buf, "(%ld.%ld) %s %s %s", &tv.tv_sec, &tv.tv_usec,
|
if (sscanf(buf, "(%ld.%ld) %s %s %s", &tv.tv_sec, &tv.tv_usec,
|
||||||
device, msgdir, ascframe) != 5) {
|
device, ascframe,msgdir) != 5) {
|
||||||
|
sscanf("Rx", "%s", msgdir); /* To support candump log file without Rx/Tx info */
|
||||||
|
if (sscanf(buf, "(%ld.%ld) %s %s", &tv.tv_sec, &tv.tv_usec,
|
||||||
|
device, ascframe) != 4) {
|
||||||
fprintf(stderr, "incorrect line format in logfile\n");
|
fprintf(stderr, "incorrect line format in logfile\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!start_tv.tv_sec) { /* print banner */
|
if (!start_tv.tv_sec) { /* print banner */
|
||||||
start_tv = tv;
|
start_tv = tv;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue