Skip to content

Commit 627f7f9

Browse files
committed
embassy-usb-dfu: fix: do net 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 627f7f9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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)