usbapi

Crates.iousbapi
lib.rsusbapi
version0.4.2
sourcesrc
created_at2020-09-06 19:19:18.375121
updated_at2021-05-10 17:03:39.081574
descriptionAccess USB from Rust
homepagehttps://gitlab.com/mike7b4/usbapi-rs
repositoryhttps://gitlab.com/mike7b4/usbapi-rs.git
max_upload_size
id285498
size75,548
(mike7b4)

documentation

README

Native USB API for Rust

Inspired by the C http://libusb.info driver.

Rust usbapi crate currently only support Linux.

UsbAPI crate does not have any dependencies on libusb C API's and is a clean implementation in Rust using ioctl/mmap calls on Linux using nix low level crate.

You are free to fork or send pull request and make it work on other platforms.

Dependencies

See Cargo.toml I try to use as less as possible.

Supported functions in Linux

  • Enumerate USB peripherals
  • Zero copy using mmap buffers.
  • Sync bulk API's
  • Async bulk and control transmissions
  • Transfers are safe and can't be accessed after passed to kernel
  • Optional all descriptors can be serialized if feature serde is enabled.
  • Optional mio support

TODO

When I started this project I was new in Rust. Some stuff will change.

  • Cleanup traits implementations for easier port to other platforms
  • Use valgrind to cleanup possible leaks in unsafe code (eg mmap etc...
  • Add isochronous support
  • Add interrupt endpoints
  • Use log crate instead of eprintln and println for debug.
  • claim_interface will panic if kernel driver is loaded since unload driver is not implemented cant test so not implemented feel free to send patch if needed.

For those who use any of below platforms, feel free to send a pull request:

  • Support FreeBSD/OpenBSD
  • Support NetBSD
  • Support Haiku
  • Support OSX
  • Support Windows
Commit count: 121

cargo fmt