Skip to content

Commit 40f5161

Browse files
committed
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).
1 parent de33d11 commit 40f5161

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

embassy-usb-dfu/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
<!-- next-header -->
99
## Unreleased - ReleaseDate
1010

11+
- changed: Do not reset in the GetStatus request
12+
1113
## 0.2.0 - 2025-08-27
1214

1315
- First release with changelog.

embassy-usb-dfu/src/dfu.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha
182182
Ok(Request::GetStatus) => {
183183
match self.state {
184184
State::DlSync => self.state = State::Download,
185-
State::ManifestSync => self.reset.sys_reset(),
185+
State::ManifestSync => self.state = State::ManifestWaitReset,
186186
_ => {}
187187
}
188188

@@ -201,6 +201,12 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha
201201
_ => None,
202202
}
203203
}
204+
205+
fn reset(&mut self) {
206+
if matches!(self.state, State::ManifestSync | State::ManifestWaitReset) {
207+
self.reset.sys_reset()
208+
}
209+
}
204210
}
205211

206212
/// An implementation of the USB DFU 1.1 protocol

0 commit comments

Comments
 (0)