usb: update docs on ControlHandler.
This commit is contained in:
parent
e99a3a1da4
commit
d7b1f8ca57
@ -138,7 +138,7 @@ pub enum InResponse {
|
|||||||
Rejected,
|
Rejected,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait for implementing USB classes.
|
/// Handler for control requests.
|
||||||
///
|
///
|
||||||
/// All methods are optional callbacks that will be called by
|
/// All methods are optional callbacks that will be called by
|
||||||
/// [`UsbDevice::run()`](crate::UsbDevice::run)
|
/// [`UsbDevice::run()`](crate::UsbDevice::run)
|
||||||
@ -148,13 +148,6 @@ pub trait ControlHandler {
|
|||||||
|
|
||||||
/// Called when a control request is received with direction HostToDevice.
|
/// Called when a control request is received with direction HostToDevice.
|
||||||
///
|
///
|
||||||
/// All requests are passed to classes in turn, which can choose to accept, ignore or report an
|
|
||||||
/// error. Classes can even choose to override standard requests, but doing that is rarely
|
|
||||||
/// necessary.
|
|
||||||
///
|
|
||||||
/// When implementing your own class, you should ignore any requests that are not meant for your
|
|
||||||
/// class so that any other classes in the composite device can process them.
|
|
||||||
///
|
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `req` - The request from the SETUP packet.
|
/// * `req` - The request from the SETUP packet.
|
||||||
@ -165,19 +158,13 @@ pub trait ControlHandler {
|
|||||||
|
|
||||||
/// Called when a control request is received with direction DeviceToHost.
|
/// Called when a control request is received with direction DeviceToHost.
|
||||||
///
|
///
|
||||||
/// All requests are passed to classes in turn, which can choose to accept, ignore or report an
|
/// You should write the response to `resp`, then return `InResponse::Accepted(len)`
|
||||||
/// error. Classes can even choose to override standard requests, but doing that is rarely
|
/// with the length of the response.
|
||||||
/// necessary.
|
|
||||||
///
|
|
||||||
/// See [`ControlIn`] for how to respond to the transfer.
|
|
||||||
///
|
|
||||||
/// When implementing your own class, you should ignore any requests that are not meant for your
|
|
||||||
/// class so that any other classes in the composite device can process them.
|
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
///
|
///
|
||||||
/// * `req` - The request from the SETUP packet.
|
/// * `req` - The request from the SETUP packet.
|
||||||
/// * `control` - The control pipe.
|
/// * `resp` - The buffer for you to write the response.
|
||||||
fn control_in(&mut self, req: Request, resp: &mut [u8]) -> InResponse {
|
fn control_in(&mut self, req: Request, resp: &mut [u8]) -> InResponse {
|
||||||
InResponse::Rejected
|
InResponse::Rejected
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user