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,6 +20,7 @@ rog_aura = { path = "../rog-aura", features = ["dbus"] }
rog_platform = { path = "../rog-platform" }
rog_profiles = { path = "../rog-profiles" }
rog_dbus = { path = "../rog-dbus" }
dmi_id = { path = "../dmi-id" }
async-trait.workspace = true
tokio.workspace = true
@@ -35,9 +36,6 @@ logind-zbus.workspace = true
serde.workspace = true
serde_derive.workspace = true
# Device control
sysfs-class.workspace = true # used for backlight control and baord ID
concat-idents.workspace = true
systemd-zbus = "*"

View File

@@ -1,6 +1,7 @@
use std::collections::BTreeMap;
use config_traits::{StdConfig, StdConfigLoad};
use dmi_id::DMIID;
use log::{info, warn};
use rog_aura::advanced::{LedUsbPackets, UsbPackets};
use rog_aura::aura_detection::{LaptopLedData, ASUS_KEYBOARD_DEVICES};
@@ -90,14 +91,12 @@ impl CtrlKbdLed {
let rgb_led = KeyboardLed::new()?;
if usb_node.is_none() && !rgb_led.has_kbd_rgb_mode() {
let dmi = sysfs_class::DmiId::default();
if let Ok(prod_family) = dmi.product_family() {
if prod_family.contains("TUF") {
warn!(
"kbd_rgb_mode was not found in the /sys/. You require a minimum 6.1 \
kernel and a supported TUF laptop"
);
}
let dmi = DMIID::new().unwrap_or_default();
if dmi.dmi_family.contains("TUF") {
warn!(
"kbd_rgb_mode was not found in the /sys/. You require a minimum 6.1 kernel \
and a supported TUF laptop"
);
}
return Err(RogError::NoAuraKeyboard);
}

View File

@@ -20,6 +20,7 @@ pub mod error;
use std::future::Future;
use async_trait::async_trait;
use dmi_id::DMIID;
use log::{debug, info, warn};
use logind_zbus::manager::ManagerProxy;
use zbus::export::futures_util::StreamExt;
@@ -88,12 +89,9 @@ macro_rules! task_watch_item {
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn print_board_info() {
let dmi = sysfs_class::DmiId::default();
let board_name = dmi.board_name().expect("Could not get board_name");
let prod_family = dmi.product_family().expect("Could not get product_family");
info!("Product family: {}", prod_family.trim());
info!("Board name: {}", board_name.trim());
let dmi = DMIID::new().unwrap_or_default();
info!("Product family: {}", dmi.product_family);
info!("Board name: {}", dmi.board_name);
}
#[async_trait]