Crate socketcan_isotp[][src]

Expand description

Socketcan ISO-TP support.

The Linux kernel supports using CAN-devices through a network-like API. This crate allows easy access to this functionality without having to wrestle libc calls.

ISO-TP allows sending data packets that exceed the eight byte of a default CAN frame. can-isotp is an ISO-TP kernel module that takes care of handling the ISO-TP protocol.

Instructions on how the can-isotp kernel module can be build and loaded can be found at .

use socketcan_isotp::IsoTpSocket;

fn main() -> Result<(), socketcan_isotp::Error> {
    let mut tp_socket = IsoTpSocket::open(

    loop {
        let buffer =;
        println!("read {} bytes", buffer.len());

        // print TP frame data
        for x in buffer {
            print!("{:X?} ", x);




Extended 29-bit CAN Identifier (0..=1FFF_FFFF).

Flow control options aka can_isotp_fc_options

ISO-TP otions aka can_isotp_options

An ISO-TP socketcan socket.

Link layer options aka can_isotp_ll_options

Standard 11-bit CAN Identifier (0..=0x7FF).


Possible errors

A CAN Identifier (standard or extended).


CAN address family

ISO 15765-2 Transport Protocol

pass struct LinkLayerOptions

pass struct IsoTpOptions

pass struct FlowControlOptions

pass __u32 value in nano secs ignore received CF frames which timestamps differ less than val

pass __u32 value in nano secs use this time instead of value provided in FC from the receiver

CAN_MAX_DLEN According to ISO 11898-1

if set, indicate 29 bit extended format

valid bits in extended frame id

error flag

valid bits in error frame

an error mask that will cause Socketcan to report all errors

an error mask that will cause Socketcan to silently drop all errors

CAN protocol family

remote transmission request flag

valid bits in standard frame id

undocumented can.h constant

undocumented isotp.h constant