embassy-usb

Crates

git

Versions

default

Flavors

Skip to main content

ConfigurationDescriptorChain

Type Alias ConfigurationDescriptorChain 

Source
pub type ConfigurationDescriptorChain<'a> = DescriptorChain<'a, ConfigurationDescriptor>;
Expand description

The chain of descriptors of a ConfigurationDescriptor.

When you request the configuration descriptor of a usb device you get a chain of descriptors (USB 2.0 §9.6.3). The chain includes interface descriptors, endpoint descriptors, and possibly other descriptors.

The total length of the chain is in ConfigurationDescriptor::total_len.

Aliased Type§

pub struct ConfigurationDescriptorChain<'a> {
    pub descriptor: ConfigurationDescriptor,
    pub buffer: &'a [u8],
}

Fields§

§descriptor: ConfigurationDescriptor

The current descriptor.

§buffer: &'a [u8]

The raw bytes following the descriptor.

Implementations§

Source§

impl<'a> ConfigurationDescriptorChain<'a>

Source

pub fn try_from_slice(buf: &'a [u8]) -> Result<Self, HostError>

Parse a full Configuration Descriptor blob, giving access to sub-descriptors via iterators.

Source

pub fn iter_descriptors(&self) -> RawDescriptorIterator<'a> ⓘ

Iterate over all raw descriptors in this Configuration.

Source

pub fn iter_interface(&self) -> InterfaceIterator<'_> ⓘ

Iterate over all interface descriptors of this Configuration.

Source

pub fn find_interface<C: ClassMatch>( &'a self, ) -> Option<InterfaceDescriptorChain<'a>>

Find the first interface matching C.

Source

pub fn find_interfaces<C: ClassMatch>( &'a self, ) -> impl Iterator<Item = InterfaceDescriptorChain<'a>> + 'a

Iterate over every interface matching C.

Source

pub fn find_iad_group( &'a self, interface: u8, ) -> Option<InterfaceAssociationDescriptor>

Find the Interface Association Descriptor whose interface group contains interface.

Returns None when the configuration has no matching IAD, or when the interface is not part of an association.

Source

pub fn visit_descriptors<V: DescriptorVisitor<'a>>( &self, visitor: &mut V, ) -> Result<(), VisitError<V::Error>>

Iterate over all descriptors of this Configuration, passing to Visitor callbacks. Returns Ok(()) on completion (including early stop), or Err(e) on error.