Struct playdate_device::device::DeviceInfo
source · 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 bus_number(&self) -> u8
pub fn bus_number(&self) -> u8
Number identifying 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 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 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.
§Platform-specific notes
- On Windows, this comes from a case-insensitive instance ID and may have been converted to upper case from the descriptor string. It is recommended to use a case-insensitive comparison when matching a device.
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 AsRef<DeviceInfo> for Device
impl AsRef<DeviceInfo> for Device
source§fn as_ref(&self) -> &DeviceInfo
fn as_ref(&self) -> &DeviceInfo
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 moresource§impl Debug for DeviceInfo
impl Debug for DeviceInfo
source§impl DeviceMode for DeviceInfo
impl DeviceMode for DeviceInfo
source§impl HaveDataInterface for DeviceInfo
impl HaveDataInterface for DeviceInfo
fn data_interface_number(&self) -> Option<u8>
fn have_data_interface(&self) -> bool
source§impl MassStorageInterface for DeviceInfo
impl MassStorageInterface for DeviceInfo
fn storage_interface(&self) -> Option<&InterfaceInfo>
fn have_storage_interface(&self) -> bool
Auto Trait Implementations§
impl Freeze for DeviceInfo
impl RefUnwindSafe for DeviceInfo
impl Send for DeviceInfo
impl Sync for DeviceInfo
impl Unpin for DeviceInfo
impl UnwindSafe for DeviceInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 136 bytes