steamosctl: Fix up documentation and remove extraneous flag syntax

This commit is contained in:
Vicki Pfau 2024-05-10 17:10:43 -07:00
parent 8b195ebf4a
commit bfcdf96301

View file

@ -28,88 +28,112 @@ struct Args {
#[derive(Subcommand)] #[derive(Subcommand)]
enum Commands { enum Commands {
/// Get luminance sensor calibration gain
GetAlsCalibrationGain {}, GetAlsCalibrationGain {},
/// Get if the hardware is currently supported
GetHardwareCurrentlySupported {}, GetHardwareCurrentlySupported {},
/// Set the fan control state
SetFanControlState { SetFanControlState {
// Set the fan control state. /// 0 - BIOS, 1 - OS
// 0 - BIOS, 1 - OS state: u32,
#[arg(short, long)]
value: u32,
}, },
/// Get the fan control state
GetFanControlState {}, GetFanControlState {},
/// Set the GPU performance level
SetGPUPerformanceLevel { SetGPUPerformanceLevel {
// Set the gpu performance level /// 0 = Auto, 1 = Low, 2 = High, 3 = Manual, 4 = Profile Peak
// 0 = Auto, 1 = Low, 2 = High, 3 = Manual, 4 = Profile Peak level: u32,
#[arg(short, long)]
value: u32,
}, },
/// Get the GPU performance level
GetGPUPerformanceLevel {}, GetGPUPerformanceLevel {},
/// Set the GPU clock value manually. Only works when performance level is set to Manual
SetManualGPUClock { SetManualGPUClock {
// Set the GPU clock value manually /// GPU clock frequency in MHz
// Controls the GPU clock frequency in MHz when GPUPerformanceLevel is set to Manual freq: u32,
#[arg(short, long)]
value: u32,
}, },
/// Get the GPU clock frequency, in MHz. Only works when performance level is set to Manual
GetManualGPUClock {}, GetManualGPUClock {},
/// Get the maximum allowed GPU clock frequency for the Manual performance level
GetManualGPUClockMax {}, GetManualGPUClockMax {},
/// Get the minimum allowed GPU clock frequency for the Manual performance level
GetManualGPUClockMin {}, GetManualGPUClockMin {},
/// Set the TDP limit
SetTDPLimit { SetTDPLimit {
// Set the TDP limit /// TDP limit, in W
#[arg(short, long)] limit: u32,
value: u32,
}, },
/// Get the TDP limit
GetTDPLimit {}, GetTDPLimit {},
/// Get the maximum allowed TDP limit
GetTDPLimitMax {}, GetTDPLimitMax {},
/// Get the minimum allowed TDP limit
GetTDPLimitMin {}, GetTDPLimitMin {},
/// Get the current API version
GetVersion {}, GetVersion {},
/// Set the wifi backend if possible
SetWifiBackend { SetWifiBackend {
// Set the wifi backend to given string if possible /// Supported backends are iwd, wpa_supplicant
// Supported values are iwd|wpa_supplicant
#[arg(short, long)]
backend: String, backend: String,
}, },
/// Get the wifi backend
GetWifiBackend {}, GetWifiBackend {},
/// Set wifi debug mode
SetWifiDebugMode { SetWifiDebugMode {
// Set wifi debug mode to given value /// 1 for on, 0 for off
// 1 for on, 0 for off currently
#[arg(short, long)]
mode: u32, mode: u32,
/// The size of the debug buffer, in bytes
#[arg(default_value_t = 20000)]
buffer: u32,
}, },
/// Get wifi debug mode
GetWifiDebugMode {}, GetWifiDebugMode {},
/// Set the wifi power management state
SetWifiPowerManagementState { SetWifiPowerManagementState {
// Set the wifi power management state /// 0 - disabled, 1 - enabled
// 0 - disabled, 1 - enabled state: u32,
#[arg(short, long)]
value: u32,
}, },
/// Get the wifi power management state
GetWifiPowerManagementState {}, GetWifiPowerManagementState {},
/// Get the state of HDMI-CEC support
GetHdmiCecState {}, GetHdmiCecState {},
/// Set the state of HDMI-CEC support
SetHdmiCecState { SetHdmiCecState {
// Set the state of HDMI-CEC support /// 0 - disabled, 1 - only controls, 2 - Controls and TV waking
// 0 - disabled, 1 - only controls, 2 - TV waking state: u32,
#[arg(short, long)]
value: u32,
}, },
/// Update the BIOS, if possible
UpdateBios {}, UpdateBios {},
/// Update the dock, if possible
UpdateDock {}, UpdateDock {},
/// Trim applicable drives
TrimDevices {}, TrimDevices {},
/// Factory reset the device
FactoryReset {}, FactoryReset {},
} }
@ -156,18 +180,18 @@ async fn main() -> Result<()> {
let version = proxy.version().await?; let version = proxy.version().await?;
println!("Version: {version}"); println!("Version: {version}");
} }
Some(Commands::SetFanControlState { value }) => { Some(Commands::SetFanControlState { state }) => {
proxy.set_fan_control_state(*value).await?; proxy.set_fan_control_state(*state).await?;
} }
Some(Commands::SetGPUPerformanceLevel { value }) => { Some(Commands::SetGPUPerformanceLevel { level }) => {
proxy.set_gpu_performance_level(*value).await?; proxy.set_gpu_performance_level(*level).await?;
} }
Some(Commands::GetGPUPerformanceLevel {}) => { Some(Commands::GetGPUPerformanceLevel {}) => {
let level = proxy.gpu_performance_level().await?; let level = proxy.gpu_performance_level().await?;
println!("GPU performance level: {level}"); println!("GPU performance level: {level}");
} }
Some(Commands::SetManualGPUClock { value }) => { Some(Commands::SetManualGPUClock { freq }) => {
proxy.set_manual_gpu_clock(*value).await?; proxy.set_manual_gpu_clock(*freq).await?;
} }
Some(Commands::GetManualGPUClock {}) => { Some(Commands::GetManualGPUClock {}) => {
let clock = proxy.manual_gpu_clock().await?; let clock = proxy.manual_gpu_clock().await?;
@ -181,8 +205,8 @@ async fn main() -> Result<()> {
let value = proxy.manual_gpu_clock_min().await?; let value = proxy.manual_gpu_clock_min().await?;
println!("Manual GPU Clock Min: {value}"); println!("Manual GPU Clock Min: {value}");
} }
Some(Commands::SetTDPLimit { value }) => { Some(Commands::SetTDPLimit { limit }) => {
proxy.set_tdp_limit(*value).await?; proxy.set_tdp_limit(*limit).await?;
} }
Some(Commands::GetTDPLimit {}) => { Some(Commands::GetTDPLimit {}) => {
let limit = proxy.tdp_limit().await?; let limit = proxy.tdp_limit().await?;
@ -213,22 +237,22 @@ async fn main() -> Result<()> {
let backend_string = WifiBackend::try_from(backend).unwrap().to_string(); let backend_string = WifiBackend::try_from(backend).unwrap().to_string();
println!("Wifi backend: {backend_string}"); println!("Wifi backend: {backend_string}");
} }
Some(Commands::SetWifiDebugMode { mode }) => { Some(Commands::SetWifiDebugMode { mode, buffer }) => {
proxy.set_wifi_debug_mode(*mode, 20000).await?; proxy.set_wifi_debug_mode(*mode, *buffer).await?;
} }
Some(Commands::GetWifiDebugMode {}) => { Some(Commands::GetWifiDebugMode {}) => {
let mode = proxy.wifi_debug_mode_state().await?; let mode = proxy.wifi_debug_mode_state().await?;
println!("Wifi debug mode: {mode}"); println!("Wifi debug mode: {mode}");
} }
Some(Commands::SetWifiPowerManagementState { value }) => { Some(Commands::SetWifiPowerManagementState { state }) => {
proxy.set_wifi_power_management_state(*value).await?; proxy.set_wifi_power_management_state(*state).await?;
} }
Some(Commands::GetWifiPowerManagementState {}) => { Some(Commands::GetWifiPowerManagementState {}) => {
let state = proxy.wifi_power_management_state().await?; let state = proxy.wifi_power_management_state().await?;
println!("Wifi power management state: {state}"); println!("Wifi power management state: {state}");
} }
Some(Commands::SetHdmiCecState { value }) => { Some(Commands::SetHdmiCecState { state }) => {
proxy.set_hdmi_cec_state(*value).await?; proxy.set_hdmi_cec_state(*state).await?;
} }
Some(Commands::GetHdmiCecState {}) => { Some(Commands::GetHdmiCecState {}) => {
let state = proxy.hdmi_cec_state().await?; let state = proxy.hdmi_cec_state().await?;