mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-09 16:10:34 -04:00
manager: Implement fan_control_state
This commit is contained in:
parent
853ce3dd84
commit
406988fbdf
2 changed files with 15 additions and 4 deletions
|
@ -128,10 +128,17 @@ impl SteamOSManager {
|
|||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn fan_control_state(&self) -> zbus::fdo::Result<u32> {
|
||||
Err(zbus::fdo::Error::UnknownProperty(String::from(
|
||||
"This property can't currently be read",
|
||||
)))
|
||||
async fn fan_control_state(&self) -> zbus::fdo::Result<u32> {
|
||||
let jupiter_fan_control =
|
||||
SystemdUnit::new(self.connection.clone(), "jupiter_2dfan_2dcontrol_2eservice")
|
||||
.await
|
||||
.map_err(anyhow_to_zbus_fdo)?;
|
||||
let active = jupiter_fan_control.active().await
|
||||
.map_err(anyhow_to_zbus_fdo)?;
|
||||
Ok(match active {
|
||||
true => FanControl::OS as u32,
|
||||
false => FanControl::BIOS as u32,
|
||||
})
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
|
|
|
@ -69,4 +69,8 @@ impl<'dbus> SystemdUnit<'dbus> {
|
|||
self.proxy.stop("fail").await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn active(&self) -> Result<bool> {
|
||||
Ok(self.proxy.active_state().await? == "active")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue