pub struct DfuDesc {
pub can_download: bool,
pub can_upload: bool,
pub manifest_tolerant: bool,
pub will_detach: bool,
pub detach_timeout_ms: u16,
pub transfer_size: u16,
pub dfu_version: (u8, u8),
}Expand description
USB DFU (Device Firmware Upgrade) functional descriptor.
This descriptor is placed after a DFU interface descriptor and advertises the device’s DFU capabilities to the host. It is defined by the USB DFU 1.1 specification.
Use Interface::with_custom_desc to attach it to an interface:
use usb_gadget::{
function::custom::{DfuDesc, Interface},
Class,
};
let dfu = DfuDesc {
can_download: true,
can_upload: true,
manifest_tolerant: false,
will_detach: true,
detach_timeout_ms: 1000,
transfer_size: 4096,
dfu_version: (1, 1),
};
let dfu_class = Class::DFU_RUNTIME;
let interface = Interface::new(dfu_class, "DFU").with_custom_desc(dfu.into());Requires kernel 6.12 or later.
Fields§
§can_download: boolDevice is capable of receiving firmware via DFU.
can_upload: boolDevice is capable of uploading firmware via DFU.
manifest_tolerant: boolDevice is able to communicate after the manifestation phase (firmware programming) without a bus reset.
will_detach: boolDevice will perform a bus detach-attach sequence when it receives
a DFU_DETACH request. The host must not issue a USB Reset.
detach_timeout_ms: u16Time, in milliseconds, that the device will wait after receipt of the
DFU_DETACH request. If this time elapses without a USB reset, then
the device will terminate the reconfiguration phase and revert to normal
operation.
transfer_size: u16Maximum number of bytes that the device can accept per control-write transaction.
dfu_version: (u8, u8)DFU specification version as (major, minor) in BCD.
For example, DFU 1.1 is (1, 1).