Skip to content

dfu-rs/dfu-libusb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Latest Version License Docs.rs Changelog Dependency Status

dfu-libusb

Flash firmware to USB devices using the DFU (Device Firmware Upgrade) protocol.

Built on dfu-core for the protocol implementation and rusb for USB access via libusb.

Features

Usage

[dependencies]
dfu-libusb = "0.6"
use rusb::Context;
use dfu_libusb::DfuLibusb;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let context = Context::new()?;
    let firmware = std::fs::read("firmware.bin")?;
    let size = firmware.len() as u32;

    let mut dfu = DfuLibusb::open(&context, 0x1234, 0x5678, 0, 0)?;
    dfu.download(std::io::Cursor::new(firmware), size)?;
    Ok(())
}

See the download example for a more complete program with a progress bar, wait-for-device, and post-flash reset; and describe to inspect a device's functional descriptor.

License

MIT OR Apache-2.0

About

DFU library implementation using libusb

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages