Go to file
oleg 22172309e1 add regex search 2026-04-13 07:08:38 +03:00
cmake add docker run, arm64 cross-build in docker 2026-04-12 19:01:22 +03:00
docker add docker run, arm64 cross-build in docker 2026-04-12 19:01:22 +03:00
src add regex search 2026-04-13 07:08:38 +03:00
thirdparty move patches 2026-04-10 18:57:59 +03:00
.clang-format init commit 2026-04-09 11:00:31 +03:00
CMakeLists.txt add regex search 2026-04-13 07:08:38 +03:00
LICENSE add license, fix clipp 2026-04-09 12:11:38 +03:00
Makefile add regex search 2026-04-13 07:08:38 +03:00
README.md add docker run, arm64 cross-build in docker 2026-04-12 19:01:22 +03:00
canscope-demo.gif fix readme, demo 2026-04-10 13:30:51 +03:00

README.md

{canscope}

CAN bus sniffer and SAE J1939 protocol analyzer. Reads CAN frames in candump format, decodes them using a J1939 Digital Annex (xlsx), and presents results in an interactive terminal UI or as JSON output.

demo

Features

  • TUI mode - full-screen interactive terminal interface (FTXUI). Multiple display modes per CAN ID: deployed, brief, verbose, manual, little-endian
  • Headless mode - JSON output to stdout or file, for scripting and automation
  • Recording - decoded J1939 SPN values saved to SQLite database with gzip compression and batch flushing
  • J1939 decoding - PGN/SPN lookup, bit-level value extraction from payload
  • CAN playback - replay recorded CAN frames
  • Custom SPN configuration - per-parameter settings, parameter export
  • Real-time - 30 fps UI refresh

Build

Requirements:

  • clang++ with C++23 support
  • CMake >= 3.13
  • Ninja
  • System libraries: boost (signals2, spirit, phoenix), sqlite3, zlib

Dependencies fetched automatically via CMake FetchContent:

Available targets

make list              # Show all targets

make build             # Native build (dynamic linking)
make build_static      # Native build (static linking)
make install           # Install to PREFIX (default /usr/local), requires patchelf
make install_static    # Install static binary to PREFIX

make docker-run ARGS='...'       # Build and run in Docker (cross-platform)
make build_arm64                 # Cross-compile for arm64 (dynamic)
make build_arm64_static          # Cross-compile for arm64 (static)

make clean             # Remove all build artifacts

Native build

make build
./build/native/canscope -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx

Docker (cross-platform)

Works on Linux, macOS (?), and Windows (?). Requires only Docker and Make.

# TUI mode - local CAN interface
make docker-run ARGS='-e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx'

# TUI mode - remote CAN interface via SSH (no data if will ask password - use public key access or sshpass utility)
make docker-run ARGS='-e "ssh user@remote candump can0" -j1939 thirdparty/j1939da_2018.xlsx'

# Headless mode - create report about collected PGNs and SPNs
make docker-run ARGS='-hl -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx -of output.json'

Cross-compile for arm64

make build_arm64           # dynamic linking
make build_arm64_static    # static linking

Requires Docker. SSH keys from ~/.ssh and /etc/hosts are forwarded into the build container for fetching private git dependencies.

Usage

# TUI mode (default)
canscope -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx

# Headless - JSON to stdout
canscope -hl -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx

# Headless - JSON to file
canscope -hl -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx -of output.json

# Read from stdin (pipe)
candump can0 | canscope -j1939 thirdparty/j1939da_2018.xlsx

# Record to SQLite database
canscope -rec -db recording.db -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx

# Record + TUI
canscope -rec -db recording.db -tui -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx

Note: J1939 decoding has only been tested with the Digital Annex 2018 edition. Other editions may work but are not guaranteed.

CLI flags

Flag Long form Description
-j1939 --j1939-document (required) J1939 Digital Annex xlsx file
-e --execute-command Command to read CAN frames from (e.g. "candump can0")
-hl --headless Headless mode (no TUI)
-of --output-file Output file path (headless mode)
-rec --record Record decoded values to SQLite
-db --database SQLite database path (required with -rec)
-tui Show TUI alongside recording
-h --help Show help

Roadmap

  • CANopen protocol support - CANopen decoding alongside J1939
  • Other small features and enhancements - UI improvements, performance optimizations, additional export formats