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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DeviceInfo
impl Debug for DeviceInfo
sourceimpl Into<HidDeviceInfo> for DeviceInfo
impl Into<HidDeviceInfo> for DeviceInfo
sourcefn into(self) -> HidDeviceInfo
fn into(self) -> HidDeviceInfo
Converts this type into the (usually inferred) input type.
Auto Trait Implementations
impl RefUnwindSafe for DeviceInfo
impl Send for DeviceInfo
impl Sync for DeviceInfo
impl Unpin for DeviceInfo
impl UnwindSafe for DeviceInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more