From da67cb1836bcf6e74ac932adb55efe53b306cfba Mon Sep 17 00:00:00 2001 From: John Whittington Date: Fri, 21 Jun 2024 11:06:01 +0200 Subject: [PATCH] udevrs fixes integrated; hwdb lookup working --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/udev.rs | 11 +---------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 807112d..4ed3e82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,7 +239,7 @@ checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" [[package]] name = "cyme" -version = "1.6.0" +version = "1.6.1" dependencies = [ "assert-json-diff", "clap", diff --git a/Cargo.toml b/Cargo.toml index 62388d9..5ee3366 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ description = "List system USB buses and devices; a modern cross-platform `lsusb repository = "https://github.com/tuna-f1sh/cyme" readme = "README.md" license = "GPL-3.0-or-later" -version = "1.6.1" +version = "1.7.0" edition = "2021" keywords = ["usb", "lsusb", "system_profiler", "macos", "libusb"] categories = ["command-line-utilities"] diff --git a/src/udev.rs b/src/udev.rs index a120013..4b2304d 100644 --- a/src/udev.rs +++ b/src/udev.rs @@ -146,16 +146,7 @@ pub mod hwdb { ) })?; - hwdb.get_properties_list_entry(&modalias.to_string(), 0) - .map(|mut entry| entry - .find(|entry| entry.name() == key) - .map(|entry| entry.value().to_owned()) - ).map_err(|e| { - Error::new( - ErrorKind::Udev, - &format!("Failed to get hwdb modalias/key {}/{}: Error({})", modalias, key, e), - ) - }) + Ok(udevrs::udev_hwdb_query_one(&mut hwdb, modalias, key).map(|s| s.trim().to_string())) } }