[][src]Trait usbip::UsbInterfaceHandler

pub trait UsbInterfaceHandler {
    fn get_class_specific_descriptor(&self) -> Vec<u8>;
fn handle_urb(
        &mut self,
        interface: &UsbInterface,
        ep: UsbEndpoint,
        setup: SetupPacket,
        req: &[u8]
    ) -> Result<Vec<u8>>;
fn as_any(&mut self) -> &mut dyn Any; }

A handler of a custom usb interface

Required methods

fn get_class_specific_descriptor(&self) -> Vec<u8>

Return the class specific desciptor which is inserted between interface descriptor and endpoint descriptor

fn handle_urb(
    &mut self,
    interface: &UsbInterface,
    ep: UsbEndpoint,
    setup: SetupPacket,
    req: &[u8]
) -> Result<Vec<u8>>

Handle a URB(USB Request Block) targeting at this interface

Can be one of: control transfer to ep0 or other types of transfer to its endpoint

fn as_any(&mut self) -> &mut dyn Any

Helper to downcast to actual struct

Please implement it as:

This example is not tested
fn as_any(&mut self) -> &mut dyn Any {
    self
}
Loading content...

Implementors

impl UsbInterfaceHandler for UsbCdcAcmHandler[src]

impl UsbInterfaceHandler for UsbHidKeyboardHandler[src]

impl UsbInterfaceHandler for UsbHostHandler[src]

Loading content...