pub trait UsbClass<B: UsbBus> {
Show 13 methods
// Provided methods
fn configuration_descriptors(
&self,
writer: &mut DescriptorWriter<'_>,
) -> UsbResult<()> { ... }
fn string(&self, index: StringIndex, lang_id: u16) -> Option<&str> { ... }
fn control_in(&mut self, xfer: ControlIn<'_, B>) { ... }
fn control_out(&mut self, xfer: ControlOut<'_, B>) { ... }
fn endpoint_out(&mut self, addr: EndpointAddress) { ... }
fn endpoint_in_complete(&mut self, addr: EndpointAddress) { ... }
fn endpoint_setup(&mut self, addr: EndpointAddress) { ... }
fn reset(&mut self) { ... }
fn configure(&mut self) { ... }
fn deconfigure(&mut self) { ... }
fn poll(&mut self) { ... }
fn alt_setting(&mut self, interface: InterfaceNumber) -> Option<u8> { ... }
fn set_alt_setting(&mut self, interface: InterfaceNumber, alt: u8) -> bool { ... }
}Expand description
USB device class trait.
All methods have default no-op implementations. Override only the ones your class needs.
Provided Methods§
Sourcefn configuration_descriptors(
&self,
writer: &mut DescriptorWriter<'_>,
) -> UsbResult<()>
fn configuration_descriptors( &self, writer: &mut DescriptorWriter<'_>, ) -> UsbResult<()>
Append this class’s interface and endpoint descriptors.
Sourcefn string(&self, index: StringIndex, lang_id: u16) -> Option<&str>
fn string(&self, index: StringIndex, lang_id: u16) -> Option<&str>
Return the string for a previously allocated StringIndex, or None.
Sourcefn control_in(&mut self, xfer: ControlIn<'_, B>)
fn control_in(&mut self, xfer: ControlIn<'_, B>)
Handle a control IN transfer. Accept, reject, or pass (drop without acting).
Sourcefn control_out(&mut self, xfer: ControlOut<'_, B>)
fn control_out(&mut self, xfer: ControlOut<'_, B>)
Handle a control OUT transfer. Accept, reject, or pass (drop without acting).
Sourcefn endpoint_out(&mut self, addr: EndpointAddress)
fn endpoint_out(&mut self, addr: EndpointAddress)
Called when endpoint addr received an OUT packet.
Sourcefn endpoint_in_complete(&mut self, addr: EndpointAddress)
fn endpoint_in_complete(&mut self, addr: EndpointAddress)
Called when endpoint addr completed an IN transfer.
Sourcefn endpoint_setup(&mut self, addr: EndpointAddress)
fn endpoint_setup(&mut self, addr: EndpointAddress)
Called when endpoint addr received a SETUP packet (non-EP0 control).
Sourcefn deconfigure(&mut self)
fn deconfigure(&mut self)
Called when the host sends SET_CONFIGURATION(0) or on reset.
Sourcefn poll(&mut self)
fn poll(&mut self)
Called unconditionally on every UsbDevice::poll.
Sourcefn alt_setting(&mut self, interface: InterfaceNumber) -> Option<u8>
fn alt_setting(&mut self, interface: InterfaceNumber) -> Option<u8>
Return the current alternate setting for interface, or None.
Sourcefn set_alt_setting(&mut self, interface: InterfaceNumber, alt: u8) -> bool
fn set_alt_setting(&mut self, interface: InterfaceNumber, alt: u8) -> bool
Set the alternate setting for interface. Return true if handled.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".