diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-03-28 03:37:29 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-04-06 05:38:11 +0200 |
| commit | d7b1f8ca57eda98f1fc8d26c23a977a173f2b3f7 (patch) | |
| tree | f00c70960f6f4d87f8d8adbf995d918668a48406 /embassy-usb/src/control.rs | |
| parent | e99a3a1da42649bb9ad9a64508d14d6461be331d (diff) | |
usb: update docs on ControlHandler.
Diffstat (limited to 'embassy-usb/src/control.rs')
| -rw-r--r-- | embassy-usb/src/control.rs | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/embassy-usb/src/control.rs b/embassy-usb/src/control.rs index 567a595a1..cdae2d977 100644 --- a/embassy-usb/src/control.rs +++ b/embassy-usb/src/control.rs | |||
| @@ -138,7 +138,7 @@ pub enum InResponse { | |||
| 138 | Rejected, | 138 | Rejected, |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | /// A trait for implementing USB classes. | 141 | /// Handler for control requests. |
| 142 | /// | 142 | /// |
| 143 | /// All methods are optional callbacks that will be called by | 143 | /// All methods are optional callbacks that will be called by |
| 144 | /// [`UsbDevice::run()`](crate::UsbDevice::run) | 144 | /// [`UsbDevice::run()`](crate::UsbDevice::run) |
| @@ -148,13 +148,6 @@ pub trait ControlHandler { | |||
| 148 | 148 | ||
| 149 | /// Called when a control request is received with direction HostToDevice. | 149 | /// Called when a control request is received with direction HostToDevice. |
| 150 | /// | 150 | /// |
| 151 | /// All requests are passed to classes in turn, which can choose to accept, ignore or report an | ||
| 152 | /// error. Classes can even choose to override standard requests, but doing that is rarely | ||
| 153 | /// necessary. | ||
| 154 | /// | ||
| 155 | /// When implementing your own class, you should ignore any requests that are not meant for your | ||
| 156 | /// class so that any other classes in the composite device can process them. | ||
| 157 | /// | ||
| 158 | /// # Arguments | 151 | /// # Arguments |
| 159 | /// | 152 | /// |
| 160 | /// * `req` - The request from the SETUP packet. | 153 | /// * `req` - The request from the SETUP packet. |
| @@ -165,19 +158,13 @@ pub trait ControlHandler { | |||
| 165 | 158 | ||
| 166 | /// Called when a control request is received with direction DeviceToHost. | 159 | /// Called when a control request is received with direction DeviceToHost. |
| 167 | /// | 160 | /// |
| 168 | /// All requests are passed to classes in turn, which can choose to accept, ignore or report an | 161 | /// You should write the response to `resp`, then return `InResponse::Accepted(len)` |
| 169 | /// error. Classes can even choose to override standard requests, but doing that is rarely | 162 | /// with the length of the response. |
| 170 | /// necessary. | ||
| 171 | /// | ||
| 172 | /// See [`ControlIn`] for how to respond to the transfer. | ||
| 173 | /// | ||
| 174 | /// When implementing your own class, you should ignore any requests that are not meant for your | ||
| 175 | /// class so that any other classes in the composite device can process them. | ||
| 176 | /// | 163 | /// |
| 177 | /// # Arguments | 164 | /// # Arguments |
| 178 | /// | 165 | /// |
| 179 | /// * `req` - The request from the SETUP packet. | 166 | /// * `req` - The request from the SETUP packet. |
| 180 | /// * `control` - The control pipe. | 167 | /// * `resp` - The buffer for you to write the response. |
| 181 | fn control_in(&mut self, req: Request, resp: &mut [u8]) -> InResponse { | 168 | fn control_in(&mut self, req: Request, resp: &mut [u8]) -> InResponse { |
| 182 | InResponse::Rejected | 169 | InResponse::Rejected |
| 183 | } | 170 | } |
