| name: Rust | ||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| pull_request: | ||
| branches: [ master ] | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: checkout repository and submodules | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| submodules: recursive | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update -y | ||
| sudo apt-get install -y libudev-dev | ||
| - name: Build | ||
| run: cargo build --no-default-features --features linux-static-hidraw --verbose | ||
| - name: Run tests | ||
| run: cargo test --no-default-features --features linux-static-hidraw --verbose |
+45
-0
@@ -36,2 +36,4 @@ // ************************************************************************** | ||
| compile_freebsd(); | ||
| } else if target.contains("illumos") { | ||
| compile_illumos(); | ||
| } else { | ||
@@ -116,2 +118,45 @@ panic!("Unsupported target os for hidapi-rs"); | ||
| fn compile_illumos() { | ||
| // First check the features enabled for the crate. | ||
| // Only one illumos backend should be enabled at a time. | ||
| let avail_backends: [(&'static str, Box<dyn Fn()>); 2] = [ | ||
| ( | ||
| "ILLUMOS_STATIC_LIBUSB", | ||
| Box::new(|| { | ||
| let mut config = cc::Build::new(); | ||
| config | ||
| .file("etc/hidapi/libusb/hid.c") | ||
| .include("etc/hidapi/hidapi"); | ||
| let lib = | ||
| pkg_config::find_library("libusb-1.0").expect("Unable to find libusb-1.0"); | ||
| for path in lib.include_paths { | ||
| config.include( | ||
| path.to_str() | ||
| .expect("Failed to convert include path to str"), | ||
| ); | ||
| } | ||
| config.compile("libhidapi.a"); | ||
| }), | ||
| ), | ||
| ( | ||
| "ILLUMOS_SHARED_LIBUSB", | ||
| Box::new(|| { | ||
| pkg_config::probe_library("hidapi-libusb").expect("Unable to find hidapi-libusb"); | ||
| }), | ||
| ), | ||
| ]; | ||
| let mut backends = avail_backends | ||
| .iter() | ||
| .filter(|f| env::var(format!("CARGO_FEATURE_{}", f.0)).is_ok()); | ||
| if backends.clone().count() != 1 { | ||
| panic!("Exactly one illumos hidapi backend must be selected."); | ||
| } | ||
| // Build it! | ||
| (backends.next().unwrap().1)(); | ||
| } | ||
| fn compile_windows() { | ||
@@ -118,0 +163,0 @@ let linkage = env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or(String::new()); |
+7
-7
@@ -7,9 +7,9 @@ # This file is automatically @generated by Cargo. | ||
| name = "cc" | ||
| version = "1.0.50" | ||
| version = "1.0.66" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" | ||
| checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" | ||
| [[package]] | ||
| name = "hidapi" | ||
| version = "1.2.7" | ||
| version = "1.3.0" | ||
| dependencies = [ | ||
@@ -23,10 +23,10 @@ "cc", | ||
| name = "libc" | ||
| version = "0.2.67" | ||
| version = "0.2.81" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" | ||
| checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" | ||
| [[package]] | ||
| name = "pkg-config" | ||
| version = "0.3.17" | ||
| version = "0.3.19" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" | ||
| checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" |
+4
-2
@@ -14,3 +14,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "hidapi" | ||
| version = "1.2.7" | ||
| version = "1.3.0" | ||
| authors = ["Roland Ruckerbauer <roland.rucky@gmail.com>", "Osspial <osspial@gmail.com>", "Artyom Pavlov <newpavlov@gmail.com>", "mberndt123", "niklasad1"] | ||
@@ -33,3 +33,5 @@ build = "build.rs" | ||
| [features] | ||
| default = ["linux-static-libusb"] | ||
| default = ["linux-static-libusb", "illumos-static-libusb"] | ||
| illumos-shared-libusb = [] | ||
| illumos-static-libusb = [] | ||
| linux-shared-hidraw = [] | ||
@@ -36,0 +38,0 @@ linux-shared-libusb = [] |
+1
-1
@@ -1,2 +0,2 @@ | ||
| # hidapi [](https://travis-ci.org/ruabmbua/hidapi-rs) [](https://crates.io/crates/hidapi) [](https://github.com/Osspial/hidapi-rs/blob/master/LICENSE.txt) [](https://docs.rs/hidapi) [](https://discordapp.com/invite/3ahhJGN) | ||
| # hidapi [](https://crates.io/crates/hidapi) [](https://github.com/Osspial/hidapi-rs/blob/master/LICENSE.txt) [](https://docs.rs/hidapi) [](https://discordapp.com/invite/3ahhJGN) | ||
@@ -3,0 +3,0 @@ This crate provides a rust abstraction over the features of the C library |
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "lldb", | ||
| "request": "launch", | ||
| "name": "Debug unit tests in library 'hidapi'", | ||
| "cargo": { | ||
| "args": [ | ||
| "test", | ||
| "--no-run", | ||
| "--lib", | ||
| "--package=hidapi" | ||
| ], | ||
| "filter": { | ||
| "name": "hidapi", | ||
| "kind": "lib" | ||
| } | ||
| }, | ||
| "args": [], | ||
| "cwd": "${workspaceFolder}" | ||
| } | ||
| ] | ||
| } |
| { | ||
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
| // for the documentation about the tasks.json format | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Check", | ||
| "type": "shell", | ||
| "command": "echo Hello" | ||
| }, | ||
| { | ||
| "type": "cargo", | ||
| "subcommand": "check", | ||
| "problemMatcher": [ | ||
| "$rustc" | ||
| ], | ||
| "group": { | ||
| "kind": "build", | ||
| "isDefault": true | ||
| } | ||
| } | ||
| ] | ||
| } |
Sorry, the diff of this file is not supported yet