From 4468a584877934304722b2b1a59d3c415823eab6 Mon Sep 17 00:00:00 2001 From: "jochen@g14" Date: Sun, 31 Mar 2024 00:34:44 +0100 Subject: [PATCH] Use enable/disable commands and cleanup build warnings --- asusctl/src/aura_cli.rs | 1 - asusctl/src/main.rs | 12 ++++++++---- asusctl/src/slash_cli.rs | 12 +++++++----- asusd/src/ctrl_aura/manager.rs | 1 - asusd/src/ctrl_slash/mod.rs | 5 ++--- rog-control-center/src/main.rs | 2 +- rog-slash/src/data.rs | 1 - 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/asusctl/src/aura_cli.rs b/asusctl/src/aura_cli.rs index eea3af0b..28cc3b89 100644 --- a/asusctl/src/aura_cli.rs +++ b/asusctl/src/aura_cli.rs @@ -1,4 +1,3 @@ -use std::fmt::Display; use std::str::FromStr; use gumdrop::Options; diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index 8cb75df1..51f3b095 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -485,11 +485,12 @@ fn handle_slash( cmd: &SlashCommand, ) -> Result<(), Box> { if ( - cmd.enabled.is_none() && cmd.brightness.is_none() && cmd.interval.is_none() && cmd.slash_mode.is_none() && - !cmd.list + !cmd.list && + !cmd.enable && + !cmd.disable ) || cmd.help { println!("Missing arg or command\n\n{}", cmd.self_usage()); @@ -497,8 +498,11 @@ fn handle_slash( println!("\n{}", lst); } } - if let Some(enabled) = cmd.enabled { - dbus.proxies().slash().set_enabled(enabled)?; + if cmd.enable { + dbus.proxies().slash().set_enabled(true)?; + } + if cmd.disable { + dbus.proxies().slash().set_enabled(false)?; } if let Some(brightness) = cmd.brightness { dbus.proxies().slash().set_brightness(brightness)?; diff --git a/asusctl/src/slash_cli.rs b/asusctl/src/slash_cli.rs index a2638c47..0c9d42d1 100644 --- a/asusctl/src/slash_cli.rs +++ b/asusctl/src/slash_cli.rs @@ -5,13 +5,15 @@ use rog_slash::SlashMode; pub struct SlashCommand { #[options(help = "print help message")] pub help: bool, - #[options(meta = "", help = "enable/disable the display")] - pub enabled: Option, - #[options(meta = "", help = "set brightness value <0-255>")] + #[options(help = "Enable the Slash Ledbar")] + pub enable: bool, + #[options(help = "Ddisable the Slash Ledbar")] + pub disable: bool, + #[options(meta = "", help = "Set brightness value <0-255>")] pub brightness: Option, - #[options(meta = "", help = "set interval value <0-255>")] + #[options(meta = "", help = "Set interval value <0-255>")] pub interval: Option, - #[options(help = "Set the SlashMode")] + #[options(help = "Set SlashMode (so 'list' for all options)")] pub slash_mode: Option, #[options(help = "list available animations")] pub list: bool, diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 54130edf..5c45a263 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -5,7 +5,6 @@ // - If udev sees device removed then remove the zbus path use std::collections::HashSet; -use std::time::Duration; use log::{debug, error, info, warn}; use mio::{Events, Interest, Poll, Token}; diff --git a/asusd/src/ctrl_slash/mod.rs b/asusd/src/ctrl_slash/mod.rs index 65b10983..e8de6017 100644 --- a/asusd/src/ctrl_slash/mod.rs +++ b/asusd/src/ctrl_slash/mod.rs @@ -33,7 +33,7 @@ pub struct CtrlSlash { // node: HidRaw, node: Node, config: SlashConfig, - slash_type: SlashType, + // slash_type: SlashType, // // set to force thread to exit // thread_exit: Arc, // // Set to false when the thread exits @@ -53,7 +53,6 @@ impl CtrlSlash { return Err(RogError::NotSupported); }; - // Maybe, detecting the slash-type may become necessary let slash_type = get_slash_type()?; if slash_type == SlashType::Unknown { return Err(RogError::Slash(SlashError::NoDevice)); @@ -62,7 +61,7 @@ impl CtrlSlash { let ctrl = CtrlSlash { node, config, - slash_type, + // slash_type, // thread_exit: Arc::new(AtomicBool::new(false)), // thread_running: Arc::new(AtomicBool::new(false)), }; diff --git a/rog-control-center/src/main.rs b/rog-control-center/src/main.rs index 69589382..f9cd9be9 100644 --- a/rog-control-center/src/main.rs +++ b/rog-control-center/src/main.rs @@ -32,7 +32,7 @@ fn main() -> Result<()> { let board_name = dmi.board_name; let prod_family = dmi.product_family; info!("Running on {board_name}, product: {prod_family}"); - let is_rog_ally = prod_family == "RC71L"; + // let is_rog_ally = prod_family == "RC71L"; // tmp-dir must live to the end of program life let _tmp_dir = tempfile::Builder::new() diff --git a/rog-slash/src/data.rs b/rog-slash/src/data.rs index 5d1e11f3..1cbe4458 100644 --- a/rog-slash/src/data.rs +++ b/rog-slash/src/data.rs @@ -1,4 +1,3 @@ -use std::any::Any; use std::fmt::Display; use std::str::FromStr;