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