From d8b689ae50fff1f2ee6128a328f4d50b6e1b6519 Mon Sep 17 00:00:00 2001 From: Jeremy Whiting Date: Mon, 29 Apr 2024 22:45:09 -0600 Subject: [PATCH] Add set commands for tdp limit, gpu performance, etc. Also GPU manual clock and wifi power management state. Some of these aren't currently working on latest main image but it seems some of the sysfs paths have changed somehow... --- src/bin/steamosctl.rs | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/bin/steamosctl.rs b/src/bin/steamosctl.rs index 4217952..91175b5 100644 --- a/src/bin/steamosctl.rs +++ b/src/bin/steamosctl.rs @@ -27,6 +27,33 @@ struct Args { #[derive(Subcommand)] enum Commands { + SetFanControlState { + // Set the fan control state. + // 0 - BIOS, 1 - OS + #[arg(short, long)] + value: u32, + }, + + SetGPUPerformanceLevel { + // Set the gpu performance level + // 0 = Auto, 1 = Low, 2 = High, 3 = Manual, 4 = Profile Peak + #[arg(short, long)] + value: u32, + }, + + SetManualGPUClock { + // Set the GPU clock value manually + // Controls the GPU clock frequency in MHz when GPUPerformanceLevel is set to Manual + #[arg(short, long)] + value: u32, + }, + + SetTDPLimit { + // Set the TDP limit + #[arg(short, long)] + value: u32, + }, + SetWifiBackend { // Set the wifi backend to given string if possible // Supported values are iwd|wpa_supplicant @@ -40,6 +67,13 @@ enum Commands { #[arg(short, long)] mode: u32, }, + + SetWifiPowerManagementState { + // Set the wifi power management state + // 0 - disabled, 1 - enabled + #[arg(short, long)] + value: u32, + }, } #[tokio::main] @@ -73,6 +107,18 @@ async fn main() -> Result<()> { // Then process arguments match &args.command { + Some(Commands::SetFanControlState { value }) => { + proxy.set_fan_control_state(*value).await?; + } + Some(Commands::SetGPUPerformanceLevel { value }) => { + proxy.set_gpu_performance_level(*value).await?; + } + Some(Commands::SetManualGPUClock { value }) => { + proxy.set_manual_gpu_clock(*value).await?; + } + Some(Commands::SetTDPLimit { value }) => { + proxy.set_tdp_limit(*value).await?; + } Some(Commands::SetWifiBackend { backend }) => match WifiBackend::from_str(backend) { Ok(b) => { proxy.set_wifi_backend(b as u32).await?; @@ -84,6 +130,9 @@ async fn main() -> Result<()> { Some(Commands::SetWifiDebugMode { mode }) => { proxy.set_wifi_debug_mode(*mode, 20000).await?; } + Some(Commands::SetWifiPowerManagementState { value }) => { + proxy.set_wifi_power_management_state(*value).await?; + } None => {} }