From 44f6100b36eecf79c1e8484a048ea49cad6e488d Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 11 Dec 2018 23:51:40 +0100 Subject: Remove unused dependencies This patch removes all dependencies that are no longer required since the hidapi communication is replaced by libnitrokey. Delete subrepo hid/:hid Delete subrepo hidapi-sys/:hidapi-sys Delete subrepo pkg-config/:pkg-config --- hid/src/manager.rs | 56 ------------------------------------------------------ 1 file changed, 56 deletions(-) delete mode 100644 hid/src/manager.rs (limited to 'hid/src/manager.rs') diff --git a/hid/src/manager.rs b/hid/src/manager.rs deleted file mode 100644 index 4c2eb23..0000000 --- a/hid/src/manager.rs +++ /dev/null @@ -1,56 +0,0 @@ -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - -use sys::*; -use error::{self, Error}; -use devices::Devices; - -static INITIALIZED: AtomicBool = ATOMIC_BOOL_INIT; - -/// The device manager. -pub struct Manager; - -unsafe impl Send for Manager { } - -/// Create the manager. -pub fn init() -> error::Result { - if INITIALIZED.load(Ordering::Relaxed) { - return Err(Error::Initialized); - } - - let status = unsafe { hid_init() }; - - if status != 0 { - return Err(Error::from(status)); - } - - INITIALIZED.store(true, Ordering::Relaxed); - - Ok(Manager) -} - -impl Drop for Manager { - fn drop(&mut self) { - let status = unsafe { hid_exit() }; - - if status != 0 { - panic!("hid_exit() failed"); - } - - INITIALIZED.store(false, Ordering::Relaxed); - } -} - -impl Manager { - /// Find the wanted device, `vendor` or `product` are given it will - /// returns only the matches devices. - pub fn find(&self, vendor: Option, product: Option) -> Devices { - unsafe { - Devices::new(vendor, product) - } - } - - /// Return all devices. - pub fn devices(&self) -> Devices { - self.find(None, None) - } -} -- cgit v1.2.1