diff options
| author | Matthew Tran <[email protected]> | 2025-05-08 00:12:00 -0500 |
|---|---|---|
| committer | Matthew Tran <[email protected]> | 2025-05-08 00:12:00 -0500 |
| commit | 5c0a63a0ddbc8c8afc97dc2857c2d78093c48768 (patch) | |
| tree | 31ff4deb0e75f6891faf626f69dccbc511948e74 /embassy-usb-dfu | |
| parent | d35df5cfbadb0142d4c8fd44b5dcbfa81ab7ac15 (diff) | |
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.
Diffstat (limited to 'embassy-usb-dfu')
| -rw-r--r-- | embassy-usb-dfu/src/application.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/embassy-usb-dfu/src/application.rs b/embassy-usb-dfu/src/application.rs index 3c1e8b2cc..6ad07a78c 100644 --- a/embassy-usb-dfu/src/application.rs +++ b/embassy-usb-dfu/src/application.rs | |||
| @@ -81,10 +81,15 @@ impl<MARK: DfuMarker, RST: Reset> Handler for Control<MARK, RST> { | |||
| 81 | 81 | ||
| 82 | match Request::try_from(req.request) { | 82 | match Request::try_from(req.request) { |
| 83 | Ok(Request::Detach) => { | 83 | Ok(Request::Detach) => { |
| 84 | trace!("Received DETACH, awaiting USB reset"); | ||
| 85 | self.detach_start = Some(Instant::now()); | 84 | self.detach_start = Some(Instant::now()); |
| 86 | self.timeout = Some(Duration::from_millis(req.value as u64)); | 85 | self.timeout = Some(Duration::from_millis(req.value as u64)); |
| 87 | self.state = State::AppDetach; | 86 | self.state = State::AppDetach; |
| 87 | if self.attrs.contains(DfuAttributes::WILL_DETACH) { | ||
| 88 | trace!("Received DETACH, performing reset"); | ||
| 89 | self.reset(); | ||
| 90 | } else { | ||
| 91 | trace!("Received DETACH, awaiting USB reset"); | ||
| 92 | } | ||
| 88 | Some(OutResponse::Accepted) | 93 | Some(OutResponse::Accepted) |
| 89 | } | 94 | } |
| 90 | _ => None, | 95 | _ => None, |
