diff options
| author | Ulf Lilleengen <[email protected]> | 2025-09-17 09:55:46 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-17 09:55:46 +0000 |
| commit | c6371d7a9b828297eae43e61440f4cc0af7a3979 (patch) | |
| tree | 71e84122a1703c99dee227a9f2e76f919fe41163 | |
| parent | 90f6497959adf6f0f0a65f1c53be0bd6b0e3f1a7 (diff) | |
| parent | 12cb85c54c97e8d8081611018c065be2957171c5 (diff) | |
Merge pull request #4624 from paroga/usb_dfu_reset
embassy-usb-dfu: fix: do net reset in GetStatus request
| -rw-r--r-- | embassy-usb-dfu/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | embassy-usb-dfu/src/dfu.rs | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/embassy-usb-dfu/CHANGELOG.md b/embassy-usb-dfu/CHANGELOG.md index ef842945d..0088e66fe 100644 --- a/embassy-usb-dfu/CHANGELOG.md +++ b/embassy-usb-dfu/CHANGELOG.md | |||
| @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 8 | <!-- next-header --> | 8 | <!-- next-header --> |
| 9 | ## Unreleased - ReleaseDate | 9 | ## Unreleased - ReleaseDate |
| 10 | 10 | ||
| 11 | - changed: Do not reset in the GetStatus request | ||
| 11 | - Allow enabling the `application` and `dfu` feature at the same time | 12 | - Allow enabling the `application` and `dfu` feature at the same time |
| 12 | 13 | ||
| 13 | ## 0.2.0 - 2025-08-27 | 14 | ## 0.2.0 - 2025-08-27 |
diff --git a/embassy-usb-dfu/src/dfu.rs b/embassy-usb-dfu/src/dfu.rs index be28890bb..7c28d04cf 100644 --- a/embassy-usb-dfu/src/dfu.rs +++ b/embassy-usb-dfu/src/dfu.rs | |||
| @@ -183,7 +183,7 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha | |||
| 183 | Ok(Request::GetStatus) => { | 183 | Ok(Request::GetStatus) => { |
| 184 | match self.state { | 184 | match self.state { |
| 185 | State::DlSync => self.state = State::Download, | 185 | State::DlSync => self.state = State::Download, |
| 186 | State::ManifestSync => self.reset.sys_reset(), | 186 | State::ManifestSync => self.state = State::ManifestWaitReset, |
| 187 | _ => {} | 187 | _ => {} |
| 188 | } | 188 | } |
| 189 | 189 | ||
| @@ -202,6 +202,12 @@ impl<'d, DFU: NorFlash, STATE: NorFlash, RST: Reset, const BLOCK_SIZE: usize> Ha | |||
| 202 | _ => None, | 202 | _ => None, |
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| 205 | |||
| 206 | fn reset(&mut self) { | ||
| 207 | if matches!(self.state, State::ManifestSync | State::ManifestWaitReset) { | ||
| 208 | self.reset.sys_reset() | ||
| 209 | } | ||
| 210 | } | ||
| 205 | } | 211 | } |
| 206 | 212 | ||
| 207 | /// An implementation of the USB DFU 1.1 protocol | 213 | /// An implementation of the USB DFU 1.1 protocol |
