pub struct UsbDevice {Show 18 fields
pub configurations: Vec<UsbConfiguration>,
pub configuration: Option<UsbConfiguration>,
pub device_class: u8,
pub device_subclass: u8,
pub device_protocol: u8,
pub device_version_major: u8,
pub device_version_minor: u8,
pub device_version_subminor: u8,
pub manufacturer_name: Option<String>,
pub product_id: u16,
pub product_name: Option<String>,
pub serial_number: Option<String>,
pub usb_version_major: u8,
pub usb_version_minor: u8,
pub usb_version_subminor: u8,
pub vendor_id: u16,
pub opened: bool,
pub url: Option<String>,
/* private fields */
}Expand description
Represents a UsbDevice.
Only way you can obtain one is through Context::devices
https://wicg.github.io/webusb/#device-usage
Fields§
§configurations: Vec<UsbConfiguration>List of configurations supported by the device.
Populated from the configuration descriptor.
configurations.len() SHALL be equal to the
bNumConfigurations field of the device descriptor.
configuration: Option<UsbConfiguration>Represents the currently selected configuration.
One of the elements of self.configurations.
None, if the device is not configured.
device_class: u8bDeviceClass value of the device descriptor.
device_subclass: u8bDeviceSubClass value of the device descriptor.
device_protocol: u8bDeviceProtocol value of the device descriptor.
device_version_major: u8The major version declared by bcdDevice field such that bcdDevice 0xJJMN represents major version JJ.
device_version_minor: u8The minor version declared by bcdDevice field such that bcdDevice 0xJJMN represents minor version M.
device_version_subminor: u8The subminor version declared by bcdDevice field such that bcdDevice 0xJJMN represents subminor version N.
manufacturer_name: Option<String>Optional property of the string descriptor. Indexed by the iManufacturer field of device descriptor.
product_id: u16idProduct field of the device descriptor.
product_name: Option<String>Optional property of the string descriptor. Indexed by the iProduct field of device descriptor.
serial_number: Option<String>Optional property of the string descriptor. None, if the iSerialNumber field of device descriptor is 0.
usb_version_major: u8The major version declared by bcdUSB field such that bcdUSB 0xJJMN represents major version JJ.
usb_version_minor: u8The minor version declared by bcdUSB field such that bcdUSB 0xJJMN represents minor version M.
usb_version_subminor: u8The subminor version declared by bcdUSB field such that bcdUSB 0xJJMN represents subminor version N.
vendor_id: u16idVendor field of the device descriptor. https://wicg.github.io/webusb/#vendor-id
opened: boolIf true, the underlying device handle is owned by this object.
url: Option<String>WEBUSB_URL value of the WebUSB Platform Capability Descriptor.
Implementations§
Source§impl UsbDevice
impl UsbDevice
pub fn isochronous_transfer_in(&mut self)
pub fn isochronous_transfer_out(&mut self)
pub fn open(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Sourcepub fn select_configuration(&mut self, configuration_value: u8) -> Result<()>
pub fn select_configuration(&mut self, configuration_value: u8) -> Result<()>
configuration_value is the bConfigurationValue of the device configuration.