From 96e22efb4a4ebcb0f00fb02361a735d61d755232 Mon Sep 17 00:00:00 2001 From: Andelf Date: Sun, 5 Nov 2023 10:33:35 +0800 Subject: [PATCH] fix(linux): add libudev --- .github/workflows/ci.yml | 5 +++++ .github/workflows/nightly-release.yml | 3 +++ Cargo.lock | 21 +++++++++++++++++++++ Cargo.toml | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3426b9c..054b100 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,12 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install libudev for Linux + if: runner.os == 'Linux' + run: sudo apt-get install libudev-dev - name: Build run: cargo build --verbose - name: Run tests run: cargo test --verbose + - name: Run help + run: cargo run -- --help diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml index 5862181..424637c 100644 --- a/.github/workflows/nightly-release.yml +++ b/.github/workflows/nightly-release.yml @@ -31,6 +31,9 @@ jobs: toolchain: nightly components: rustfmt, clippy override: true + - name: Install libudev for Linux (optional) + if: matrix.os == 'Linux' + run: sudo apt-get install libudev-dev - name: Build run: cargo build --release - name: Run help diff --git a/Cargo.lock b/Cargo.lock index 8da7829..afdca8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,6 +251,26 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +[[package]] +name = "libudev" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "libusb1-sys" version = "0.6.4" @@ -457,6 +477,7 @@ dependencies = [ "IOKit-sys", "bitflags 2.0.2", "cfg-if", + "libudev", "mach2", "nix", "regex", diff --git a/Cargo.toml b/Cargo.toml index ee4027e..724566d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,4 +32,4 @@ object = { version = "0.32", default-features = false, features = [ "std", ] } indicatif = "0.17.7" -serialport = { version = "4.2.2", default-features = false} +serialport = "4.2.2"