From 3ec37a4dace256f869a0516ef64b3bc109e10306 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 2 Aug 2023 13:53:15 +1200 Subject: [PATCH] Fix: For anime look for usbraw device before hidraw device Closes #387 --- asusctl/src/anime_cli.rs | 22 +++++++++++++++++----- asusd/src/ctrl_anime/mod.rs | 7 ++++--- asusd/src/ctrl_anime/trait_impls.rs | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/asusctl/src/anime_cli.rs b/asusctl/src/anime_cli.rs index 8973b297..5a7fe63e 100644 --- a/asusctl/src/anime_cli.rs +++ b/asusctl/src/anime_cli.rs @@ -43,15 +43,27 @@ pub enum AnimeActions { pub struct Builtins { #[options(help = "print help message")] pub help: bool, - #[options(meta = "", help = " ")] + #[options( + meta = "", + help = "Default is used if unspecified, " + )] pub boot: AnimBooting, - #[options(meta = "", help = "")] + #[options( + meta = "", + help = "Default is used if unspecified, " + )] pub awake: AnimAwake, - #[options(meta = "", help = "")] + #[options( + meta = "", + help = "Default is used if unspecified, " + )] pub sleep: AnimSleeping, - #[options(meta = "", help = "")] + #[options( + meta = "", + help = "Default is used if unspecified, " + )] pub shutdown: AnimShutdown, - #[options(meta = "", help = "set/apply the animations")] + #[options(meta = "", help = "set/apply the animations ")] pub set: Option, } diff --git a/asusd/src/ctrl_anime/mod.rs b/asusd/src/ctrl_anime/mod.rs index 1dfe6205..b45fd28c 100644 --- a/asusd/src/ctrl_anime/mod.rs +++ b/asusd/src/ctrl_anime/mod.rs @@ -39,6 +39,7 @@ impl Node { match self { Node::Usb(u) => { u.write_bytes(message).ok(); + dbg!(message); } Node::Hid(h) => { h.write_bytes(message).ok(); @@ -65,10 +66,10 @@ impl CtrlAnime { pub fn new(config: AnimeConfig) -> Result { let hid = HidRaw::new("193b").ok(); let usb = USBRaw::new(0x193b).ok(); - let node = if hid.is_some() { - unsafe { Node::Hid(hid.unwrap_unchecked()) } - } else if usb.is_some() { + let node = if usb.is_some() { unsafe { Node::Usb(usb.unwrap_unchecked()) } + } else if hid.is_some() { + unsafe { Node::Hid(hid.unwrap_unchecked()) } } else { return Err(RogError::Anime(AnimeError::NoDevice)); }; diff --git a/asusd/src/ctrl_anime/trait_impls.rs b/asusd/src/ctrl_anime/trait_impls.rs index 82cecb30..47583c34 100644 --- a/asusd/src/ctrl_anime/trait_impls.rs +++ b/asusd/src/ctrl_anime/trait_impls.rs @@ -96,6 +96,7 @@ impl CtrlAnimeZbus { enabled: bool, ) { let mut lock = self.0.lock().await; + dbg!("LOOOOOOOOOOCKEDDD"); lock.node .write_bytes(&pkt_set_enable_powersave_anim(enabled)) .map_err(|err| {