mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
rog-platform: add power (basics)
- Refactor the macros - Add inotify creator for each attribute
This commit is contained in:
@@ -17,8 +17,10 @@ use crate::{
|
||||
/// - dgpu_only
|
||||
/// - keyboard_mode, set keyboard RGB mode and speed
|
||||
/// - keyboard_state, set keyboard power states
|
||||
#[derive(Debug, PartialEq, PartialOrd)]
|
||||
pub struct AsusPlatform(PathBuf);
|
||||
#[derive(Debug, PartialEq, PartialOrd, Clone)]
|
||||
pub struct AsusPlatform {
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl AsusPlatform {
|
||||
pub fn new() -> Result<Self> {
|
||||
@@ -39,35 +41,19 @@ impl AsusPlatform {
|
||||
warn!("{}", err);
|
||||
PlatformError::Udev("scan_devices failed".into(), err)
|
||||
})? {
|
||||
return Ok(Self(device.syspath().to_owned()));
|
||||
return Ok(Self {
|
||||
path: device.syspath().to_owned(),
|
||||
});
|
||||
}
|
||||
Err(PlatformError::MissingFunction(
|
||||
"asus-nb-wmi not found".into(),
|
||||
))
|
||||
}
|
||||
|
||||
attr_bool!(
|
||||
has_dgpu_disable,
|
||||
get_dgpu_disable,
|
||||
set_dgpu_disable,
|
||||
"dgpu_disable"
|
||||
);
|
||||
|
||||
attr_bool!(
|
||||
has_egpu_enable,
|
||||
get_egpu_enable,
|
||||
set_egpu_enable,
|
||||
"egpu_enable"
|
||||
);
|
||||
|
||||
attr_bool!(has_panel_od, get_panel_od, set_panel_od, "panel_od");
|
||||
|
||||
attr_u8!(
|
||||
has_gpu_mux_mode,
|
||||
get_gpu_mux_mode,
|
||||
set_gpu_mux_mode,
|
||||
"gpu_mux_mode"
|
||||
);
|
||||
attr_bool!("dgpu_disable", path);
|
||||
attr_bool!("egpu_enable", path);
|
||||
attr_bool!("panel_od", path);
|
||||
attr_u8!("gpu_mux_mode", path);
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Type, Debug, PartialEq, Clone, Copy)]
|
||||
|
||||
Reference in New Issue
Block a user