Skip to main content

DeviceDescriptor

Struct DeviceDescriptor 

Source
pub struct DeviceDescriptor {
    pub usb_version: u16,
    pub class: u8,
    pub sub_class: u8,
    pub protocol: u8,
    pub max_packet0: u16,
    pub vendor_id: u16,
    pub product_id: u16,
    pub device_version: u16,
    pub manufacturer: u8,
    pub product: u8,
    pub serial_number: u8,
    pub configurations: u8,
}
Expand description

The standard device descriptor (USB 2.0 §9.6.1).

Fields§

§usb_version: u16

bcdUSB.

§class: u8

bDeviceClass.

§sub_class: u8

bDeviceSubClass.

§protocol: u8

bDeviceProtocol.

§max_packet0: u16

bMaxPacketSize0, the control endpoint packet size.

§vendor_id: u16

idVendor.

§product_id: u16

idProduct.

§device_version: u16

bcdDevice.

§manufacturer: u8

Manufacturer string index, zero when absent.

§product: u8

Product string index, zero when absent.

§serial_number: u8

Serial number string index, zero when absent.

§configurations: u8

bNumConfigurations.

Implementations§

Source§

impl DeviceDescriptor

Source

pub const LEN: usize = 18

Length of the descriptor on the wire.

Source

pub fn parse(bytes: &[u8]) -> HostResult<Self>

Parse the 18 bytes the device returned.

Trait Implementations§

Source§

impl Clone for DeviceDescriptor

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DeviceDescriptor

Source§

impl Debug for DeviceDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DeviceDescriptor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DeviceDescriptor

Source§

impl Format for DeviceDescriptor

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for DeviceDescriptor

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DeviceDescriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.