Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. mbr/socketcan

mbr/socketcan

MITRustv3.6.2

A Rust library for Linux SocketCAN communication, providing network socket access to CAN bus with async support.

Visit WebsiteGitHubGitHub
205 stars95 forks0 contributors

What is mbr/socketcan?

socketcan-rs is a Rust library that provides access to Linux's SocketCAN subsystem, enabling CAN bus communication through network sockets. It solves the problem of interacting with CAN devices from Rust applications on Linux, offering both synchronous and asynchronous APIs. The library supports standard CAN and CAN FD frames, interface configuration via Netlink, and integration with popular async runtimes.

Target Audience

Rust developers working on Linux systems who need to communicate with CAN buses in embedded systems, automotive applications, or industrial automation. It's also suitable for those building tools for CAN network analysis or simulation.

Value Proposition

Developers choose socketcan-rs because it provides a native, idiomatic Rust API for SocketCAN with optional async support for multiple runtimes, eliminating the need for C bindings or separate crates. Its comprehensive feature set, including CAN FD and Netlink control, makes it a one-stop solution for CAN communication in Rust.

Overview

Linux SocketCAN access in Rust

Use Cases

Best For

  • Building automotive diagnostic tools or telemetry systems in Rust
  • Developing embedded Linux applications that interface with CAN buses
  • Creating CAN network bridges or gateways with async I/O
  • Parsing and analyzing candump log files in Rust applications
  • Simulating CAN traffic for testing embedded systems
  • Implementing CAN communication in robotics or industrial control systems

Not Ideal For

  • Cross-platform applications targeting Windows or macOS
  • Projects needing easy, out-of-the-box testing without root access or virtual CAN device setup
  • Systems requiring hardware timestamps or precise timing, as this feature is still in development (issue #22)

Pros & Cons

Pros

Comprehensive Async Support

Optional integration with multiple runtimes (Tokio, async-std, smol) via feature flags, enabling non-blocking CAN operations for high-performance applications, as shown in the example bridge code.

CAN FD and Frame Handling

Supports CAN FD with proper frame padding and DLC management, plus dedicated types like CanDataFrame and CanRemoteFrame for robust frame handling.

Netlink Configuration

Allows full control over CAN interfaces via Netlink, enabling bitrate setting, mode control, and parameter querying directly from Rust, as enhanced in versions 3.1 and 3.2.

Embedded HAL Compatibility

Implements embedded_hal traits for CanFdSocket, making it compatible with embedded Rust projects and easing integration into hardware-focused applications.

Cons

Linux-Only Limitation

Tied exclusively to Linux's SocketCAN subsystem, making it unsuitable for projects on other operating systems and limiting portability.

Complex Testing Setup

Requires root access and manual setup of virtual CAN devices (e.g., vcan0) for testing, which complicates CI/CD pipelines and development workflows.

Missing Timestamp Support

Hardware timestamps are not yet implemented, as noted in issue #22, which can be a drawback for time-sensitive applications like real-time diagnostics.

Frequently Asked Questions

Quick Stats

Stars205
Forks95
Contributors0
Open Issues6
Last commit1 month ago
CreatedSince 2016

Tags

#industrial-automation#can-bus#embedded#async#tokio#automotive#linux#rust#socketcan#networking

Built With

S
Smol
t
thiserror
a
async-std
R
Rust
T
Tokio

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 18 hours ago

Related Projects

can-dbccan-dbc

Rust dbc parser

Stars107
Forks42
Last commit9 days ago
tokio-socketcantokio-socketcan

Asynchronous Linux SocketCAN sockets with tokio

Stars37
Forks16
Last commit3 years ago
Sensirion/lin-busSensirion/lin-bus

Rust LIN bus driver traits and protocol implementation

Stars18
Forks9
Last commit1 year ago
tokio-socketcan-bcmtokio-socketcan-bcm

Asynchronous Linux SocketCAN - Broadcast Manager support (BCM) with tokio

Stars8
Forks5
Last commit5 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub