Fix: For anime look for usbraw device before hidraw device

Closes #387
This commit is contained in:
Luke D. Jones
2023-08-02 13:53:15 +12:00
parent 11483b28a6
commit 3ec37a4dac
3 changed files with 22 additions and 8 deletions

View File

@@ -43,15 +43,27 @@ pub enum AnimeActions {
pub struct Builtins { pub struct Builtins {
#[options(help = "print help message")] #[options(help = "print help message")]
pub help: bool, pub help: bool,
#[options(meta = "", help = " <GlitchConstruction, StaticEmergence>")] #[options(
meta = "",
help = "Default is used if unspecified, <default:GlitchConstruction, StaticEmergence>"
)]
pub boot: AnimBooting, pub boot: AnimBooting,
#[options(meta = "", help = "<BinaryBannerScroll, RogLogoGlitch>")] #[options(
meta = "",
help = "Default is used if unspecified, <default:BinaryBannerScroll, RogLogoGlitch>"
)]
pub awake: AnimAwake, pub awake: AnimAwake,
#[options(meta = "", help = "<BannerSwipe, Starfield>")] #[options(
meta = "",
help = "Default is used if unspecified, <default:BannerSwipe, Starfield>"
)]
pub sleep: AnimSleeping, pub sleep: AnimSleeping,
#[options(meta = "", help = "<GlitchOut, SeeYa>")] #[options(
meta = "",
help = "Default is used if unspecified, <default:GlitchOut, SeeYa>"
)]
pub shutdown: AnimShutdown, pub shutdown: AnimShutdown,
#[options(meta = "", help = "set/apply the animations")] #[options(meta = "", help = "set/apply the animations <true/false>")]
pub set: Option<bool>, pub set: Option<bool>,
} }

View File

@@ -39,6 +39,7 @@ impl Node {
match self { match self {
Node::Usb(u) => { Node::Usb(u) => {
u.write_bytes(message).ok(); u.write_bytes(message).ok();
dbg!(message);
} }
Node::Hid(h) => { Node::Hid(h) => {
h.write_bytes(message).ok(); h.write_bytes(message).ok();
@@ -65,10 +66,10 @@ impl CtrlAnime {
pub fn new(config: AnimeConfig) -> Result<CtrlAnime, RogError> { pub fn new(config: AnimeConfig) -> Result<CtrlAnime, RogError> {
let hid = HidRaw::new("193b").ok(); let hid = HidRaw::new("193b").ok();
let usb = USBRaw::new(0x193b).ok(); let usb = USBRaw::new(0x193b).ok();
let node = if hid.is_some() { let node = if usb.is_some() {
unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else if usb.is_some() {
unsafe { Node::Usb(usb.unwrap_unchecked()) } unsafe { Node::Usb(usb.unwrap_unchecked()) }
} else if hid.is_some() {
unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else { } else {
return Err(RogError::Anime(AnimeError::NoDevice)); return Err(RogError::Anime(AnimeError::NoDevice));
}; };

View File

@@ -96,6 +96,7 @@ impl CtrlAnimeZbus {
enabled: bool, enabled: bool,
) { ) {
let mut lock = self.0.lock().await; let mut lock = self.0.lock().await;
dbg!("LOOOOOOOOOOCKEDDD");
lock.node lock.node
.write_bytes(&pkt_set_enable_powersave_anim(enabled)) .write_bytes(&pkt_set_enable_powersave_anim(enabled))
.map_err(|err| { .map_err(|err| {