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...
This commit is contained in:
Jeremy Whiting 2024-04-29 22:45:09 -06:00
parent 6e8e36b053
commit d8b689ae50

View file

@ -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 => {}
}