mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 09:22:26 -04:00
Clean up zbus::fdo into fdo where possible
This commit is contained in:
parent
fd500229d6
commit
58223d988b
4 changed files with 59 additions and 60 deletions
|
@ -10,7 +10,7 @@ use anyhow::Result;
|
||||||
use tokio::fs::File;
|
use tokio::fs::File;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::{interface, Connection, SignalContext};
|
use zbus::{fdo, interface, Connection, SignalContext};
|
||||||
|
|
||||||
use crate::error::{to_zbus_error, to_zbus_fdo_error};
|
use crate::error::{to_zbus_error, to_zbus_fdo_error};
|
||||||
use crate::hardware::{check_support, variant, FanControl, FanControlState, HardwareVariant};
|
use crate::hardware::{check_support, variant, FanControl, FanControlState, HardwareVariant};
|
||||||
|
@ -68,7 +68,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn wifi_power_management_state(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_power_management_state(&self) -> fdo::Result<u32> {
|
||||||
match get_wifi_power_management_state().await {
|
match get_wifi_power_management_state().await {
|
||||||
Ok(state) => Ok(state as u32),
|
Ok(state) => Ok(state as u32),
|
||||||
Err(e) => Err(to_zbus_fdo_error(e)),
|
Err(e) => Err(to_zbus_fdo_error(e)),
|
||||||
|
@ -79,7 +79,7 @@ impl SteamOSManager {
|
||||||
async fn set_wifi_power_management_state(&self, state: u32) -> zbus::Result<()> {
|
async fn set_wifi_power_management_state(&self, state: u32) -> zbus::Result<()> {
|
||||||
let state = match WifiPowerManagement::try_from(state) {
|
let state = match WifiPowerManagement::try_from(state) {
|
||||||
Ok(state) => state,
|
Ok(state) => state,
|
||||||
Err(err) => return Err(zbus::fdo::Error::InvalidArgs(err.to_string()).into()),
|
Err(err) => return Err(fdo::Error::InvalidArgs(err.to_string()).into()),
|
||||||
};
|
};
|
||||||
set_wifi_power_management_state(state)
|
set_wifi_power_management_state(state)
|
||||||
.await
|
.await
|
||||||
|
@ -87,7 +87,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn fan_control_state(&self) -> zbus::fdo::Result<u32> {
|
async fn fan_control_state(&self) -> fdo::Result<u32> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.fan_control
|
.fan_control
|
||||||
.get_state()
|
.get_state()
|
||||||
|
@ -99,7 +99,7 @@ impl SteamOSManager {
|
||||||
async fn set_fan_control_state(&self, state: u32) -> zbus::Result<()> {
|
async fn set_fan_control_state(&self, state: u32) -> zbus::Result<()> {
|
||||||
let state = match FanControlState::try_from(state) {
|
let state = match FanControlState::try_from(state) {
|
||||||
Ok(state) => state,
|
Ok(state) => state,
|
||||||
Err(err) => return Err(zbus::fdo::Error::InvalidArgs(err.to_string()).into()),
|
Err(err) => return Err(fdo::Error::InvalidArgs(err.to_string()).into()),
|
||||||
};
|
};
|
||||||
// Run what steamos-polkit-helpers/jupiter-fan-control does
|
// Run what steamos-polkit-helpers/jupiter-fan-control does
|
||||||
self.fan_control
|
self.fan_control
|
||||||
|
@ -109,7 +109,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn hardware_currently_supported(&self) -> zbus::fdo::Result<u32> {
|
async fn hardware_currently_supported(&self) -> fdo::Result<u32> {
|
||||||
match check_support().await {
|
match check_support().await {
|
||||||
Ok(res) => Ok(res as u32),
|
Ok(res) => Ok(res as u32),
|
||||||
Err(e) => Err(to_zbus_fdo_error(e)),
|
Err(e) => Err(to_zbus_fdo_error(e)),
|
||||||
|
@ -133,26 +133,26 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_als_integration_time_file_descriptor(&self) -> zbus::fdo::Result<Fd> {
|
async fn get_als_integration_time_file_descriptor(&self) -> fdo::Result<Fd> {
|
||||||
// Get the file descriptor for the als integration time sysfs path
|
// Get the file descriptor for the als integration time sysfs path
|
||||||
let result = File::create(ALS_INTEGRATION_PATH).await;
|
let result = File::create(ALS_INTEGRATION_PATH).await;
|
||||||
match result {
|
match result {
|
||||||
Ok(f) => Ok(Fd::Owned(std::os::fd::OwnedFd::from(f.into_std().await))),
|
Ok(f) => Ok(Fd::Owned(std::os::fd::OwnedFd::from(f.into_std().await))),
|
||||||
Err(message) => {
|
Err(message) => {
|
||||||
error!("Error opening sysfs file for giving file descriptor: {message}");
|
error!("Error opening sysfs file for giving file descriptor: {message}");
|
||||||
Err(zbus::fdo::Error::IOError(message.to_string()))
|
Err(fdo::Error::IOError(message.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_bios(&mut self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn update_bios(&mut self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
// Update the bios as needed
|
// Update the bios as needed
|
||||||
self.process_manager
|
self.process_manager
|
||||||
.get_command_object_path("/usr/bin/jupiter-biosupdate", &["--auto"], "updating BIOS")
|
.get_command_object_path("/usr/bin/jupiter-biosupdate", &["--auto"], "updating BIOS")
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_dock(&mut self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn update_dock(&mut self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
// Update the dock firmware as needed
|
// Update the dock firmware as needed
|
||||||
self.process_manager
|
self.process_manager
|
||||||
.get_command_object_path(
|
.get_command_object_path(
|
||||||
|
@ -163,7 +163,7 @@ impl SteamOSManager {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn trim_devices(&mut self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn trim_devices(&mut self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
// Run steamos-trim-devices script
|
// Run steamos-trim-devices script
|
||||||
self.process_manager
|
self.process_manager
|
||||||
.get_command_object_path(
|
.get_command_object_path(
|
||||||
|
@ -179,7 +179,7 @@ impl SteamOSManager {
|
||||||
device: &str,
|
device: &str,
|
||||||
label: &str,
|
label: &str,
|
||||||
validate: bool,
|
validate: bool,
|
||||||
) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
let mut args = vec!["--label", label, "--device", device];
|
let mut args = vec!["--label", label, "--device", device];
|
||||||
if !validate {
|
if !validate {
|
||||||
args.push("--skip-validation");
|
args.push("--skip-validation");
|
||||||
|
@ -194,7 +194,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn gpu_performance_level(&self) -> zbus::fdo::Result<u32> {
|
async fn gpu_performance_level(&self) -> fdo::Result<u32> {
|
||||||
match get_gpu_performance_level().await {
|
match get_gpu_performance_level().await {
|
||||||
Ok(level) => Ok(level as u32),
|
Ok(level) => Ok(level as u32),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -217,7 +217,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn manual_gpu_clock(&self) -> zbus::fdo::Result<u32> {
|
async fn manual_gpu_clock(&self) -> fdo::Result<u32> {
|
||||||
get_gpu_clocks()
|
get_gpu_clocks()
|
||||||
.await
|
.await
|
||||||
.inspect_err(|message| error!("Error getting manual GPU clock: {message}"))
|
.inspect_err(|message| error!("Error getting manual GPU clock: {message}"))
|
||||||
|
@ -245,7 +245,7 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn tdp_limit(&self) -> zbus::fdo::Result<u32> {
|
async fn tdp_limit(&self) -> fdo::Result<u32> {
|
||||||
get_tdp_limit().await.map_err(to_zbus_fdo_error)
|
get_tdp_limit().await.map_err(to_zbus_fdo_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,12 +277,12 @@ impl SteamOSManager {
|
||||||
mode: u32,
|
mode: u32,
|
||||||
buffer_size: u32,
|
buffer_size: u32,
|
||||||
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> fdo::Result<()> {
|
||||||
// Set the wifi debug mode to mode, using an int for flexibility going forward but only
|
// Set the wifi debug mode to mode, using an int for flexibility going forward but only
|
||||||
// doing things on 0 or 1 for now
|
// doing things on 0 or 1 for now
|
||||||
let wanted_mode = match WifiDebugMode::try_from(mode) {
|
let wanted_mode = match WifiDebugMode::try_from(mode) {
|
||||||
Ok(mode) => mode,
|
Ok(mode) => mode,
|
||||||
Err(e) => return Err(zbus::fdo::Error::InvalidArgs(e.to_string())),
|
Err(e) => return Err(fdo::Error::InvalidArgs(e.to_string())),
|
||||||
};
|
};
|
||||||
match set_wifi_debug_mode(
|
match set_wifi_debug_mode(
|
||||||
wanted_mode,
|
wanted_mode,
|
||||||
|
@ -306,7 +306,7 @@ impl SteamOSManager {
|
||||||
|
|
||||||
/// WifiBackend property.
|
/// WifiBackend property.
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn wifi_backend(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_backend(&self) -> fdo::Result<u32> {
|
||||||
match get_wifi_backend().await {
|
match get_wifi_backend().await {
|
||||||
Ok(backend) => Ok(backend as u32),
|
Ok(backend) => Ok(backend as u32),
|
||||||
Err(e) => Err(to_zbus_fdo_error(e)),
|
Err(e) => Err(to_zbus_fdo_error(e)),
|
||||||
|
@ -314,15 +314,15 @@ impl SteamOSManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_wifi_backend(&mut self, backend: u32) -> zbus::fdo::Result<()> {
|
async fn set_wifi_backend(&mut self, backend: u32) -> fdo::Result<()> {
|
||||||
if self.wifi_debug_mode == WifiDebugMode::On {
|
if self.wifi_debug_mode == WifiDebugMode::On {
|
||||||
return Err(zbus::fdo::Error::Failed(String::from(
|
return Err(fdo::Error::Failed(String::from(
|
||||||
"operation not supported when wifi_debug_mode=on",
|
"operation not supported when wifi_debug_mode=on",
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
let backend = match WifiBackend::try_from(backend) {
|
let backend = match WifiBackend::try_from(backend) {
|
||||||
Ok(backend) => backend,
|
Ok(backend) => backend,
|
||||||
Err(e) => return Err(zbus::fdo::Error::InvalidArgs(e.to_string())),
|
Err(e) => return Err(fdo::Error::InvalidArgs(e.to_string())),
|
||||||
};
|
};
|
||||||
set_wifi_backend(backend)
|
set_wifi_backend(backend)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -15,7 +15,7 @@ use std::os::unix::process::ExitStatusExt;
|
||||||
use std::process::ExitStatus;
|
use std::process::ExitStatus;
|
||||||
use tokio::process::{Child, Command};
|
use tokio::process::{Child, Command};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use zbus::interface;
|
use zbus::{fdo, interface};
|
||||||
|
|
||||||
use crate::error::to_zbus_fdo_error;
|
use crate::error::to_zbus_fdo_error;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ impl ProcessManager {
|
||||||
executable: &str,
|
executable: &str,
|
||||||
args: &[impl AsRef<OsStr>],
|
args: &[impl AsRef<OsStr>],
|
||||||
operation_name: &str,
|
operation_name: &str,
|
||||||
) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
// Run the given executable and give back an object path
|
// Run the given executable and give back an object path
|
||||||
let path = format!("{}{}", PROCESS_PREFIX, self.next_process);
|
let path = format!("{}{}", PROCESS_PREFIX, self.next_process);
|
||||||
self.next_process += 1;
|
self.next_process += 1;
|
||||||
|
@ -128,9 +128,9 @@ impl SubProcess {
|
||||||
|
|
||||||
#[interface(name = "com.steampowered.SteamOSManager1.SubProcess")]
|
#[interface(name = "com.steampowered.SteamOSManager1.SubProcess")]
|
||||||
impl SubProcess {
|
impl SubProcess {
|
||||||
pub async fn pause(&mut self) -> zbus::fdo::Result<()> {
|
pub async fn pause(&mut self) -> fdo::Result<()> {
|
||||||
if self.paused {
|
if self.paused {
|
||||||
return Err(zbus::fdo::Error::Failed("Already paused".to_string()));
|
return Err(fdo::Error::Failed("Already paused".to_string()));
|
||||||
}
|
}
|
||||||
// Pause the given process if possible
|
// Pause the given process if possible
|
||||||
// Return true on success, false otherwise
|
// Return true on success, false otherwise
|
||||||
|
@ -139,17 +139,17 @@ impl SubProcess {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn resume(&mut self) -> zbus::fdo::Result<()> {
|
pub async fn resume(&mut self) -> fdo::Result<()> {
|
||||||
// Resume the given process if possible
|
// Resume the given process if possible
|
||||||
if !self.paused {
|
if !self.paused {
|
||||||
return Err(zbus::fdo::Error::Failed("Not paused".to_string()));
|
return Err(fdo::Error::Failed("Not paused".to_string()));
|
||||||
}
|
}
|
||||||
let result = self.send_signal(Signal::SIGCONT).map_err(to_zbus_fdo_error);
|
let result = self.send_signal(Signal::SIGCONT).map_err(to_zbus_fdo_error);
|
||||||
self.paused = false;
|
self.paused = false;
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn cancel(&mut self) -> zbus::fdo::Result<()> {
|
pub async fn cancel(&mut self) -> fdo::Result<()> {
|
||||||
if self.try_wait().map_err(to_zbus_fdo_error)?.is_none() {
|
if self.try_wait().map_err(to_zbus_fdo_error)?.is_none() {
|
||||||
self.send_signal(Signal::SIGTERM)
|
self.send_signal(Signal::SIGTERM)
|
||||||
.map_err(to_zbus_fdo_error)?;
|
.map_err(to_zbus_fdo_error)?;
|
||||||
|
@ -160,14 +160,14 @@ impl SubProcess {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn kill(&mut self) -> zbus::fdo::Result<()> {
|
pub async fn kill(&mut self) -> fdo::Result<()> {
|
||||||
match self.try_wait().map_err(to_zbus_fdo_error)? {
|
match self.try_wait().map_err(to_zbus_fdo_error)? {
|
||||||
Some(_) => Ok(()),
|
Some(_) => Ok(()),
|
||||||
None => self.send_signal(signal::SIGKILL).map_err(to_zbus_fdo_error),
|
None => self.send_signal(signal::SIGKILL).map_err(to_zbus_fdo_error),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn wait(&mut self) -> zbus::fdo::Result<i32> {
|
pub async fn wait(&mut self) -> fdo::Result<i32> {
|
||||||
if self.paused {
|
if self.paused {
|
||||||
self.resume().await?;
|
self.resume().await?;
|
||||||
}
|
}
|
||||||
|
@ -175,16 +175,14 @@ impl SubProcess {
|
||||||
let code = match self.exit_code_internal().await.map_err(to_zbus_fdo_error) {
|
let code = match self.exit_code_internal().await.map_err(to_zbus_fdo_error) {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Err(zbus::fdo::Error::Failed(
|
return Err(fdo::Error::Failed("Unable to get exit code".to_string()));
|
||||||
"Unable to get exit code".to_string(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.exit_code = Some(code);
|
self.exit_code = Some(code);
|
||||||
Ok(code)
|
Ok(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn exit_code(&mut self) -> zbus::fdo::Result<i32> {
|
pub async fn exit_code(&mut self) -> fdo::Result<i32> {
|
||||||
match self.try_wait() {
|
match self.try_wait() {
|
||||||
Ok(Some(i)) => Ok(i),
|
Ok(Some(i)) => Ok(i),
|
||||||
_ => Err(zbus::fdo::Error::Failed(
|
_ => Err(zbus::fdo::Error::Failed(
|
||||||
|
@ -275,14 +273,14 @@ mod test {
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pause_process.pause().await.unwrap_err(),
|
pause_process.pause().await.unwrap_err(),
|
||||||
zbus::fdo::Error::Failed("Already paused".to_string())
|
fdo::Error::Failed("Already paused".to_string())
|
||||||
);
|
);
|
||||||
|
|
||||||
pause_process.resume().await.expect("resume");
|
pause_process.resume().await.expect("resume");
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
pause_process.resume().await.unwrap_err(),
|
pause_process.resume().await.unwrap_err(),
|
||||||
zbus::fdo::Error::Failed("Not paused".to_string())
|
fdo::Error::Failed("Not paused".to_string())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Sleep gives 0 exit code when done, -1 when we haven't waited for it yet
|
// Sleep gives 0 exit code when done, -1 when we haven't waited for it yet
|
||||||
|
|
|
@ -119,6 +119,7 @@ mod test {
|
||||||
use nix::unistd;
|
use nix::unistd;
|
||||||
use tokio::fs::{create_dir_all, read_to_string, write};
|
use tokio::fs::{create_dir_all, read_to_string, write};
|
||||||
use tokio::sync::mpsc::{error, unbounded_channel, UnboundedSender};
|
use tokio::sync::mpsc::{error, unbounded_channel, UnboundedSender};
|
||||||
|
use zbus::fdo;
|
||||||
|
|
||||||
struct MockTrace {
|
struct MockTrace {
|
||||||
traces: UnboundedSender<(String, HashMap<String, zvariant::OwnedValue>)>,
|
traces: UnboundedSender<(String, HashMap<String, zvariant::OwnedValue>)>,
|
||||||
|
@ -130,7 +131,7 @@ mod test {
|
||||||
&mut self,
|
&mut self,
|
||||||
trace: &str,
|
trace: &str,
|
||||||
data: HashMap<&str, zvariant::Value<'_>>,
|
data: HashMap<&str, zvariant::Value<'_>>,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> fdo::Result<()> {
|
||||||
let _ = self.traces.send((
|
let _ = self.traces.send((
|
||||||
String::from(trace),
|
String::from(trace),
|
||||||
HashMap::from_iter(
|
HashMap::from_iter(
|
||||||
|
|
|
@ -10,7 +10,7 @@ use anyhow::Result;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
use zbus::proxy::Builder;
|
use zbus::proxy::Builder;
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::{interface, Connection, Proxy, SignalContext};
|
use zbus::{fdo, interface, Connection, Proxy, SignalContext};
|
||||||
|
|
||||||
use crate::cec::{HdmiCecControl, HdmiCecState};
|
use crate::cec::{HdmiCecControl, HdmiCecState};
|
||||||
use crate::error::{to_zbus_error, to_zbus_fdo_error, zbus_to_zbus_fdo};
|
use crate::error::{to_zbus_error, to_zbus_fdo_error, zbus_to_zbus_fdo};
|
||||||
|
@ -79,7 +79,7 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn hdmi_cec_state(&self) -> zbus::fdo::Result<u32> {
|
async fn hdmi_cec_state(&self) -> fdo::Result<u32> {
|
||||||
match self.hdmi_cec.get_enabled_state().await {
|
match self.hdmi_cec.get_enabled_state().await {
|
||||||
Ok(state) => Ok(state as u32),
|
Ok(state) => Ok(state as u32),
|
||||||
Err(e) => Err(to_zbus_fdo_error(e)),
|
Err(e) => Err(to_zbus_fdo_error(e)),
|
||||||
|
@ -90,7 +90,7 @@ impl SteamOSManagerUser {
|
||||||
async fn set_hdmi_cec_state(&self, state: u32) -> zbus::Result<()> {
|
async fn set_hdmi_cec_state(&self, state: u32) -> zbus::Result<()> {
|
||||||
let state = match HdmiCecState::try_from(state) {
|
let state = match HdmiCecState::try_from(state) {
|
||||||
Ok(state) => state,
|
Ok(state) => state,
|
||||||
Err(err) => return Err(zbus::fdo::Error::InvalidArgs(err.to_string()).into()),
|
Err(err) => return Err(fdo::Error::InvalidArgs(err.to_string()).into()),
|
||||||
};
|
};
|
||||||
self.hdmi_cec
|
self.hdmi_cec
|
||||||
.set_enabled_state(state)
|
.set_enabled_state(state)
|
||||||
|
@ -99,12 +99,12 @@ impl SteamOSManagerUser {
|
||||||
.map_err(to_zbus_error)
|
.map_err(to_zbus_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn prepare_factory_reset(&self) -> zbus::fdo::Result<u32> {
|
async fn prepare_factory_reset(&self) -> fdo::Result<u32> {
|
||||||
method!(self, "PrepareFactoryReset")
|
method!(self, "PrepareFactoryReset")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn wifi_power_management_state(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_power_management_state(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "WifiPowerManagementState")
|
getter!(self, "WifiPowerManagementState")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn fan_control_state(&self) -> zbus::fdo::Result<u32> {
|
async fn fan_control_state(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "FanControlState")
|
getter!(self, "FanControlState")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,16 +124,16 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn hardware_currently_supported(&self) -> zbus::fdo::Result<u32> {
|
async fn hardware_currently_supported(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "HardwareCurrentlySupported")
|
getter!(self, "HardwareCurrentlySupported")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn als_calibration_gain(&self) -> zbus::fdo::Result<f64> {
|
async fn als_calibration_gain(&self) -> fdo::Result<f64> {
|
||||||
getter!(self, "AlsCalibrationGain")
|
getter!(self, "AlsCalibrationGain")
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_als_integration_time_file_descriptor(&self) -> zbus::fdo::Result<Fd> {
|
async fn get_als_integration_time_file_descriptor(&self) -> fdo::Result<Fd> {
|
||||||
let m = self
|
let m = self
|
||||||
.proxy
|
.proxy
|
||||||
.call_method::<&str, ()>("GetAlsIntegrationTimeFileDescriptor", &())
|
.call_method::<&str, ()>("GetAlsIntegrationTimeFileDescriptor", &())
|
||||||
|
@ -145,15 +145,15 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_bios(&self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn update_bios(&self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
method!(self, "UpdateBios")
|
method!(self, "UpdateBios")
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_dock(&self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn update_dock(&self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
method!(self, "UpdateDock")
|
method!(self, "UpdateDock")
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn trim_devices(&self) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
async fn trim_devices(&self) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
method!(self, "TrimDevices")
|
method!(self, "TrimDevices")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,12 +162,12 @@ impl SteamOSManagerUser {
|
||||||
device: &str,
|
device: &str,
|
||||||
label: &str,
|
label: &str,
|
||||||
validate: bool,
|
validate: bool,
|
||||||
) -> zbus::fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
) -> fdo::Result<zbus::zvariant::OwnedObjectPath> {
|
||||||
method!(self, "FormatDevice", device, label, validate)
|
method!(self, "FormatDevice", device, label, validate)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn gpu_performance_level(&self) -> zbus::fdo::Result<u32> {
|
async fn gpu_performance_level(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "GpuPerformanceLevel")
|
getter!(self, "GpuPerformanceLevel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn manual_gpu_clock(&self) -> zbus::fdo::Result<u32> {
|
async fn manual_gpu_clock(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "ManualGpuClock")
|
getter!(self, "ManualGpuClock")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,17 +187,17 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn manual_gpu_clock_min(&self) -> zbus::fdo::Result<u32> {
|
async fn manual_gpu_clock_min(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "ManualGpuClockMin")
|
getter!(self, "ManualGpuClockMin")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn manual_gpu_clock_max(&self) -> zbus::fdo::Result<u32> {
|
async fn manual_gpu_clock_max(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "ManualGpuClockMax")
|
getter!(self, "ManualGpuClockMax")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn tdp_limit(&self) -> zbus::fdo::Result<u32> {
|
async fn tdp_limit(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "TdpLimit")
|
getter!(self, "TdpLimit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,17 +207,17 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn tdp_limit_min(&self) -> zbus::fdo::Result<u32> {
|
async fn tdp_limit_min(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "TdpLimitMin")
|
getter!(self, "TdpLimitMin")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "const"))]
|
#[zbus(property(emits_changed_signal = "const"))]
|
||||||
async fn tdp_limit_max(&self) -> zbus::fdo::Result<u32> {
|
async fn tdp_limit_max(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "TdpLimitMax")
|
getter!(self, "TdpLimitMax")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn wifi_debug_mode_state(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_debug_mode_state(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "WifiDebugModeState")
|
getter!(self, "WifiDebugModeState")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ impl SteamOSManagerUser {
|
||||||
mode: u32,
|
mode: u32,
|
||||||
buffer_size: u32,
|
buffer_size: u32,
|
||||||
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
#[zbus(signal_context)] ctx: SignalContext<'_>,
|
||||||
) -> zbus::fdo::Result<()> {
|
) -> fdo::Result<()> {
|
||||||
method!(self, "SetWifiDebugMode", mode, buffer_size)?;
|
method!(self, "SetWifiDebugMode", mode, buffer_size)?;
|
||||||
self.wifi_debug_mode_state_changed(&ctx)
|
self.wifi_debug_mode_state_changed(&ctx)
|
||||||
.await
|
.await
|
||||||
|
@ -235,7 +235,7 @@ impl SteamOSManagerUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property(emits_changed_signal = "false"))]
|
#[zbus(property(emits_changed_signal = "false"))]
|
||||||
async fn wifi_backend(&self) -> zbus::fdo::Result<u32> {
|
async fn wifi_backend(&self) -> fdo::Result<u32> {
|
||||||
getter!(self, "WifiBackend")
|
getter!(self, "WifiBackend")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue