Linux-CAN / SocketCAN user space applications
 
 
 
 
Go to file
Oleksij Rempel 5a681968a2 isobusfs: selftest: Handle read requests larger than file size
Add expected_size field to test patterns to properly validate cases
where the requested read size exceeds the actual file size. This allows
testing the server's behavior when clients request more data than is
available.

When a read request is larger than the file, the server correctly
returns data up to EOF. The test framework now distinguishes between
this expected scenario and genuine read failures.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2026-05-22 19:55:35 +02:00
.github/workflows github-actions: remove mips for now 2026-03-04 11:30:14 +01:00
LICENSES Add license texts as files 2019-09-26 15:45:43 +02:00
calc-bit-timing can-calc-bit-timing: common_data_bitrates: add some slower bitrates 2025-05-03 14:53:54 +02:00
cmake github-actions: add cross-compiling 2024-05-29 21:03:16 +02:00
include/linux can.h: canxl: support Remote Request Substitution bit access 2025-01-24 14:22:21 +01:00
isobusfs isobusfs: selftest: Handle read requests larger than file size 2026-05-22 19:55:35 +02:00
j1939_timedate Handle localtime_r() failure in j1939 timedate 2026-05-08 17:00:31 +02:00
j1939_vehicle_position Fill unassigned bytes with 0xFF in J1939 VP2 2026-05-08 17:18:03 +02:00
mcp251xfd mcp251xfd: mcp251xfd_regmap_read(): don't assign return value of strchr() to `char *` 2026-03-04 11:35:38 +01:00
.clang-format Add .clang-format 2023-09-05 10:50:54 +02:00
.editorconfig Add configuration file for EditorConfig 2024-05-26 17:42:43 +02:00
.gitignore gitignore: ignore new tools if building with Makefile 2025-03-03 10:18:25 +01:00
CMakeLists.txt cmake: set policy version to 3.10 2026-01-19 15:37:11 +09:00
Makefile Makefile: rely on pkg-config to detect presence of libgps 2025-03-03 13:14:05 +01:00
README.md Allow more fine-grained control over CMake targets 2025-05-21 16:40:24 +00:00
asc2log.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
bcmserver.c bcmserver: main(): rxmsg: increase buffer size to hold long network interface names 2026-03-10 10:46:12 +01:00
can-j1939-install-kernel-module.md can-j1939-install-kernel-module: convert to Unix line endings and remove trailing whitespace 2024-12-11 15:01:58 +01:00
can-j1939-kickstart.md can-j1939-kickstart.md: fix example in documentation 2020-05-30 19:32:32 +02:00
can-j1939.md Fix spelling in various files 2019-11-11 14:21:49 +01:00
can-tc-init-etf.sh can-tc-init-etf: document required kernel config options 2022-12-13 22:13:37 +01:00
canbusload.c canbusload: support busload visualization 2025-01-20 18:07:16 +01:00
candump.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
canerrsim.c canerrsim: main(): avoid buffer overflow: check length of interface name 2026-03-09 12:23:29 +01:00
canfdtest.c canfdtest: compare_frame: add 0x prefix to indicate hex value 2024-12-11 10:24:33 +01:00
canframelen.c canbusload: count databitrate seperately 2021-06-24 14:44:50 +02:00
canframelen.h canbusload: count databitrate seperately 2021-06-24 14:44:50 +02:00
cangen.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
cangw.c can-utils: make local functions static 2024-03-12 20:10:00 +01:00
canlogserver.c canlogserver: fix infinite loops during signal handling 2026-05-12 10:22:48 +02:00
canplayer.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
cansend.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
cansequence.c cansequence: add missing "--strict" to long_options 2023-12-05 10:38:23 +01:00
cansniffer.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
check_cc.sh Don't compile programs using fork() on MMU-less systems 2023-05-08 18:30:50 +02:00
fork_test.c Don't compile programs using fork() on MMU-less systems 2023-05-08 18:30:50 +02:00
isotpdump.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
isotpperf.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
isotprecv.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
isotpsend.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
isotpserver.c remove obsolete char pointer casts 2022-03-14 18:21:45 +01:00
isotpsniffer.c isotpsniffer: simplify option for CAN FD link layer 2023-12-08 17:29:04 +01:00
isotptun.c isotptun: Follow Bash exit status when signaled 2023-03-20 10:22:30 +09:00
j1939acd.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
j1939cat.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
j1939spy.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
j1939sr.c can-utils: unify indention 2025-12-13 10:38:15 +01:00
lib.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
lib.h canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
libj1939.c libj1939: Add function to connect a socket 2025-03-01 13:28:52 +01:00
libj1939.h libj1939: Add function to connect a socket 2025-03-01 13:28:52 +01:00
log2asc.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
log2long.c canxl extension: use plain union instead of typedef 2025-12-18 18:23:38 +01:00
page.theme import sample program & help page 2013-11-20 11:14:44 +01:00
slcan_attach.c slcan: increase BTR char limit to 8 for 32bit BTR 2023-02-23 16:36:33 +01:00
slcand.c slcand: Don't fail when it wasn't possible to fetch the interface name. 2025-04-06 10:03:36 +02:00
slcanpty.c can-utils: fix sign-compare warnings (#513) 2024-04-24 20:02:02 +02:00
style.css import sample program & help page 2013-11-20 11:14:44 +01:00
terminal.h Add SPDX identifiers 2019-06-19 12:24:24 +02:00
testj1939.c can-utils: unify indention 2025-12-13 10:38:15 +01:00

README.md

SocketCAN logo

SocketCAN userspace utilities and tools

This repository contains some userspace utilities for Linux CAN subsystem (aka SocketCAN):

Basic tools to display, record, generate and replay CAN traffic

  • candump : display, filter and log CAN data to files
  • canplayer : replay CAN logfiles
  • cansend : send a single frame
  • cangen : generate (random) CAN traffic
  • cansequence : send and check sequence of CAN frames with incrementing payload
  • cansniffer : display CAN data content differences

CAN access via IP sockets

  • canlogserver : log CAN frames and serves them
  • bcmserver : interactive BCM configuration (remote/local)
  • socketcand : use RAW/BCM/ISO-TP sockets via TCP/IP sockets
  • cannelloni : UDP/SCTP based SocketCAN tunnel

CAN in-kernel gateway configuration

  • cangw : CAN gateway userspace tool for netlink configuration

CAN bus measurement and testing

  • canbusload : calculate and display the CAN busload
  • can-calc-bit-timing : userspace version of in-kernel bitrate calculation
  • canfdtest : Full-duplex test program (DUT and host part)
  • canerrsim : CAN error message simulator

ISO-TP tools ISO15765-2:2016 for Linux

  • isotpsend : send a single ISO-TP PDU
  • isotprecv : receive ISO-TP PDU(s)
  • isotpsniffer : 'wiretap' ISO-TP PDU(s)
  • isotpdump : 'wiretap' and interpret CAN messages (CAN_RAW)
  • isotpserver : IP server for simple TCP/IP <-> ISO 15765-2 bridging (ASCII HEX)
  • isotpperf : ISO15765-2 protocol performance visualisation
  • isotptun : create a bi-directional IP tunnel on CAN via ISO-TP

J1939/ISOBus tools

  • j1939acd : address claim daemon
  • j1939cat : take a file and send and receive it over CAN
  • j1939spy : spy on J1939 messages using SOC_J1939
  • j1939sr : send/recv from stdin or to stdout
  • testj1939 : send/receive test packet

Follow the link to see examples on how this tools can be used: Kickstart guide to can-j1939 on linux

ISOBus File server tools

  • isobusfs-cli : ISOBus file client
  • isobusfs-srv : ISOBus file server

Log file converters

  • asc2log : convert ASC logfile to compact CAN frame logfile
  • log2asc : convert compact CAN frame logfile to ASC logfile
  • log2long : convert compact CAN frame representation into user readable

Serial Line Discipline configuration (for slcan driver)

  • slcan_attach : userspace tool for serial line CAN interface configuration
  • slcand : daemon for serial line CAN interface configuration
  • slcanpty : creates a pty for applications using the slcan ASCII protocol

CMake Project Generator

  • Place your build folder anywhere, passing CMake the path. Relative or absolute.
  • Some examples using a build folder under the source tree root:
  • Android : cmake -DCMAKE_TOOLCHAIN_FILE=~/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-21 -DANDROID_ABI=armeabi-v7a .. && make
  • Android Studio : Copy repo under your project's app folder, add add_subdirectory(can-utils) to your CMakeLists.txt file after cmake_minimum_required(). Generating project will build Debug/Release for all supported EABI types. ie. arm64-v8a, armeabi-v7a, x86, x86_64.
  • Raspberry Pi : cmake -DCMAKE_TOOLCHAIN_FILE=~/rpi/tools/build/cmake/rpi.toolchain.cmake .. && make
  • Linux : cmake -GNinja .. && ninja
  • Linux Eclipse Photon (Debug) : CC=clang cmake -G"Eclipse CDT4 - Unix Makefiles" ../can-utils/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_ECLIPSE_VERSION=4.8.0
  • To override the base installation directory use: CMAKE_INSTALL_PREFIX ie. CC=clang cmake -DCMAKE_INSTALL_PREFIX=./out .. && make install

Additional Information: