diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-05-12 18:14:48 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-05-12 18:14:48 +0200 |
| commit | 5fd55f95293b50ea2899c621186146dcb2be7823 (patch) | |
| tree | a8146a04eda2f256fe0809eec5054be541d1181b /embassy-usb | |
| parent | 30d4d0e9d78681e16a68ff953c61b96c9863bfc6 (diff) | |
usb: parse request in embassy-usb instead of the driver.
Diffstat (limited to 'embassy-usb')
| -rw-r--r-- | embassy-usb/src/driver.rs | 4 | ||||
| -rw-r--r-- | embassy-usb/src/lib.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs index 57f2b0656..8454b041f 100644 --- a/embassy-usb/src/driver.rs +++ b/embassy-usb/src/driver.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | use core::future::Future; | 1 | use core::future::Future; |
| 2 | 2 | ||
| 3 | use crate::control::Request; | ||
| 4 | |||
| 5 | use super::types::*; | 3 | use super::types::*; |
| 6 | 4 | ||
| 7 | /// Driver for a specific USB peripheral. Implement this to add support for a new hardware | 5 | /// Driver for a specific USB peripheral. Implement this to add support for a new hardware |
| @@ -146,7 +144,7 @@ pub trait EndpointOut: Endpoint { | |||
| 146 | } | 144 | } |
| 147 | 145 | ||
| 148 | pub trait ControlPipe { | 146 | pub trait ControlPipe { |
| 149 | type SetupFuture<'a>: Future<Output = Request> + 'a | 147 | type SetupFuture<'a>: Future<Output = [u8; 8]> + 'a |
| 150 | where | 148 | where |
| 151 | Self: 'a; | 149 | Self: 'a; |
| 152 | type DataOutFuture<'a>: Future<Output = Result<usize, EndpointError>> + 'a | 150 | type DataOutFuture<'a>: Future<Output = Result<usize, EndpointError>> + 'a |
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs index b135f5eb3..7b85a2884 100644 --- a/embassy-usb/src/lib.rs +++ b/embassy-usb/src/lib.rs | |||
| @@ -246,7 +246,9 @@ impl<'d, D: Driver<'d>> UsbDevice<'d, D> { | |||
| 246 | } | 246 | } |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | async fn handle_control(&mut self, req: Request) { | 249 | async fn handle_control(&mut self, req: [u8; 8]) { |
| 250 | let req = Request::parse(&req); | ||
| 251 | |||
| 250 | trace!("control request: {:02x}", req); | 252 | trace!("control request: {:02x}", req); |
| 251 | 253 | ||
| 252 | match req.direction { | 254 | match req.direction { |
