diff --git a/src/bus.rs b/src/bus.rs index baadc01..0c529e0 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -134,6 +134,12 @@ pub trait UsbBus: Sync + Sized { /// /// The default value for this constant is `false`, which corresponds to the USB 2.0 spec, 9.4.6 const QUIRK_SET_ADDRESS_BEFORE_STATUS: bool = false; + + /// Indicates that the `UsbDevice` should not send a response to `SetAddress` control transfers. + /// + /// This defaults to `false`, meaning that `UsbDevice` will handle `SetAddress` transfers. It + /// needs to be set to `true` when the device hardware handles `SetAddress`. + const INHIBIT_SET_ADDRESS_RESPONSE: bool = false; } struct AllocatorState { @@ -329,4 +335,4 @@ pub enum PollResult { /// A USB resume request has been detected after being suspended or, in the case of self-powered /// devices, the device has been connected to the USB bus. Resume, -} \ No newline at end of file +} diff --git a/src/device.rs b/src/device.rs index e597807..033ee70 100644 --- a/src/device.rs +++ b/src/device.rs @@ -367,6 +367,11 @@ impl UsbDevice<'_, B> { } else { self.pending_address = req.value as u8; } + + if B::INHIBIT_SET_ADDRESS_RESPONSE { + return; + } + xfer.accept().ok(); },