/// Writes a interface descriptor with a specific alternate setting and
/// interface string identifier.
///
/// # Arguments
///
/// * `number` - Interface number previously allocated with
///   [`UsbBusAllocator::interface`](crate::bus::UsbBusAllocator::interface).
/// * `alternate_setting` - Number of the alternate setting
/// * `interface_class` - Class code assigned by USB.org. Use `0xff` for vendor-specific devices
///   that do not conform to any class.
/// * `interface_sub_class` - Sub-class code. Depends on class.
/// * `interface_protocol` - Protocol code. Depends on class and sub-class.
/// * `interface_string` - Index of string descriptor describing this interface
Writes a interface descriptor with a specific alternate setting and
interface string identifier.
Writes a interface descriptor with a specific alternate setting and interface string identifier .
pub fn interface_alt(
        &mut self,
        number: InterfaceNumber,
        alternate_setting: u8,
        interface_class: u8,
        interface_sub_class: u8,
        interface_protocol: u8,
        interface_string: Option<StringIndex>,
    ) -> Result<()> {
        if alternate_setting == device::DEFAULT_ALTERNATE_SETTING {
            match self.num_interfaces_mark {
                Some(mark) => self.buf[mark] += 1,
                None => return Err(UsbError::InvalidState),
            };
        }
        let str_index = interface_string.map_or(0, Into::into);
        self.num_endpoints_mark = Some(self.position + 4);
        self.write(
            descriptor_type::INTERFACE,
            &[
                number.into(),       // bInterfaceNumber
                alternate_setting,   // bAlternateSetting
                0,                   // bNumEndpoints
                interface_class,     // bInterfaceClass
                interface_sub_class, // bInterfaceSubClass
                interface_protocol,  // bInterfaceProtocol
                str_index,           // iInterface
            ],
        )?;
        Ok(())
    }
pub fn interface_alt ( & mut self , number : InterfaceNumber , alternate_setting : u8 , interface_class : u8 , interface_sub_class : u8 , interface_protocol : u8 , interface_string : Option < StringIndex > , ) -> Result < ( ) > { if alternate_setting == device :: DEFAULT_ALTERNATE_SETTING { match self . num_interfaces_mark { Some ( mark ) => self . buf [ mark ] += 1 , None => return Err ( UsbError :: InvalidState ) , } ; } let str_index = interface_string . map_or ( 0 , Into :: into ) ; self . num_endpoints_mark = Some ( self . position + 4 ) ; self . write ( descriptor_type :: INTERFACE , & [ number . into ( ) , // bInterfaceNumber alternate_setting , // bAlternateSetting 0 , // bNumEndpoints interface_class , // bInterfaceClass interface_sub_class , // bInterfaceSubClass interface_protocol , // bInterfaceProtocol str_index , // iInterface ] , ) ? ; Ok ( ( ) ) }
Writes a interface descriptor with a specific alternate setting and
interface string identifier.
Writes a interface descriptor with a specific alternate setting and interface string identifier .
&mut self
number
InterfaceNumber
alternate_setting
u8
interface_class
u8
interface_sub_class
u8
interface_protocol
u8
interface_string
Option<StringIndex>