5 releases

Uses new Rust 2024

0.1.4 Jan 20, 2026
0.1.3 Dec 10, 2025
0.1.2 Nov 26, 2025
0.1.1 Nov 16, 2025
0.1.0 Oct 29, 2025

#510 in Hardware support

Download history 64/week @ 2025-10-29 4/week @ 2025-12-10 60/week @ 2026-01-14 233/week @ 2026-01-21 296/week @ 2026-01-28 225/week @ 2026-02-04

814 downloads per month

MIT/Apache

50KB
1K SLoC

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

Dependencies

~2–13MB
~103K SLoC