diff --git a/Cargo.lock b/Cargo.lock index 6094ba0..4826b35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -257,6 +257,7 @@ dependencies = [ "enumflags2 0.7.9", "libc", "log", + "nix", "pkg-config", "tokio", ] @@ -300,6 +301,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chipp_http" version = "1.1.0" @@ -1081,9 +1088,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libsqlite3-sys" @@ -1227,6 +1234,18 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -1298,9 +1317,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.5.0", "cfg-if", @@ -1330,9 +1349,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -1686,12 +1705,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.6" -source = "git+https://github.com/chipp/serde-repr?branch=master#41637449bfac1098be00ece651df49ef8e66a9ad" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.57", ] [[package]] diff --git a/lib/bluetooth/Cargo.toml b/lib/bluetooth/Cargo.toml index b0d003c..18438bd 100644 --- a/lib/bluetooth/Cargo.toml +++ b/lib/bluetooth/Cargo.toml @@ -7,12 +7,14 @@ edition = "2021" log = "0.4" tokio = { version = "1", features = ["io-util", "sync"] } enumflags2 = "0.7" +nix = { version = "0.29.0", features = ["ioctl"] } [target.'cfg(target_os = "macos")'.dependencies] core_bluetooth = "0.1" [target.'cfg(target_os = "linux")'.dependencies] libc = "0.2" +nix = "0.29.0" [build-dependencies] pkg-config = "*" diff --git a/lib/bluetooth/src/os/linux/constants.rs b/lib/bluetooth/src/os/linux/constants.rs index 37c51d7..ed6ad32 100644 --- a/lib/bluetooth/src/os/linux/constants.rs +++ b/lib/bluetooth/src/os/linux/constants.rs @@ -1,4 +1,5 @@ -use libc::{c_char, c_int, c_uint}; +use libc::{c_char, c_int, c_uint, c_ulong}; +use nix::request_code_write; pub const HCI_MAX_EVENT_SIZE: c_int = 260; @@ -30,7 +31,16 @@ const fn _iow(r#type: c_char, nr: c_int) -> c_int { _ioc(_IOC_WRITE, r#type, nr, std::mem::size_of::()) } -pub const HCIDEVUP: c_int = _iow::(b'H' as c_char, 201); -pub const HCIDEVDOWN: c_int = _iow::(b'H' as c_char, 202); +#[cfg(not(target_env = "musl"))] +pub const HCIDEVUP: c_ulong = request_code_write!(b'H', 201, std::mem::size_of::()); + +#[cfg(target_env = "musl")] +pub const HCIDEVUP: c_int = request_code_write!(b'H', 201, std::mem::size_of::()); + +#[cfg(not(target_env = "musl"))] +pub const HCIDEVDOWN: c_ulong = request_code_write!(b'H', 202, std::mem::size_of::()); + +#[cfg(target_env = "musl")] +pub const HCIDEVDOWN: c_int = request_code_write!(b'H', 202, std::mem::size_of::()); pub const EVT_LE_ADVERTISING_REPORT: u8 = 0x02; diff --git a/lib/xiaomi/Cargo.toml b/lib/xiaomi/Cargo.toml index c9add78..a3b79f7 100644 --- a/lib/xiaomi/Cargo.toml +++ b/lib/xiaomi/Cargo.toml @@ -14,7 +14,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-util", "ne serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } -serde_repr = { git = "https://github.com/chipp/serde-repr", branch = "master" } +serde_repr = "0.1" md-5 = "0.10"