Fix: force Anime power/wakeup disabled to prevent idiotic random wakes

This commit is contained in:
Luke D. Jones
2023-12-15 19:15:14 +13:00
parent 9aa332de3b
commit 75b4d67072
6 changed files with 65 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ use std::io::Write;
use std::path::PathBuf;
use log::{info, warn};
use udev::Device;
use crate::error::{PlatformError, Result};
@@ -88,4 +89,10 @@ impl HidRaw {
file.write_all(message)
.map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))
}
pub fn set_wakeup_disabled(&self) -> Result<()> {
let path = unsafe { &*(self.path.get()) };
let mut dev = Device::from_syspath(path)?;
Ok(dev.set_attribute_value("power/wakeup", "disabled")?)
}
}