Struct hidapi::DeviceInfo
source · pub struct DeviceInfo { /* private fields */ }
Expand description
Device information. Use accessors to extract information about Hid devices.
Note: Methods like serial_number()
may return None, if the conversion to a
String failed internally. You can however access the raw hid representation of the
string by calling serial_number_raw()
Implementations
sourceimpl DeviceInfo
impl DeviceInfo
pub fn path(&self) -> &CStr
pub fn vendor_id(&self) -> u16
pub fn product_id(&self) -> u16
sourcepub fn serial_number(&self) -> Option<&str>
pub fn serial_number(&self) -> Option<&str>
Try to call serial_number_raw()
, if None is returned.
pub fn serial_number_raw(&self) -> Option<&[wchar_t]>
pub fn release_number(&self) -> u16
sourcepub fn manufacturer_string(&self) -> Option<&str>
pub fn manufacturer_string(&self) -> Option<&str>
Try to call manufacturer_string_raw()
, if None is returned.
pub fn manufacturer_string_raw(&self) -> Option<&[wchar_t]>
sourcepub fn product_string(&self) -> Option<&str>
pub fn product_string(&self) -> Option<&str>
Try to call product_string_raw()
, if None is returned.
pub fn product_string_raw(&self) -> Option<&[wchar_t]>
pub fn usage_page(&self) -> u16
pub fn usage(&self) -> u16
pub fn interface_number(&self) -> i32
sourcepub fn open_device(&self, hidapi: &HidApi) -> HidResult<HidDevice>
pub fn open_device(&self, hidapi: &HidApi) -> HidResult<HidDevice>
Use the information contained in DeviceInfo
to open
and return a handle to a HidDevice.
By default the device path is used to open the device. When no path is available, then vid, pid and serial number are used. If both path and serial number are not available, then this function will fail with HidError::OpenHidDeviceWithDeviceInfoError.
Note, that opening a device could still be done using HidApi::open() directly.
Trait Implementations
sourceimpl Clone for DeviceInfo
impl Clone for DeviceInfo
sourcefn clone(&self) -> DeviceInfo
fn clone(&self) -> DeviceInfo
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more