From d1ea6b45e9826d50b2fb7ce65b4697d96c5d914a Mon Sep 17 00:00:00 2001 From: Jeremy Whiting Date: Mon, 7 Jul 2025 16:32:15 -0600 Subject: [PATCH] Bump from ScreenReader0 to ScreenReader1. Change mode from an enumeration/u32 to a string on DBus interface. Change actions on TriggerAction from u32 to strings also on DBus interface. --- .../com.steampowered.SteamOSManager1.xml | 28 +++++++------- steamos-manager-proxy/src/lib.rs | 4 +- .../{screenreader0.rs => screenreader1.rs} | 12 +++--- steamos-manager/src/bin/steamosctl.rs | 38 +++++++++---------- steamos-manager/src/manager/user.rs | 18 ++++----- 5 files changed, 50 insertions(+), 50 deletions(-) rename steamos-manager-proxy/src/{screenreader0.rs => screenreader1.rs} (87%) diff --git a/data/interfaces/com.steampowered.SteamOSManager1.xml b/data/interfaces/com.steampowered.SteamOSManager1.xml index 6097cd4..f8db6c0 100644 --- a/data/interfaces/com.steampowered.SteamOSManager1.xml +++ b/data/interfaces/com.steampowered.SteamOSManager1.xml @@ -305,7 +305,7 @@ This interface is considered unstable and may change between verisons. Once it is considered stable it will be renamed to ScreenReader1 --> - + - + - + diff --git a/steamos-manager-proxy/src/lib.rs b/steamos-manager-proxy/src/lib.rs index 6b29b36..79306bf 100644 --- a/steamos-manager-proxy/src/lib.rs +++ b/steamos-manager-proxy/src/lib.rs @@ -25,7 +25,7 @@ mod hdmi_cec1; mod low_power_mode1; mod manager2; mod performance_profile1; -mod screenreader0; +mod screenreader1; mod storage1; mod tdp_limit1; mod update_bios1; @@ -44,7 +44,7 @@ pub use crate::hdmi_cec1::HdmiCec1Proxy; pub use crate::low_power_mode1::LowPowerMode1Proxy; pub use crate::manager2::Manager2Proxy; pub use crate::performance_profile1::PerformanceProfile1Proxy; -pub use crate::screenreader0::ScreenReader0Proxy; +pub use crate::screenreader1::ScreenReader1Proxy; pub use crate::storage1::Storage1Proxy; pub use crate::tdp_limit1::TdpLimit1Proxy; pub use crate::update_bios1::UpdateBios1Proxy; diff --git a/steamos-manager-proxy/src/screenreader0.rs b/steamos-manager-proxy/src/screenreader1.rs similarity index 87% rename from steamos-manager-proxy/src/screenreader0.rs rename to steamos-manager-proxy/src/screenreader1.rs index d4fc145..f5903bb 100644 --- a/steamos-manager-proxy/src/screenreader0.rs +++ b/steamos-manager-proxy/src/screenreader1.rs @@ -1,4 +1,4 @@ -//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.ScreenReader0` +//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.ScreenReader1` //! //! This code was generated by `zbus-xmlgen` `5.1.0` from D-Bus introspection data. //! Source: `com.steampowered.SteamOSManager1.xml`. @@ -13,14 +13,14 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy( - interface = "com.steampowered.SteamOSManager1.ScreenReader0", + interface = "com.steampowered.SteamOSManager1.ScreenReader1", default_service = "com.steampowered.SteamOSManager1", default_path = "/com/steampowered/SteamOSManager1", assume_defaults = true )] -pub trait ScreenReader0 { +pub trait ScreenReader1 { /// TriggerAction method - fn trigger_action(&self, action: u32, timestamp: u64) -> zbus::Result<()>; + fn trigger_action(&self, action: &str, timestamp: u64) -> zbus::Result<()>; /// Enabled property #[zbus(property)] @@ -30,9 +30,9 @@ pub trait ScreenReader0 { /// Mode property #[zbus(property)] - fn mode(&self) -> zbus::Result; + fn mode(&self) -> zbus::Result; #[zbus(property)] - fn set_mode(&self, value: u32) -> zbus::Result<()>; + fn set_mode(&self, value: &str) -> zbus::Result<()>; /// Pitch property #[zbus(property)] diff --git a/steamos-manager/src/bin/steamosctl.rs b/steamos-manager/src/bin/steamosctl.rs index b63979d..faa5f9e 100644 --- a/steamos-manager/src/bin/steamosctl.rs +++ b/steamos-manager/src/bin/steamosctl.rs @@ -17,7 +17,7 @@ use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerPr use steamos_manager::proxy::{ AmbientLightSensor1Proxy, BatteryChargeLimit1Proxy, CpuScaling1Proxy, FactoryReset1Proxy, FanControl1Proxy, GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, HdmiCec1Proxy, - LowPowerMode1Proxy, Manager2Proxy, PerformanceProfile1Proxy, ScreenReader0Proxy, Storage1Proxy, + LowPowerMode1Proxy, Manager2Proxy, PerformanceProfile1Proxy, ScreenReader1Proxy, Storage1Proxy, TdpLimit1Proxy, UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, WifiDebugDump1Proxy, WifiPowerManagement1Proxy, }; @@ -601,72 +601,72 @@ async fn main() -> Result<()> { println!("Variant: {variant}"); } Commands::GetScreenReaderEnabled => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let enabled = proxy.enabled().await?; println!("Enabled: {enabled}"); } Commands::SetScreenReaderEnabled { enable } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; proxy.set_enabled(*enable).await?; } Commands::GetScreenReaderRate => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let rate = proxy.rate().await?; println!("Rate: {rate}"); } Commands::SetScreenReaderRate { rate } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; proxy.set_rate(*rate).await?; } Commands::GetScreenReaderPitch => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let pitch = proxy.pitch().await?; println!("Pitch: {pitch}"); } Commands::SetScreenReaderPitch { pitch } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; proxy.set_pitch(*pitch).await?; } Commands::GetScreenReaderVolume => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let volume = proxy.volume().await?; println!("Volume: {volume}"); } Commands::SetScreenReaderVolume { volume } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; proxy.set_volume(*volume).await?; } Commands::GetScreenReaderMode => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let mode = proxy.mode().await?; - match ScreenReaderMode::try_from(mode) { + match ScreenReaderMode::try_from(mode.as_str()) { Ok(s) => println!("Screen Reader Mode: {s}"), Err(_) => println!("Got unknown screen reader mode value {mode} from backend"), } } Commands::SetScreenReaderMode { mode } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; - proxy.set_mode(*mode as u32).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; + proxy.set_mode(mode.to_string().as_str()).await?; } Commands::TriggerScreenReaderAction { action } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let timestamp = clock_gettime(ClockId::CLOCK_MONOTONIC_RAW)?; let now = timestamp.tv_sec() * 1000000000 + timestamp.tv_nsec(); proxy - .trigger_action(*action as u32, now.try_into()?) + .trigger_action(action.to_string().as_str(), now.try_into()?) .await?; } Commands::GetScreenReaderVoice => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let voice = proxy.voice().await?; println!("Voice: {voice}"); } Commands::SetScreenReaderVoice { voice } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; proxy.set_voice(voice).await?; } Commands::GetScreenReaderLocales => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let locales = proxy.voice_locales().await?; println!("Locales:\n"); for locale in locales.into_iter().sorted() { @@ -674,7 +674,7 @@ async fn main() -> Result<()> { } } Commands::GetScreenReaderVoicesForLocale { locale } => { - let proxy = ScreenReader0Proxy::new(&conn).await?; + let proxy = ScreenReader1Proxy::new(&conn).await?; let voice_list = proxy.voices_for_locale().await?; let voices = voice_list .get(locale) diff --git a/steamos-manager/src/manager/user.rs b/steamos-manager/src/manager/user.rs index 0557e88..4c5de65 100644 --- a/steamos-manager/src/manager/user.rs +++ b/steamos-manager/src/manager/user.rs @@ -157,7 +157,7 @@ struct PerformanceProfile1 { tdp_limit_manager: Option>, } -struct ScreenReader0 { +struct ScreenReader1 { screen_reader: OrcaManager<'static>, } @@ -624,15 +624,15 @@ impl PerformanceProfile1 { } } -impl ScreenReader0 { - async fn new(connection: &Connection) -> Result { +impl ScreenReader1 { + async fn new(connection: &Connection) -> Result { let screen_reader = OrcaManager::new(connection).await?; - Ok(ScreenReader0 { screen_reader }) + Ok(ScreenReader1 { screen_reader }) } } -#[interface(name = "com.steampowered.SteamOSManager1.ScreenReader0")] -impl ScreenReader0 { +#[interface(name = "com.steampowered.SteamOSManager1.ScreenReader1")] +impl ScreenReader1 { #[zbus(property)] async fn enabled(&self) -> bool { self.screen_reader.enabled() @@ -693,7 +693,7 @@ impl ScreenReader0 { #[zbus(property)] async fn set_mode( &mut self, - m: u32, + m: &str, #[zbus(signal_emitter)] ctx: SignalEmitter<'_>, ) -> fdo::Result<()> { let mode = match ScreenReaderMode::try_from(m) { @@ -735,7 +735,7 @@ impl ScreenReader0 { self.screen_reader.get_voices().clone() } - async fn trigger_action(&mut self, a: u32, timestamp: u64) -> fdo::Result<()> { + async fn trigger_action(&mut self, a: &str, timestamp: u64) -> fdo::Result<()> { let action = match ScreenReaderAction::try_from(a) { Ok(action) => action, Err(err) => return Err(fdo::Error::InvalidArgs(err.to_string())), @@ -1110,7 +1110,7 @@ pub(crate) async fn create_interfaces( proxy: proxy.clone(), channel: daemon, }; - let screen_reader = ScreenReader0::new(&session).await?; + let screen_reader = ScreenReader1::new(&session).await?; let wifi_power_management = WifiPowerManagement1 { proxy: proxy.clone(), };