pub enum BackendDeviceType {
    HostDevice(HostDevice),
    FidoDevice(FidoPassthroughDevice),
}
Expand description

This enum defines different USB backend implementations that we support. Each implementation needs to implement the BackendDevice trait as we dispatch on the enum based on the type. Each concrete implementation can take care of setting up the device-specific configurations.

Variants§

§

HostDevice(HostDevice)

§

FidoDevice(FidoPassthroughDevice)

Implementations§

source§

impl BackendDeviceType

source

fn intercepted_control_transfer( &mut self, xhci_transfer: &XhciTransfer, buffer: &Option<ScatterGatherBuffer>, control_request_setup: &UsbRequestSetup ) -> Result<bool>

source

fn execute_control_transfer( &mut self, xhci_transfer: Arc<XhciTransfer>, buffer: Option<ScatterGatherBuffer>, control_request_setup: &UsbRequestSetup ) -> Result<()>

source

fn handle_control_transfer(&mut self, transfer: XhciTransfer) -> Result<()>

source

fn set_config(&mut self, config: u8) -> Result<TransferStatus>

source

pub fn submit_transfer( &mut self, fail_handle: Arc<dyn FailHandle>, job_queue: &Arc<AsyncJobQueue>, xhci_transfer: Arc<XhciTransfer>, usb_transfer: BackendTransferType ) -> Result<()>

source

pub fn submit_xhci_transfer(&mut self, transfer: XhciTransfer) -> Result<()>

Trait Implementations§

source§

impl AsRawDescriptor for BackendDeviceType

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more
source§

impl BackendDevice for BackendDeviceType

source§

fn submit_backend_transfer( &mut self, transfer: BackendTransferType ) -> Result<BackendTransferHandle>

Submits a transfer to the specific backend implementation.
source§

fn detach_event_handler(&self, event_loop: &Arc<EventLoop>) -> Result<()>

This is called by a generic backend provider when a USB detach message is received from the vm control socket. It detaches the backend device from the backend provider event loop.
source§

fn request_transfer_buffer(&mut self, size: usize) -> TransferBuffer

Gets a buffer used for data transfer between the host and this device. The buffer returned by this function must be consumed by submit_backend_transfer().
source§

fn build_bulk_transfer( &mut self, ep_addr: u8, transfer_buffer: TransferBuffer, stream_id: Option<u16> ) -> Result<BackendTransferType>

Requests the backend to build a backend-specific bulk transfer request
source§

fn build_interrupt_transfer( &mut self, ep_addr: u8, transfer_buffer: TransferBuffer ) -> Result<BackendTransferType>

Requests the backend to build a backend-specific interrupt transfer request
source§

fn get_control_transfer_state(&mut self) -> Arc<RwLock<ControlTransferState>>

Returns the ControlTransferState for the given backend device.
source§

fn get_device_state(&mut self) -> Arc<RwLock<DeviceState>>

Returns the DeviceState for the given backend device. This state contains all the backend-agnostic state for all generic USB backends.
source§

fn get_active_config_descriptor(&mut self) -> Result<ConfigDescriptorTree>

Gets the device active config descriptor tree.
source§

fn get_config_descriptor(&mut self, config: u8) -> Result<ConfigDescriptorTree>

Gets a specific device config descriptor tree.
source§

fn get_config_descriptor_by_index( &mut self, config_index: u8 ) -> Result<ConfigDescriptorTree>

Gets a specific device config descriptor tree by index.
source§

fn get_device_descriptor_tree(&mut self) -> Result<DeviceDescriptorTree>

Gets the device descriptor tree.
source§

fn get_active_configuration(&mut self) -> Result<u8>

Gets the device current active configuration.
source§

fn set_active_configuration(&mut self, config: u8) -> Result<()>

Sets the device active configuration.
source§

fn clear_feature(&mut self, value: u16, index: u16) -> Result<TransferStatus>

Handles a clear feature endpoint request for the given device.
source§

fn create_endpoints( &mut self, config_descriptor: &ConfigDescriptorTree ) -> Result<()>

Creates endpoints for the device with the given config descriptor tree.
source§

impl XhciBackendDevice for BackendDeviceType

source§

fn get_backend_type(&self) -> BackendType

Returns the type of USB device provided by this device.
source§

fn get_vid(&self) -> u16

Get vendor id of this device.
source§

fn get_pid(&self) -> u16

Get product id of this device.
source§

fn set_address(&mut self, address: UsbDeviceAddress)

Set address of this backend.
source§

fn reset(&mut self) -> Result<()>

Reset the backend device.
source§

fn get_speed(&self) -> Option<DeviceSpeed>

Get speed of this device.
source§

fn alloc_streams(&self, ep: u8, num_streams: u16) -> Result<()>

Allocate streams for the endpoint
source§

fn free_streams(&self, ep: u8) -> Result<()>

Free streams for the endpoint
source§

fn stop(&mut self)

Stop the backend device, allowing it to execute cleanup routines.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsRawDescriptors for Twhere T: AsRawDescriptor,

source§

fn as_raw_descriptors(&self) -> Vec<i32, Global>

Returns the underlying raw descriptors. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Sync + Send, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V