aboutsummaryrefslogtreecommitdiff
path: root/hidapi-sys
diff options
context:
space:
mode:
Diffstat (limited to 'hidapi-sys')
-rw-r--r--hidapi-sys/.gitignore2
-rw-r--r--hidapi-sys/Cargo.toml24
-rw-r--r--hidapi-sys/README.md10
-rw-r--r--hidapi-sys/build.rs93
-rw-r--r--hidapi-sys/src/lib.rs68
5 files changed, 0 insertions, 197 deletions
diff --git a/hidapi-sys/.gitignore b/hidapi-sys/.gitignore
deleted file mode 100644
index a9d37c5..0000000
--- a/hidapi-sys/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-target
-Cargo.lock
diff --git a/hidapi-sys/Cargo.toml b/hidapi-sys/Cargo.toml
deleted file mode 100644
index 3483b34..0000000
--- a/hidapi-sys/Cargo.toml
+++ /dev/null
@@ -1,24 +0,0 @@
-[package]
-name = "hidapi-sys"
-version = "0.1.4"
-build = "build.rs"
-links = "hidapi"
-
-authors = ["meh. <meh@schizofreni.co>"]
-license = "WTFPL"
-
-description = "FFI bindings to hidapi"
-repository = "https://github.com/meh/rust-hidapi-sys"
-keywords = ["hid"]
-categories = ["external-ffi-bindings", "hardware-support", "os"]
-
-[features]
-static = []
-build = ["static"]
-
-[dependencies]
-libc = "0.2"
-
-[build-dependencies]
-cc = "1.0"
-pkg-config = "0.3"
diff --git a/hidapi-sys/README.md b/hidapi-sys/README.md
deleted file mode 100644
index 89048b1..0000000
--- a/hidapi-sys/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-hidapi-sys [![WTFPL](http://img.shields.io/badge/license-WTFPL-blue.svg)](http://www.wtfpl.net/txt/copying)
-==========
-Bindings for hidapi with support for building sources automatically.
-
-Requirements
-------------
-`gcc` and `pkg-config` are required for building source automatically.
-
-`git` is required unless `HIDAPI_PATH` is exported to an existing checkout of
-hidapi sources.
diff --git a/hidapi-sys/build.rs b/hidapi-sys/build.rs
deleted file mode 100644
index 4a392c6..0000000
--- a/hidapi-sys/build.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-extern crate cc;
-extern crate pkg_config;
-
-use std::env;
-use std::io;
-use std::path::PathBuf;
-use std::process::Command;
-
-fn main() {
- if env::var("CARGO_FEATURE_BUILD").is_err() {
- return;
- }
-
- fetch().expect("failed to checkout hidapi sources, internet connection and git are needed");
- build().expect("failed to build hidapi sources");
-
- println!("cargo:rustc-link-search=native={}", output().to_string_lossy());
-}
-
-fn output() -> PathBuf {
- PathBuf::from(env::var("OUT_DIR").unwrap())
-}
-
-fn source() -> PathBuf {
- if let Ok(path) = env::var("HIDAPI_PATH") {
- path.into()
- }
- else {
- output().join("hidapi")
- }
-}
-
-fn fetch() -> io::Result<()> {
- if env::var("HIDAPI_PATH").is_ok() {
- return Ok(());
- }
-
- Command::new("git")
- .current_dir(&output())
- .arg("clone")
- .arg("https://github.com/signal11/hidapi.git")
- .arg("hidapi")
- .status()?;
-
- Ok(())
-}
-
-#[cfg(target_os = "linux")]
-fn build() -> io::Result<()> {
- let mut build = cc::Build::new();
-
- build.file(source().join("libusb/hid.c"));
- build.include(source().join("hidapi"));
- build.static_flag(true);
-
- for path in pkg_config::find_library("libusb-1.0").unwrap().include_paths {
- build.include(path.to_str().unwrap());
- }
-
- build.compile("libhidapi-libusb.a");
-
- Ok(())
-}
-
-#[cfg(target_os = "macos")]
-fn build() -> io::Result<()> {
- let mut build = cc::Build::new();
-
- build.file(source().join("libusb/hid.c"));
- build.include(source().join("hidapi"));
- build.static_flag(true);
-
- for path in pkg_config::find_library("libusb-1.0").unwrap().include_paths {
- build.include(path.to_str().unwrap());
- }
-
- build.compile("libhidapi.a");
-
- Ok(())
-}
-
-#[cfg(target_os = "windows")]
-fn build() -> io::Result<()> {
- let mut build = cc::Build::new();
-
- build.file(source().join("windows/hid.c"));
- build.include(source().join("hidapi"));
- build.static_flag(true);
-
- build.compile("libhidapi.a");
-
- Ok(())
-}
diff --git a/hidapi-sys/src/lib.rs b/hidapi-sys/src/lib.rs
deleted file mode 100644
index 656bd47..0000000
--- a/hidapi-sys/src/lib.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
-
-extern crate libc;
-
-use libc::{c_void, c_ushort, wchar_t, c_int, c_uchar, size_t, c_char};
-
-pub type hid_device = c_void;
-
-#[repr(C)]
-pub struct hid_device_info {
- pub path: *mut c_char,
-
- pub vendor_id: c_ushort,
- pub product_id: c_ushort,
-
- pub serial_number: *mut wchar_t,
- pub release_number: c_ushort,
-
- pub manufacturer_string: *mut wchar_t,
- pub product_string: *mut wchar_t,
-
- pub usage_page: c_ushort,
- pub usage: c_ushort,
-
- pub interface_number: c_int,
-
- pub next: *mut hid_device_info,
-}
-
-#[cfg_attr(target_os = "linux", link(name = "udev"))]
-extern "C" { }
-
-#[cfg_attr(target_os = "windows", link(name = "setupapi"))]
-extern "C" { }
-
-#[cfg_attr(all(feature = "static", target_os = "linux"), link(name = "hidapi-libusb", kind = "static"))]
-#[cfg_attr(all(not(feature = "static"), target_os = "linux"), link(name = "hidapi-libusb"))]
-#[cfg_attr(all(feature = "static", not(target_os = "linux")), link(name = "hidapi", kind = "static"))]
-#[cfg_attr(all(not(feature = "static"), not(target_os = "linux")), link(name = "hidapi"))]
-extern "C" {
- pub fn hid_init() -> c_int;
- pub fn hid_exit() -> c_int;
-
- pub fn hid_enumerate(vendor_id: c_ushort, product_id: c_ushort) -> *mut hid_device_info;
- pub fn hid_free_enumeration(devs: *mut hid_device_info);
-
- pub fn hid_open(vendor_id: c_ushort, product_id: c_ushort, serial_number: *const wchar_t) -> *mut hid_device;
- pub fn hid_open_path(path: *const c_char) -> *mut hid_device;
-
- pub fn hid_write(device: *mut hid_device, data: *const c_uchar, length: size_t) -> c_int;
-
- pub fn hid_read_timeout(device: *mut hid_device, data: *mut c_uchar, length: size_t, milleseconds: c_int) -> c_int;
- pub fn hid_read(device: *mut hid_device, data: *mut c_uchar, length: size_t) -> c_int;
-
- pub fn hid_set_nonblocking(device: *mut hid_device, nonblock: c_int) -> c_int;
-
- pub fn hid_send_feature_report(device: *mut hid_device, data: *const c_uchar, length: size_t) -> c_int;
- pub fn hid_get_feature_report(device: *mut hid_device, data: *mut c_uchar, length: size_t) -> c_int;
-
- pub fn hid_close(device: *mut hid_device);
-
- pub fn hid_get_manufacturer_string(device: *mut hid_device, string: *mut wchar_t, maxlen: size_t) -> c_int;
- pub fn hid_get_product_string(device: *mut hid_device, string: *mut wchar_t, maxlen: size_t) -> c_int;
- pub fn hid_get_serial_number_string(device: *mut hid_device, string: *mut wchar_t, maxlen: size_t) -> c_int;
- pub fn hid_get_indexed_string(device: *mut hid_device, string_index: c_int, string: *mut wchar_t, maxlen: size_t) -> c_int;
-
- pub fn hid_error(device: *mut hid_device) -> *const wchar_t;
-}