Struct usb_device::descriptor::DescriptorWriter [−][src]
A writer for USB descriptors.
Implementations
impl DescriptorWriter<'_>
[src]
pub fn position(&self) -> usize
[src]
Gets the current position in the buffer, i.e. the number of bytes written so far.
pub fn write(&mut self, descriptor_type: u8, descriptor: &[u8]) -> Result<()>
[src]
Writes an arbitrary (usually class-specific) descriptor.
pub fn iad(
&mut self,
first_interface: InterfaceNumber,
interface_count: u8,
function_class: u8,
function_sub_class: u8,
function_protocol: u8
) -> Result<()>
[src]
&mut self,
first_interface: InterfaceNumber,
interface_count: u8,
function_class: u8,
function_sub_class: u8,
function_protocol: u8
) -> Result<()>
Writes a interface association descriptor. Call from UsbClass::get_configuration_descriptors
before writing the USB class or function’s interface descriptors if your class has more than
one interface and wants to play nicely with composite devices on Windows. If the USB device
hosting the class was not configured as composite with IADs enabled, calling this function
does nothing, so it is safe to call from libraries.
Arguments
first_interface
- Number of the function’s first interface, previously allocated withUsbBusAllocator::interface
.interface_count
- Number of interfaces in the function.function_class
- Class code assigned by USB.org. Use0xff
for vendor-specific devices that do not conform to any class.function_sub_class
- Sub-class code. Depends on class.function_protocol
- Protocol code. Depends on class and sub-class.
pub fn interface(
&mut self,
number: InterfaceNumber,
interface_class: u8,
interface_sub_class: u8,
interface_protocol: u8
) -> Result<()>
[src]
&mut self,
number: InterfaceNumber,
interface_class: u8,
interface_sub_class: u8,
interface_protocol: u8
) -> Result<()>
Writes a interface descriptor.
Arguments
number
- Interface number previously allocated withUsbBusAllocator::interface
.interface_class
- Class code assigned by USB.org. Use0xff
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.
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<()>
[src]
&mut self,
number: InterfaceNumber,
alternate_setting: u8,
interface_class: u8,
interface_sub_class: u8,
interface_protocol: u8,
interface_string: Option<StringIndex>
) -> Result<()>
Writes a interface descriptor with a specific alternate setting and interface string identifier.
Arguments
number
- Interface number previously allocated withUsbBusAllocator::interface
.alternate_setting
- Number of the alternate settinginterface_class
- Class code assigned by USB.org. Use0xff
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
pub fn endpoint<'e, B: UsbBus, D: EndpointDirection>(
&mut self,
endpoint: &Endpoint<'e, B, D>
) -> Result<()>
[src]
&mut self,
endpoint: &Endpoint<'e, B, D>
) -> Result<()>
Writes an endpoint descriptor.
Arguments
endpoint
- Endpoint previously allocated withUsbBusAllocator
.
Auto Trait Implementations
impl<'a> Send for DescriptorWriter<'a>
impl<'a> Sync for DescriptorWriter<'a>
impl<'a> Unpin for DescriptorWriter<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,