host-can

Crates.iohost-can
lib.rshost-can
version0.1.4
created_at2025-10-29 15:16:50.892572+00
updated_at2026-01-20 01:32:33.422359+00
descriptionHost library for CAN adapters
homepage
repositoryhttps://gitlab.com/mfairman/host-can
max_upload_size
id1906787
size92,927
Michael Fairman (tegimeki)

documentation

README

host-can License: MIT OR Apache-2.0 host-can on crates.io host-can on docs.rs Source Code Repository Rust Version: 1.85.0

A library for talking to CAN adapters on different platforms (MacOS via PCANBasic and Linux via socketcan currently).

NOTE: this is an early development version and APIs are not yet stabilized.

Platforms and Adapters

  • MacOS
  • Linux
    • Uses SocketCAN interface, all adapters with kernel drivers supported
  • Windows (PRELIMINARY)
    • Install PCAN-Basic library from https://www.peak-system.com
    • Note that using Adapter::recv() with a timeout will consume excess CPU cycles

Usage

Add host-can to your project, specifying the pcan (MacOS) or socketcan (Linux) feature:

cargo add host-can --features=<pcan | socketcan>

See the tests/ directory for example code.

TODO

  • Async APIs

  • CanFD support

  • Timestamp support

  • Adapter-specific APIs for device control/queries

  • Handle adapter disconnect/reconnect

  • Optimize windows adapter read timeout logic

  • More tests / docs / examples

Commit count: 10

cargo fmt