summaryrefslogtreecommitdiff
path: root/hid/src/devices.rs
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2018-12-11 23:51:40 +0100
committerDaniel Mueller <deso@posteo.net>2018-12-17 07:52:13 -0800
commit44f6100b36eecf79c1e8484a048ea49cad6e488d (patch)
treebf16ea9a570f3026324b9882f46b9f8360e7591f /hid/src/devices.rs
parent6737f748b8edb5266c5397591b92da4c88f95dff (diff)
downloadnitrocli-44f6100b36eecf79c1e8484a048ea49cad6e488d.tar.gz
nitrocli-44f6100b36eecf79c1e8484a048ea49cad6e488d.tar.bz2
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
Diffstat (limited to 'hid/src/devices.rs')
-rw-r--r--hid/src/devices.rs51
1 files changed, 0 insertions, 51 deletions
diff --git a/hid/src/devices.rs b/hid/src/devices.rs
deleted file mode 100644
index 002ffa9..0000000
--- a/hid/src/devices.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use std::marker::PhantomData;
-
-use sys::*;
-use Device;
-
-/// An iterator over the available devices.
-pub struct Devices<'a> {
- ptr: *mut hid_device_info,
- cur: *mut hid_device_info,
-
- _marker: PhantomData<&'a ()>,
-}
-
-impl<'a> Devices<'a> {
- #[doc(hidden)]
- pub unsafe fn new(vendor: Option<u16>, product: Option<u16>) -> Self {
- let list = hid_enumerate(vendor.unwrap_or(0), product.unwrap_or(0));
-
- Devices {
- ptr: list,
- cur: list,
-
- _marker: PhantomData,
- }
- }
-}
-
-impl<'a> Iterator for Devices<'a> {
- type Item = Device<'a>;
-
- fn next(&mut self) -> Option<Self::Item> {
- if self.cur.is_null() {
- return None;
- }
-
- unsafe {
- let info = Device::new(self.cur);
- self.cur = (*self.cur).next;
-
- Some(info)
- }
- }
-}
-
-impl<'a> Drop for Devices<'a> {
- fn drop(&mut self) {
- unsafe {
- hid_free_enumeration(self.ptr);
- }
- }
-}