diff options
| author | Patrick Gansterer <[email protected]> | 2025-09-01 17:36:05 +0200 |
|---|---|---|
| committer | Patrick Gansterer <[email protected]> | 2025-09-01 17:40:02 +0200 |
| commit | 40f5161c326166380b1af19170e7db15644b92b1 (patch) | |
| tree | af161883a7e80f33bdc63ddac86753807ce782e0 /embassy-usb-dfu/src | |
| parent | de33d113a5fb70ca5086058cc894a2ce192c27d6 (diff) | |
embassy-usb-dfu: fix: do not reset in GetStatus request
Only reset the device after a USB reset request. This avoids
error messages with update tools, which expect a response to
a GetStatus request (like dfu-util).
Diffstat (limited to 'embassy-usb-dfu/src')
| -rw-r--r-- | embassy-usb-dfu/src/dfu.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/embassy-usb-dfu/src/dfu.rs b/embassy-usb-dfu/src/dfu.rs index 9a2f125fb..3a390a37a 100644 --- a/embassy-usb-dfu/src/dfu.rs +++ b/embassy-usb-dfu/src/dfu.rs | |||
| @@ -182,7 +182,7 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha | |||
| 182 | Ok(Request::GetStatus) => { | 182 | Ok(Request::GetStatus) => { |
| 183 | match self.state { | 183 | match self.state { |
| 184 | State::DlSync => self.state = State::Download, | 184 | State::DlSync => self.state = State::Download, |
| 185 | State::ManifestSync => self.reset.sys_reset(), | 185 | State::ManifestSync => self.state = State::ManifestWaitReset, |
| 186 | _ => {} | 186 | _ => {} |
| 187 | } | 187 | } |
| 188 | 188 | ||
| @@ -201,6 +201,12 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha | |||
| 201 | _ => None, | 201 | _ => None, |
| 202 | } | 202 | } |
| 203 | } | 203 | } |
| 204 | |||
| 205 | fn reset(&mut self) { | ||
| 206 | if matches!(self.state, State::ManifestSync | State::ManifestWaitReset) { | ||
| 207 | self.reset.sys_reset() | ||
| 208 | } | ||
| 209 | } | ||
| 204 | } | 210 | } |
| 205 | 211 | ||
| 206 | /// An implementation of the USB DFU 1.1 protocol | 212 | /// An implementation of the USB DFU 1.1 protocol |
