dfu-rs 0.1.1

Device Firmware Update crate for hosts, using rusb and exposing a simple API.
Documentation
  • Coverage
  • 41.18%
    28 out of 68 items documented2 out of 16 items with examples
  • Size
  • Source code size: 49.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 772.69 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • piersfinlayson/dfu-rs
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • piersfinlayson

dfu-rs

Implements DFU operations for USB devices.

Based on rusb for USB communication, this crate provides a simple interface for discovering DFU-capable devices and performing DFU operations.

It is designed for use in host applications that need to update firmware on embedded devices via USB DFU.

It is intended to work on Windows, Linux, and macOS.

Features

  • Upload (read) data from DFU devices
  • Download (write) data to DFU devices
  • Erase flash memory (page-wise and mass erase)
  • Device discovery with filtering by DFU type (e.g. internal flash)
  • Error handling with detailed DFU and USB errors
  • Uses blocking calls via rusb - wrap in tokio::task::spawn_blocking for async runtimes
  • Customizable USB timeout

Usage

use dfu_rs::{Device, DfuType};

if let Some(device) = Device::search(None).unwrap().first() {
   let mut buffer = vec![0u32; 4096]; // 16KB
  device.upload(0x08000000, &mut buffer).unwrap();
  println!("Uploaded data: {:X?}", &buffer[..16]); // Print first 16 words
}

See the docs for more examples.