pub struct DeviceInfo { /* private fields */ }Expand description
Information about a device that can be obtained without opening it.
Found in the results of crate::list_devices.
§Platform-specific notes
- Some fields are platform-specific
- Linux:
sysfs_path - Windows:
instance_id,parent_instance_id,port_number,driver - macOS:
registry_id,location_id
- Linux:
Implementations§
Source§impl DeviceInfo
impl DeviceInfo
Sourcepub fn sysfs_path(&self) -> &Path
pub fn sysfs_path(&self) -> &Path
(Linux-only) Sysfs path for the device.
Sourcepub fn busnum(&self) -> u8
pub fn busnum(&self) -> u8
(Linux-only) Bus number.
On Linux, the bus_id is an integer and this provides the value as u8.
Sourcepub fn port_chain(&self) -> &[u8] ⓘ
pub fn port_chain(&self) -> &[u8] ⓘ
Path of port numbers identifying the port where the device is connected.
Together with the bus ID, it identifies a physical port. The path is expected to remain stable across device insertions or reboots.
Since USB SuperSpeed is a separate topology from USB 2.0 speeds, a physical port may be identified differently depending on speed.
Sourcepub fn bus_id(&self) -> &str
pub fn bus_id(&self) -> &str
Identifier for the bus / host controller where the device is connected.
Sourcepub fn device_address(&self) -> u8
pub fn device_address(&self) -> u8
Number identifying the device within the bus.
Sourcepub fn vendor_id(&self) -> u16
pub fn vendor_id(&self) -> u16
The 16-bit number identifying the device’s vendor, from the idVendor device descriptor field.
Sourcepub fn product_id(&self) -> u16
pub fn product_id(&self) -> u16
The 16-bit number identifying the product, from the idProduct device descriptor field.
Sourcepub fn device_version(&self) -> u16
pub fn device_version(&self) -> u16
The device version, normally encoded as BCD, from the bcdDevice device descriptor field.
Sourcepub fn usb_version(&self) -> u16
pub fn usb_version(&self) -> u16
Encoded version of the USB specification, from the bcdUSB device descriptor field.
Sourcepub fn class(&self) -> u8
pub fn class(&self) -> u8
Code identifying the standard device class, from the bDeviceClass device descriptor field.
0x00: specified at the interface level.
0xFF: vendor-defined.
Sourcepub fn subclass(&self) -> u8
pub fn subclass(&self) -> u8
Standard subclass, from the bDeviceSubClass device descriptor field.
Sourcepub fn protocol(&self) -> u8
pub fn protocol(&self) -> u8
Standard protocol, from the bDeviceProtocol device descriptor field.
Sourcepub fn max_packet_size_0(&self) -> u8
pub fn max_packet_size_0(&self) -> u8
Maximum packet size for endpoint zero.
Sourcepub fn manufacturer_string(&self) -> Option<&str>
pub fn manufacturer_string(&self) -> Option<&str>
Manufacturer string, if available without device IO.
§Platform-specific notes
- Windows: Windows does not cache the manufacturer string, and
this will return
Noneregardless of whether a descriptor exists.
Sourcepub fn product_string(&self) -> Option<&str>
pub fn product_string(&self) -> Option<&str>
Product string, if available without device IO.
Sourcepub fn serial_number(&self) -> Option<&str>
pub fn serial_number(&self) -> Option<&str>
Serial number string, if available without device IO.
Sourcepub fn interfaces(&self) -> impl Iterator<Item = &InterfaceInfo>
pub fn interfaces(&self) -> impl Iterator<Item = &InterfaceInfo>
Iterator over the device’s interfaces.
This returns summary information about the interfaces in the device’s active configuration for the purposes of matching devices prior to opening them.
Additional information about interfaces can be found in the
configuration descriptor after opening the device by calling
Device::active_configuration.
§Platform-specific notes:
- Windows: this is only available for composite devices bound to the
usbccgpdriver, and will be empty if the entire device is bound to a specific driver. - Windows: When interfaces are grouped by an interface association descriptor, this returns details from the interface association descriptor and does not include each of the associated interfaces.
Trait Implementations§
Source§impl Clone for DeviceInfo
impl Clone for DeviceInfo
Source§fn clone(&self) -> DeviceInfo
fn clone(&self) -> DeviceInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more