diff --git a/CHANGELOG.md b/CHANGELOG.md index bf4f4699..48aa0501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support for G513RW LED modes +- Support Rog Ally LED modes (basic) ### Changed - rog-control-center: ensure brightness slider works correctly @@ -17,7 +18,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support for G733PZ LED modes - Support for G713RC LED modes -- Support Rog Ally LED modes (basic) ### Changed - Fix loading of fan curves from stored settings diff --git a/Cargo.lock b/Cargo.lock index d906bcb9..e02125c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,6 +202,7 @@ version = "4.7.2" dependencies = [ "asusd", "cargo-husky", + "dmi_id", "gif", "glam", "gumdrop", @@ -210,7 +211,6 @@ dependencies = [ "rog_dbus", "rog_platform", "rog_profiles", - "sysfs-class", "tinybmp", "toml 0.5.11", ] @@ -223,6 +223,7 @@ dependencies = [ "cargo-husky", "concat-idents", "config-traits", + "dmi_id", "env_logger", "log", "logind-zbus", @@ -233,7 +234,6 @@ dependencies = [ "rog_profiles", "serde", "serde_derive", - "sysfs-class", "systemd-zbus", "tokio", "zbus", @@ -835,6 +835,10 @@ dependencies = [ "libc", ] +[[package]] +name = "cpuctl" +version = "4.7.2" + [[package]] name = "cpufeatures" version = "0.2.9" @@ -955,6 +959,14 @@ dependencies = [ "libloading", ] +[[package]] +name = "dmi_id" +version = "4.7.2" +dependencies = [ + "log", + "udev", +] + [[package]] name = "downcast-rs" version = "1.2.0" @@ -2275,12 +2287,6 @@ dependencies = [ "syn 2.0.31", ] -[[package]] -name = "numtoa" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f" - [[package]] name = "objc" version = "0.2.7" @@ -2714,6 +2720,7 @@ name = "rog_anime" version = "4.7.2" dependencies = [ "cargo-husky", + "dmi_id", "gif", "glam", "log", @@ -2721,7 +2728,6 @@ dependencies = [ "png_pong", "serde", "serde_derive", - "sysfs-class", "typeshare", "zbus", ] @@ -2731,11 +2737,11 @@ name = "rog_aura" version = "4.7.2" dependencies = [ "cargo-husky", + "dmi_id", "log", "ron", "serde", "serde_derive", - "sysfs-class", "typeshare", "zbus", ] @@ -2765,7 +2771,6 @@ dependencies = [ "rusb", "serde", "serde_derive", - "sysfs-class", "typeshare", "udev", "zbus", @@ -3172,15 +3177,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sysfs-class" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1bbcf869732c45a77898f7f61ed6d411dfc37613517e444842f58d428856d1" -dependencies = [ - "numtoa", -] - [[package]] name = "system-deps" version = "6.1.1" diff --git a/Cargo.toml b/Cargo.toml index 01459b64..2692846c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] -members = ["asusctl", "asusd", "asusd-user", "config-traits", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center", "simulators"] -default-members = ["asusctl", "asusd", "asusd-user", "rog-control-center"] +members = ["asusctl", "asusd", "asusd-user", "config-traits", "cpuctl", "dmi-id", "rog-platform", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "rog-control-center", "simulators"] +default-members = ["asusctl", "asusd", "asusd-user", "cpuctl", "rog-control-center"] resolver = "2" [workspace.package] @@ -30,7 +30,6 @@ glam = { version = "^0.22", features = ["serde"] } gumdrop = "^0.8" udev = "^0.7" rusb = "^0.9" -sysfs-class = "^0.1.3" inotify = "^0.10.0" png_pong = "^0.8" diff --git a/asusctl/Cargo.toml b/asusctl/Cargo.toml index ad74ea53..0bf9ae0a 100644 --- a/asusctl/Cargo.toml +++ b/asusctl/Cargo.toml @@ -12,10 +12,10 @@ rog_dbus = { path = "../rog-dbus" } rog_profiles = { path = "../rog-profiles" } rog_platform = { path = "../rog-platform" } asusd = { path = "../asusd" } +dmi_id = { path = "../dmi-id" } gumdrop.workspace = true toml.workspace = true -sysfs-class.workspace = true [dev-dependencies] gif.workspace = true diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index 947426ac..4e048cc3 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -6,6 +6,7 @@ use std::thread::sleep; use anime_cli::{AnimeActions, AnimeCommand}; use aura_cli::{LedPowerCommand1, LedPowerCommand2}; +use dmi_id::DMIID; use gumdrop::{Opt, Options}; use profiles_cli::{FanCurveCommand, ProfileCommand}; use rog_anime::usb::get_anime_type; @@ -77,9 +78,9 @@ fn print_error_help(err: &dyn std::error::Error, supported: Option<&SupportedFun } fn print_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"); + let dmi = DMIID::new().unwrap_or_default(); + let board_name = dmi.board_name; + let prod_family = dmi.product_family; println!("asusctl version: {}", env!("CARGO_PKG_VERSION")); println!(" Product family: {}", prod_family.trim()); println!(" Board name: {}", board_name.trim()); diff --git a/asusd/Cargo.toml b/asusd/Cargo.toml index e0ac5442..9988ed91 100644 --- a/asusd/Cargo.toml +++ b/asusd/Cargo.toml @@ -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 = "*" diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 6ae19222..24336f24 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -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); } diff --git a/asusd/src/lib.rs b/asusd/src/lib.rs index 30ffd70b..c7d6911f 100644 --- a/asusd/src/lib.rs +++ b/asusd/src/lib.rs @@ -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] diff --git a/rog-anime/Cargo.toml b/rog-anime/Cargo.toml index 19779993..36de2783 100644 --- a/rog-anime/Cargo.toml +++ b/rog-anime/Cargo.toml @@ -15,7 +15,7 @@ exclude = ["data"] [features] default = ["dbus", "detect"] dbus = ["zbus"] -detect = ["sysfs-class"] +detect = ["dmi_id"] [lib] name = "rog_anime" @@ -35,7 +35,7 @@ typeshare.workspace = true zbus = { workspace = true, optional = true } -sysfs-class = { workspace = true, optional = true } +dmi_id = { path = "../dmi-id", optional = true } [dev-dependencies] cargo-husky.workspace = true \ No newline at end of file diff --git a/rog-anime/src/usb.rs b/rog-anime/src/usb.rs index 462ccf4e..13cb6b51 100644 --- a/rog-anime/src/usb.rs +++ b/rog-anime/src/usb.rs @@ -10,6 +10,7 @@ use std::str::FromStr; +use dmi_id::DMIID; use serde_derive::{Deserialize, Serialize}; use typeshare::typeshare; #[cfg(feature = "dbus")] @@ -151,8 +152,8 @@ impl FromStr for AnimShutdown { /// The currently known USB device is `19b6`. #[inline] pub fn get_anime_type() -> Result { - let dmi = sysfs_class::DmiId::default(); - let board_name = dmi.board_name()?; + let dmi = DMIID::new().map_err(|_| AnimeError::NoDevice)?; // TODO: better error + let board_name = dmi.board_name; if board_name.contains("GA401I") || board_name.contains("GA401Q") { return Ok(AnimeType::GA401); diff --git a/rog-aura/Cargo.toml b/rog-aura/Cargo.toml index 233c6829..1001b1a7 100644 --- a/rog-aura/Cargo.toml +++ b/rog-aura/Cargo.toml @@ -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] diff --git a/rog-aura/src/aura_detection.rs b/rog-aura/src/aura_detection.rs index b2561a82..637bca39 100644 --- a/rog-aura/src/aura_detection.rs +++ b/rog-aura/src/aura_detection.rs @@ -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; } } diff --git a/rog-control-center/src/widgets/side_panel.rs b/rog-control-center/src/widgets/side_panel.rs index 631de7ad..29c75198 100644 --- a/rog-control-center/src/widgets/side_panel.rs +++ b/rog-control-center/src/widgets/side_panel.rs @@ -39,15 +39,15 @@ impl RogApp { } // TODO: Anime page is not complete - // if self.supported.anime_ctrl.0 { - // ui.separator(); - // if ui - // .selectable_value(page, Page::AnimeMatrix, "AniMe Matrix") - // .clicked() - // { - // *page = Page::AnimeMatrix; - // } - // } + if self.supported.anime_ctrl.0 { + ui.separator(); + if ui + .selectable_value(page, Page::AnimeMatrix, "AniMe Matrix") + .clicked() + { + *page = Page::AnimeMatrix; + } + } ui.separator(); if ui diff --git a/rog-platform/Cargo.toml b/rog-platform/Cargo.toml index 86144bb0..303c1924 100644 --- a/rog-platform/Cargo.toml +++ b/rog-platform/Cargo.toml @@ -11,7 +11,6 @@ rog_profiles = { path = "../rog-profiles" } serde.workspace = true serde_derive.workspace = true zbus.workspace = true -sysfs-class.workspace = true concat-idents.workspace = true udev.workspace = true inotify.workspace = true