Minor fix and cosmetics in color handling in candump.c .

Added new tool 'canplayer' to replay logfiles generated by candump -l .

Features of canplayer:

- Input from stdin or file.
- throttling of the replay to get nearly original timestamps / message gaps
- mapping and selection of CAN interfaces (assignment)
  e.g. canplay -I logfile vcan2=can2 vcan0=can1 can2=can3
  means: send frames received on can1 in the logfile to vcan0 and so on ...
- if no assignment is made the original interfaces are used for replay
- handling of multiple CAN interfaces simultaneously (if in logfile)
- option: throttle disable (do not look on timestamps => very FAST replay!)
- option: change the 'sleep time' in milli seconds

Remarks:
canplayer uses nanosleep() for throttling which means that the resolution of
the canplayer is about 1ms (Kernel HZ = 1000) or 10ms (Kernel HZ = 100).
After each nanosleep() all the CAN frames are send that had to be transmitted
until the timestamp at the current time. Giving e.g. the option '-g 500' for
500ms let's you see the behaviour. Using nanosleep() makes canplay a very
performant tool with minimum CPU load.

To transfer CAN frames over a TCP/IP network you may now say something like:
candump -> netcat -> netcat -> canplayer
This commit is contained in:
Oliver Hartkopp
2007-01-06 15:43:12 +00:00
parent f95fc47ec8
commit 4d129ea348
3 changed files with 411 additions and 15 deletions
+4 -4
View File
@@ -465,7 +465,7 @@ int main(int argc, char **argv)
continue;
}
printf(" %s",(color>2)?col_on[idx]:"");
printf(" %s", (color>2)?col_on[idx]:"");
switch (timestamp) {
@@ -508,13 +508,13 @@ int main(int argc, char **argv)
break;
}
printf(" %s",(color && (color<3))?col_on[idx]:"");
printf(" %s", (color && (color<3))?col_on[idx]:"");
printf("%*s", max_devname_len, devname[idx]);
printf("%s ",(color<2)?col_off:"");
printf("%s ", (color==1)?col_off:"");
fprint_long_canframe(stdout, &frame, NULL, ascii);
printf("%s",(color>1)?col_off:"");
printf("%s", (color>1)?col_off:"");
printf("\n");
}
fflush(stdout);