Add steamosctl.

Add a second binary which is a command-line utility to get and set
the properties of the DBus api.
Add commands to set wifi debug mode and backend.
This commit is contained in:
Jeremy Whiting 2024-04-25 15:28:15 -06:00
parent c3011c93aa
commit 8788e99245
6 changed files with 327 additions and 30 deletions

140
src/proxy.rs Normal file
View file

@ -0,0 +1,140 @@
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.Manager`
//! and `com.steampowered.SteamOSManager1.Subprocess`
//!
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
//! Source: `com.steampowered.SteamOSManager1.xml`.
//!
//! You may prefer to adapt it, instead of using it verbatim.
//!
//! More information can be found in the [Writing a client proxy] section of the zbus
//! documentation.
//!
//!
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(
default_service = "com.steampowered.SteamOSManager1",
default_path = "/com/steampowered/SteamOSManager1",
interface = "com.steampowered.SteamOSManager1.Manager"
)]
trait Manager {
/// FormatDevice method
fn format_device(
&self,
device: &str,
label: &str,
validate: bool,
) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
/// GetAlsIntegrationTimeFileDescriptor method
fn get_als_integration_time_file_descriptor(&self) -> zbus::Result<zbus::zvariant::OwnedFd>;
/// PrepareFactoryReset method
fn prepare_factory_reset(&self) -> zbus::Result<u32>;
/// SetWifiDebugMode method
fn set_wifi_debug_mode(&self, mode: u32, buffer_size: u32) -> zbus::Result<()>;
/// TrimDevices method
fn trim_devices(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
/// UpdateBIOS method
fn update_bios(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
/// UpdateDock method
fn update_dock(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
/// AlsCalibrationGain property
#[zbus(property)]
fn als_calibration_gain(&self) -> zbus::Result<f64>;
/// FanControlState property
#[zbus(property)]
fn fan_control_state(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_fan_control_state(&self, value: u32) -> zbus::Result<()>;
/// GpuPerformanceLevel property
#[zbus(property)]
fn gpu_performance_level(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_gpu_performance_level(&self, value: u32) -> zbus::Result<()>;
/// HardwareCurrentlySupported property
#[zbus(property)]
fn hardware_currently_supported(&self) -> zbus::Result<u32>;
/// ManualGpuClock property
#[zbus(property)]
fn manual_gpu_clock(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_manual_gpu_clock(&self, value: u32) -> zbus::Result<()>;
/// ManualGpuClockMax property
#[zbus(property)]
fn manual_gpu_clock_max(&self) -> zbus::Result<u32>;
/// ManualGpuClockMin property
#[zbus(property)]
fn manual_gpu_clock_min(&self) -> zbus::Result<u32>;
/// TdpLimit property
#[zbus(property)]
fn tdp_limit(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_tdp_limit(&self, value: u32) -> zbus::Result<()>;
/// TdpLimitMax property
#[zbus(property)]
fn tdp_limit_max(&self) -> zbus::Result<u32>;
/// TdpLimitMin property
#[zbus(property)]
fn tdp_limit_min(&self) -> zbus::Result<u32>;
/// Version property
#[zbus(property)]
fn version(&self) -> zbus::Result<u32>;
/// WifiBackend property
#[zbus(property)]
fn wifi_backend(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_wifi_backend(&self, value: u32) -> zbus::Result<()>;
/// WifiDebugModeState property
#[zbus(property)]
fn wifi_debug_mode_state(&self) -> zbus::Result<u32>;
/// WifiPowerManagementState property
#[zbus(property)]
fn wifi_power_management_state(&self) -> zbus::Result<u32>;
#[zbus(property)]
fn set_wifi_power_management_state(&self, value: u32) -> zbus::Result<()>;
}
#[proxy(
interface = "com.steampowered.SteamOSManager1.SubProcess",
assume_defaults = true
)]
trait SubProcess {
/// Cancel method
fn cancel(&self) -> zbus::Result<()>;
/// ExitCode method
fn exit_code(&self) -> zbus::Result<i32>;
/// WaitForExitCode method
fn wait_for_exit_code(&self) -> zbus::Result<i32>;
/// Kill method
fn kill(&self) -> zbus::Result<()>;
/// Pause method
fn pause(&self) -> zbus::Result<()>;
/// Resume method
fn resume(&self) -> zbus::Result<()>;
}