Drop sysfs_class and create dmi_id for getting identifying info with udev

This commit is contained in:
Luke D. Jones
2023-10-30 14:46:36 +13:00
parent 4c50dc259c
commit 35c7fd10b3
14 changed files with 54 additions and 65 deletions

View File

@@ -20,14 +20,12 @@ dbus = ["zbus"]
serde.workspace = true
serde_derive.workspace = true
zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id" }
# cli and logging
log.workspace = true
typeshare.workspace = true
# Device control
sysfs-class.workspace = true # used for backlight control and baord ID
ron = { version = "*", optional = true }
[dev-dependencies]

View File

@@ -1,3 +1,4 @@
use dmi_id::DMIID;
use log::{error, info, warn};
use serde_derive::{Deserialize, Serialize};
use typeshare::typeshare;
@@ -59,13 +60,12 @@ pub struct LaptopLedData {
impl LaptopLedData {
pub fn get_data() -> Self {
let dmi = sysfs_class::DmiId::default();
let board_name = dmi.board_name().expect("Could not get board_name");
let dmi = DMIID::new().unwrap_or_default();
// let prod_family = dmi.product_family().expect("Could not get
// product_family");
if let Some(modes) = LedSupportFile::load_from_supoprt_db() {
if let Some(data) = modes.matcher(&board_name) {
if let Some(data) = modes.matcher(&dmi.board_name) {
return data;
}
}