mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-16 03:06:47 -04:00
Rework the CPUGovernors enum a bit.
Change to CPUScalingGovernors and use strum crate to remove some cruft.
This commit is contained in:
parent
c75c50762d
commit
93e153079d
8 changed files with 126 additions and 150 deletions
|
@ -11,7 +11,7 @@ use itertools::Itertools;
|
|||
use std::ops::Deref;
|
||||
use steamos_manager::cec::HdmiCecState;
|
||||
use steamos_manager::hardware::FanControlState;
|
||||
use steamos_manager::power::{CPUGovernor, GPUPerformanceLevel, GPUPowerProfile};
|
||||
use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile};
|
||||
use steamos_manager::proxy::ManagerProxy;
|
||||
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
||||
use zbus::fdo::PropertiesProxy;
|
||||
|
@ -45,16 +45,16 @@ enum Commands {
|
|||
/// Get the fan control state
|
||||
GetFanControlState,
|
||||
|
||||
/// Get the CPU governors supported on this device
|
||||
GetCpuGovernors,
|
||||
/// Get the available CPU scaling governors supported on this device
|
||||
GetAvailableCpuScalingGovernors,
|
||||
|
||||
/// Get the current CPU governor
|
||||
GetCpuGovernor,
|
||||
GetCpuScalingGovernor,
|
||||
|
||||
/// Set the current CPU governor
|
||||
SetCpuGovernor {
|
||||
/// Set the current CPU Scaling governor
|
||||
SetCpuScalingGovernor {
|
||||
/// Valid governors are get-cpu-governors.
|
||||
governor: CPUGovernor,
|
||||
governor: CPUScalingGovernor,
|
||||
},
|
||||
|
||||
/// Get the GPU power profiles supported on this device
|
||||
|
@ -215,29 +215,27 @@ async fn main() -> Result<()> {
|
|||
Err(_) => println!("Got unknown value {state} from backend"),
|
||||
}
|
||||
}
|
||||
Commands::GetCpuGovernors => {
|
||||
let governors = proxy.cpu_governors().await?;
|
||||
Commands::GetAvailableCpuScalingGovernors => {
|
||||
let governors = proxy.available_cpu_scaling_governors().await?;
|
||||
println!("Governors:\n");
|
||||
for key in governors.keys().sorted() {
|
||||
let name = &governors[key];
|
||||
println!("{key}: {name}");
|
||||
for name in governors {
|
||||
println!("{name}");
|
||||
}
|
||||
}
|
||||
Commands::GetCpuGovernor => {
|
||||
let governor = proxy.cpu_governor().await?;
|
||||
let governor_type = CPUGovernor::try_from(governor);
|
||||
Commands::GetCpuScalingGovernor => {
|
||||
let governor = proxy.cpu_scaling_governor().await?;
|
||||
let governor_type = CPUScalingGovernor::try_from(governor.as_str());
|
||||
match governor_type {
|
||||
Ok(t) => {
|
||||
let name = t.to_string();
|
||||
println!("CPU Governor: {governor} {name}");
|
||||
Ok(_) => {
|
||||
println!("CPU Governor: {governor}");
|
||||
}
|
||||
Err(_) => {
|
||||
println!("Unknown CPU governor or unable to get type from {governor}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Commands::SetCpuGovernor { governor } => {
|
||||
proxy.set_cpu_governor(*governor as u32).await?;
|
||||
Commands::SetCpuScalingGovernor { governor } => {
|
||||
proxy.set_cpu_scaling_governor(governor.to_string()).await?;
|
||||
}
|
||||
Commands::GetGPUPowerProfiles => {
|
||||
let profiles = proxy.gpu_power_profiles().await?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue