python-can tools

python-can comes with a range of useful command-line tools (similar to Linux can-utils). For more information see https://python-can.readthedocs.io/en/stable/scripts.html.

This page includes examples on how to use python-can tools relevant to the python-can-csscan-txt package.

Note

The examples on this page assume that the python-can-csscan-txt package has been installed and the Python environment is active.


can-player

The can-player tool (similar to can-utils canplayer) can be used to replay log-files to any interface supported by python-can (e.g. csscan_serial).

For more information see https://python-can.readthedocs.io/en/stable/scripts.html#can-player

can-player, replay file 0000001.TXT to screen using original time-spacing
$ can_player --interface virtual -v 0000001.TXT

Can LogReader (Started on 2024-01-01 12:00:00.000000)
Timestamp: 1707825204.228200  ID:  002  S Rx  DL:  8  10 32 f0 37 40 32 30 38  Channel: CAN 1
Timestamp: 1707825204.228650  ID:  003  S Rx  DL:  8  10 32 00 38 30 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238200  ID:  002  S Rx  DL:  8  30 32 d0 37 70 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238700  ID:  003  S Rx  DL:  8  40 32 e0 37 50 32 00 38  Channel: CAN 1
can-player, replay file 0000001.TXT to interface using original time-spacing
$ can_player --interface csscan_serial --channel COM1 -v 0000001.TXT

Can LogReader (Started on 2024-01-01 12:00:00.000000)
Timestamp: 1707825204.228200  ID:  002  S Rx  DL:  8  10 32 f0 37 40 32 30 38  Channel: CAN 1
Timestamp: 1707825204.228650  ID:  003  S Rx  DL:  8  10 32 00 38 30 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238200  ID:  002  S Rx  DL:  8  30 32 d0 37 70 32 10 38  Channel: CAN 1
Timestamp: 1707825204.238700  ID:  003  S Rx  DL:  8  40 32 e0 37 50 32 00 38  Channel: CAN 1
...

To manually control replay scheduling, use the --ignore-timestamps and -g arguments.

can-player, replay file 0000001.TXT using fixed time spacing (1 second)
$ can_player --interface csscan_serial --channel COM1 -v --ignore-timestamps -g 1 0000001.TXT