Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcelbuesing/socketcan-isotp
ISO-TP socketcan library for Rust
https://github.com/marcelbuesing/socketcan-isotp
Last synced: 6 days ago
JSON representation
ISO-TP socketcan library for Rust
- Host: GitHub
- URL: https://github.com/marcelbuesing/socketcan-isotp
- Owner: marcelbuesing
- Created: 2019-12-03T21:35:54.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T12:04:46.000Z (5 months ago)
- Last Synced: 2024-10-14T13:27:38.355Z (about 1 month ago)
- Language: Rust
- Homepage:
- Size: 60.5 KB
- Stars: 23
- Watchers: 3
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
SocketCAN ISO-TP crate. Based on socketcan-rs and isotp.h.
The Linux kernel supports using CAN-devices through a
[network-like API](https://www.kernel.org/doc/Documentation/networking/can.txt).
This crate allows easy access to this functionality without having to wrestle
libc calls.[ISO-TP](https://en.wikipedia.org/wiki/ISO_15765-2) or [ISO 15762-2](https://en.wikipedia.org/wiki/ISO_15765-2) allows
sending data packets that exceed the eight byte of a default CAN frame. A common application of ISO-TP is for example
[Unified Diagnostic Services (UDS)](https://en.wikipedia.org/wiki/Unified_Diagnostic_Services) used in automotive ECUs for diagnostics.[can-isotp](https://github.com/hartkopp/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 [https://github.com/hartkopp/can-isotp](https://github.com/hartkopp/can-isotp).```rust,no_run
use socketcan_isotp::{self, IsoTpSocket, StandardId};fn main() -> Result<(), socketcan_isotp::Error> {
let mut tp_socket = IsoTpSocket::open(
"vcan0",
StandardId::new(0x123).expect("Invalid src id"),
StandardId::new(0x321).expect("Invalid dst id"),
)?;let buffer = tp_socket.read()?;
println!("read {} bytes", buffer.len());for x in buffer {
print!("{:X?} ", x);
}println!("");
Ok(())
}```
# Dev Setup
Setup Isotp Kernel Module:
https://github.com/hartkopp/can-isotpSetup virtual can interface.
```
sudo modprobe vcan && \
sudo ip link add dev vcan0 type vcan && \
sudo ip link set up vcan0
```