mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 01:12:30 -04:00
manager: Implement wifi_power_management_state
This commit is contained in:
parent
36c34fcbda
commit
1c825797be
1 changed files with 13 additions and 3 deletions
|
@ -99,9 +99,19 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
fn wifi_power_management_state(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_power_management_state(&self) -> zbus::fdo::Result<u32> {
|
||||||
Err(zbus::fdo::Error::UnknownProperty(String::from(
|
let output = script_output("/usr/bin/iwconfig", &["wlan0"])
|
||||||
"This property can't currently be read",
|
.await
|
||||||
|
.map_err(anyhow_to_zbus_fdo)?;
|
||||||
|
for line in output.lines() {
|
||||||
|
return Ok(match line.trim() {
|
||||||
|
"Power Management:on" => WifiPowerManagement::Enabled as u32,
|
||||||
|
"Power Management:off" => WifiPowerManagement::Disabled as u32,
|
||||||
|
_ => continue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Err(zbus::fdo::Error::Failed(String::from(
|
||||||
|
"Failed to query power management state",
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue