diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index 0b94fde5..c665a77f 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -223,7 +223,7 @@ fn main() -> Result<(), Box> { if parsed.show_supported { let dat = dbus.proxies().supported().get_supported_functions()?; - println!("Supported laptop functions:\n{:?}", dat); + println!("Supported laptop functions:\n\n{}", dat); } if let Some(chg_limit) = parsed.chg_limit { diff --git a/rog-types/src/supported.rs b/rog-types/src/supported.rs index cca29c12..150b727a 100644 --- a/rog-types/src/supported.rs +++ b/rog-types/src/supported.rs @@ -1,6 +1,7 @@ use rog_aura::AuraModeNum; use serde_derive::{Deserialize, Serialize}; use zvariant_derive::Type; +use std::fmt; #[derive(Serialize, Deserialize, Type, Debug)] pub struct SupportedFunctions { @@ -39,3 +40,50 @@ pub struct RogBiosSupportedFunctions { pub post_sound_toggle: bool, pub dedicated_gfx_toggle: bool, } + +impl fmt::Display for SupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "{}", self.anime_ctrl)?; + writeln!(f, "{}", self.charge_ctrl)?; + writeln!(f, "{}", self.fan_cpu_ctrl)?; + writeln!(f, "{}", self.keyboard_led)?; + writeln!(f, "{}", self.rog_bios_ctrl) + } +} + +impl fmt::Display for AnimeSupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "AniMe Matrix:")?; + writeln!(f, "\tAnime Matrix control: {}", self.0) + } +} +impl fmt::Display for ChargeSupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "Charge:")?; + writeln!(f, "\tBattery charge limit control: {}", self.charge_level_set) + } +} +impl fmt::Display for FanCpuSupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "Fan:")?; + writeln!(f, "\tStock fan modes: {}", self.stock_fan_modes)?; + writeln!(f, "\tMin/max frequency: {}", self.min_max_freq)?; + writeln!(f, "\tFan curve control: {}", self.fan_curve_set) + } +} +impl fmt::Display for LedSupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "LED:")?; + writeln!(f, "\tBrightness control: {}", self.brightness_set)?; + writeln!(f, "\tStock LED modes: {:?}", self.stock_led_modes)?; + writeln!(f, "\tMultizone LED mode: {}", self.multizone_led_mode)?; + writeln!(f, "\tPer key LED mode: {}", self.per_key_led_mode) + } +} +impl fmt::Display for RogBiosSupportedFunctions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "ROG BIOS:")?; + writeln!(f, "\tPOST sound toggle: {}", self.post_sound_toggle)?; + writeln!(f, "\tDedicated GFX toggle: {}", self.dedicated_gfx_toggle) + } +} \ No newline at end of file