embassy-usb-host

Crates

git

Versions

default

Flavors

ControlChannelExt

Trait ControlChannelExt 

Source
pub trait ControlChannelExt<D: Direction>: UsbChannel<Control, D> {
    // Provided methods
    async fn request_descriptor<T: USBDescriptor, const SIZE: usize>(
        &mut self,
        index: u8,
        class: bool,
    ) -> Result<T, HostError>
       where D: IsIn { ... }
    async fn request_descriptor_bytes(
        &mut self,
        desc_type: u8,
        index: u8,
        buf: &mut [u8],
    ) -> Result<usize, HostError>
       where D: IsIn { ... }
    async fn interface_request_descriptor_bytes<T: USBDescriptor>(
        &mut self,
        interface_num: u8,
        buf: &mut [u8],
    ) -> Result<usize, HostError>
       where D: IsIn { ... }
    async fn active_configuration_value(
        &mut self,
    ) -> Result<Option<NonZeroU8>, HostError>
       where D: IsIn { ... }
    async fn set_configuration(
        &mut self,
        config_no: u8,
    ) -> Result<(), HostError>
       where D: IsOut { ... }
    async fn device_set_address(
        &mut self,
        new_addr: u8,
    ) -> Result<(), HostError>
       where D: IsOut { ... }
    async fn class_request_out(
        &mut self,
        request: u8,
        value: u16,
        index: u16,
        buf: &[u8],
    ) -> Result<(), HostError>
       where D: IsOut { ... }
    async fn enumerate_device(
        &mut self,
        speed: Speed,
        new_device_address: u8,
        ls_over_fs: bool,
    ) -> Result<EnumerationInfo, HostError>
       where D: IsIn + IsOut { ... }
}
Expand description

Extension trait providing higher-level control request methods on a USB control channel.

Provided Methods§

Source

async fn request_descriptor<T: USBDescriptor, const SIZE: usize>( &mut self, index: u8, class: bool, ) -> Result<T, HostError>
where D: IsIn,

Request and parse a fixed-size descriptor.

Source

async fn request_descriptor_bytes( &mut self, desc_type: u8, index: u8, buf: &mut [u8], ) -> Result<usize, HostError>
where D: IsIn,

Request the raw bytes of a descriptor by type and index.

Source

async fn interface_request_descriptor_bytes<T: USBDescriptor>( &mut self, interface_num: u8, buf: &mut [u8], ) -> Result<usize, HostError>
where D: IsIn,

Request the raw bytes of a class-specific interface descriptor.

Source

async fn active_configuration_value( &mut self, ) -> Result<Option<NonZeroU8>, HostError>
where D: IsIn,

GET_CONFIGURATION — returns the active configuration value, or None if unconfigured.

Source

async fn set_configuration(&mut self, config_no: u8) -> Result<(), HostError>
where D: IsOut,

SET_CONFIGURATION.

Source

async fn device_set_address(&mut self, new_addr: u8) -> Result<(), HostError>
where D: IsOut,

SET_ADDRESS — assign the device a new address.

§Warning

Breaks host channel state; use only during enumeration.

Source

async fn class_request_out( &mut self, request: u8, value: u16, index: u16, buf: &[u8], ) -> Result<(), HostError>
where D: IsOut,

Class + Interface OUT request (no data stage).

Source

async fn enumerate_device( &mut self, speed: Speed, new_device_address: u8, ls_over_fs: bool, ) -> Result<EnumerationInfo, HostError>
where D: IsIn + IsOut,

Enumerate the currently pending device and return an EnumerationInfo.

The device must have been reset immediately before this call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<D: Direction, C> ControlChannelExt<D> for C
where C: UsbChannel<Control, D>,