DOKK / manpages / debian 11 / python3-can / can_viewer.1.en
CAN_VIEWER(1) User Commands CAN_VIEWER(1)

can_viewer - CAN data viewer 3.0.0+github

python -m can.viewer [-h] [--version] [-b BITRATE] [-c CHANNEL]

[-d {<id>:<format>,<id>:<format>:<scaling1>:...:<scalingN>,file.txt}]
[-f {<can_id>:<can_mask>,<can_id>~<can_mask>}] [-i {iscan,ixxat,kvaser,neovi,nican,pcan,serial,slcan,socketcan,socketcan_ctypes,socketcan_native,usb2can,vector,virtual}]

A simple CAN viewer terminal application written in Python

Show this help message and exit
Show program's version number and exit
Bitrate to use for the given CAN interface
Most backend interfaces require some sort of channel. For example with the serial interface the channel might be a rfcomm device: "/dev/rfcomm0" with the socketcan interfaces valid channel examples include: "can0", "vcan0". (default: use default for the specified interface)
Specify how to convert the raw bytes into real values. The ID of the frame is given as the first argument and the format as the second. The Python struct package is used to unpack the received data where the format characters have the following meaning:
< = little-endian, > = big-endian
x = pad byte c = char ? = bool b = int8_t, B = uint8_t h = int16, H = uint16 l = int32_t, L = uint32_t q = int64_t, Q = uint64_t f = float (32-bits), d = double (64-bits)
$ python -m can.viewer -d "100:<BHL"
An optional conversion from integers to real units can be given as additional arguments. In order to convert from raw integer values the values are multiplied with the corresponding scaling value, similarly the values are divided by the scaling value in order to convert from real units to raw integer values. Fx lets say the uint8_t needs no conversion, but the uint16 and the uint32_t needs to be divided by 10 and 100 respectively:
$ python -m can.viewer -d "101:<BHL:1:10.0:100.0"
Multiple arguments are separated by spaces:
$ python -m can.viewer -d "100:<BHL" "101:<BHL:1:10.0:100.0"
can be given as input:
$ cat file.txt
100:<BHL
101:<BHL:1:10.0:100.0
$ python -m can.viewer -d file.txt
Comma separated CAN filters for the given CAN interface:
<can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask)
<can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask)
python -m can.viewer -f 100:7FC
Note that the ID and mask are alway interpreted as hex values
Specify the backend CAN interface to use.

+---------+-------------------------+

|
Key | Description |

+---------+-------------------------+

| ESQ/q
| Exit the viewer |
| c
| Clear the stored frames |
| s
| Sort the stored frames |
| SPACE
| Pause the viewer |
| UP/DOWN | Scroll the viewer
|

+---------+-------------------------+

February 2019 can_viewer 3.0.0+github