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
814 downloads per month
50KB
1K
SLoC
host-can

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
- Install PCUSB library from https://www.mac-can.com
- PCAN-USB is the only adapter supported currently
- 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