[−][src]Struct hidapi::HidApi
Object for handling hidapi context and implementing RAII for it. Only one instance can exist at a time.
Methods
impl HidApi
[src]
pub fn new() -> HidResult<Self>
[src]
Initializes the hidapi.
Will also initialize the currently available device list.
pub fn refresh_devices(&mut self) -> HidResult<()>
[src]
Refresh devices list and information about them (to access them use
devices()
method)
pub fn devices(&self) -> &Vec<HidDeviceInfo>
[src]
Returns list of objects containing information about connected devices
pub fn open(&self, vid: u16, pid: u16) -> HidResult<HidDevice>
[src]
Open a HID device using a Vendor ID (VID) and Product ID (PID).
When multiple devices with the same vid and pid are available, then the first one found in the internal device list will be used. There are however no grantees, which device this will be.
pub fn open_serial(&self, vid: u16, pid: u16, sn: &str) -> HidResult<HidDevice>
[src]
Open a HID device using a Vendor ID (VID), Product ID (PID) and a serial number.
pub fn open_path(&self, device_path: &CStr) -> HidResult<HidDevice>
[src]
The path name be determined by inspecting the device list available with HidApi::devices()
Alternatively a platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
Auto Trait Implementations
impl Send for HidApi
impl Sync for HidApi
impl Unpin for HidApi
impl UnwindSafe for HidApi
impl RefUnwindSafe for HidApi
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,