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).
This commit is contained in:
Patrick Gansterer 2025-09-01 17:36:05 +02:00
parent de33d113a5
commit 40f5161c32
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- next-header -->
## Unreleased - ReleaseDate
- changed: Do not reset in the GetStatus request
## 0.2.0 - 2025-08-27
- First release with changelog.

View File

@ -182,7 +182,7 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha
Ok(Request::GetStatus) => {
match self.state {
State::DlSync => self.state = State::Download,
State::ManifestSync => self.reset.sys_reset(),
State::ManifestSync => self.state = State::ManifestWaitReset,
_ => {}
}
@ -201,6 +201,12 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha
_ => None,
}
}
fn reset(&mut self) {
if matches!(self.state, State::ManifestSync | State::ManifestWaitReset) {
self.reset.sys_reset()
}
}
}
/// An implementation of the USB DFU 1.1 protocol