Skip to content

Commit

Permalink
fix(ROG Ally/X): Wait for driver init
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaq committed Aug 9, 2024
1 parent 3a8dd81 commit 09004b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/drivers/rog_ally/driver.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{error::Error, ffi::OsStr};
use std::{error::Error, ffi::OsStr, time::Duration};

use udev::Device;

Expand All @@ -21,6 +21,11 @@ impl Driver {
if VID != vid || !PIDS.contains(&pid) {
return Err(format!("'{}' is not an ROG Ally controller", udevice.devnode()).into());
}
// TODO: When resuming from sleep, if mcu_powersave is set, the device init takes longer.
// inotify will trigger this driver before the attribute tree is fully built and the driver
// will error and exit, leaving some controls unusable. We should find a way to only
// trigger this driver or continue processing once we know the driver has fully init.
std::thread::sleep(Duration::from_millis(300));

// Set the controller buttons to the correct values at startup
let device = udevice.get_device()?;
Expand Down

0 comments on commit 09004b8

Please sign in to comment.