embassy-usb-dfu: Reset immediately if WILL_DETACH is set
This is necessary to support the windows WinUSB driver which is not capable of generating the USB reset.
This commit is contained in:
parent
d35df5cfba
commit
5c0a63a0dd
@ -81,10 +81,15 @@ impl<MARK: DfuMarker, RST: Reset> Handler for Control<MARK, RST> {
|
|||||||
|
|
||||||
match Request::try_from(req.request) {
|
match Request::try_from(req.request) {
|
||||||
Ok(Request::Detach) => {
|
Ok(Request::Detach) => {
|
||||||
trace!("Received DETACH, awaiting USB reset");
|
|
||||||
self.detach_start = Some(Instant::now());
|
self.detach_start = Some(Instant::now());
|
||||||
self.timeout = Some(Duration::from_millis(req.value as u64));
|
self.timeout = Some(Duration::from_millis(req.value as u64));
|
||||||
self.state = State::AppDetach;
|
self.state = State::AppDetach;
|
||||||
|
if self.attrs.contains(DfuAttributes::WILL_DETACH) {
|
||||||
|
trace!("Received DETACH, performing reset");
|
||||||
|
self.reset();
|
||||||
|
} else {
|
||||||
|
trace!("Received DETACH, awaiting USB reset");
|
||||||
|
}
|
||||||
Some(OutResponse::Accepted)
|
Some(OutResponse::Accepted)
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user