mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-15 18:56:49 -04:00
screenreader: add screen reader commands to steamosctl.
Adds get-screen-reader-enabled, set-screen-reader-enabled, get-screen-reader-(pitch|rate|volume), set-screen-reader-(pitch|rate|volume).
This commit is contained in:
parent
d6d8b0e336
commit
cff6303b6c
3 changed files with 122 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{ArgAction, Parser, Subcommand};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
|
@ -16,8 +16,8 @@ use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerPr
|
||||||
use steamos_manager::proxy::{
|
use steamos_manager::proxy::{
|
||||||
AmbientLightSensor1Proxy, BatteryChargeLimit1Proxy, CpuScaling1Proxy, FactoryReset1Proxy,
|
AmbientLightSensor1Proxy, BatteryChargeLimit1Proxy, CpuScaling1Proxy, FactoryReset1Proxy,
|
||||||
FanControl1Proxy, GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, HdmiCec1Proxy,
|
FanControl1Proxy, GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, HdmiCec1Proxy,
|
||||||
LowPowerMode1Proxy, Manager2Proxy, PerformanceProfile1Proxy, Storage1Proxy, TdpLimit1Proxy,
|
LowPowerMode1Proxy, Manager2Proxy, PerformanceProfile1Proxy, ScreenReader0Proxy, Storage1Proxy,
|
||||||
UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, WifiDebugDump1Proxy,
|
TdpLimit1Proxy, UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, WifiDebugDump1Proxy,
|
||||||
WifiPowerManagement1Proxy,
|
WifiPowerManagement1Proxy,
|
||||||
};
|
};
|
||||||
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
|
||||||
|
@ -206,6 +206,42 @@ enum Commands {
|
||||||
|
|
||||||
/// Get the model and variant of this device, if known
|
/// Get the model and variant of this device, if known
|
||||||
GetDeviceModel,
|
GetDeviceModel,
|
||||||
|
|
||||||
|
/// Get whether screen reader is enabled or not.
|
||||||
|
GetScreenReaderEnabled,
|
||||||
|
|
||||||
|
/// Enable or disable the screen reader
|
||||||
|
SetScreenReaderEnabled {
|
||||||
|
#[arg(action = ArgAction::Set, required = true)]
|
||||||
|
enable: bool,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Get screen reader rate
|
||||||
|
GetScreenReaderRate,
|
||||||
|
|
||||||
|
/// Set screen reader rate
|
||||||
|
SetScreenReaderRate {
|
||||||
|
/// Valid rates between 0.0 for slowest and 100.0 for fastest.
|
||||||
|
rate: f64,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Get screen reader pitch
|
||||||
|
GetScreenReaderPitch,
|
||||||
|
|
||||||
|
/// Set screen reader pitch
|
||||||
|
SetScreenReaderPitch {
|
||||||
|
/// Valid pitches between 0.0 for lowest and 10.0 for highest.
|
||||||
|
pitch: f64,
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Get screen reader volume
|
||||||
|
GetScreenReaderVolume,
|
||||||
|
|
||||||
|
/// Set screen reader volume
|
||||||
|
SetScreenReaderVolume {
|
||||||
|
/// Valid volume between 0.0 for off, and 10.0 for loudest.
|
||||||
|
volume: f64,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_all_properties(conn: &Connection) -> Result<()> {
|
async fn get_all_properties(conn: &Connection) -> Result<()> {
|
||||||
|
@ -519,6 +555,42 @@ async fn main() -> Result<()> {
|
||||||
println!("Model: {device}");
|
println!("Model: {device}");
|
||||||
println!("Variant: {variant}");
|
println!("Variant: {variant}");
|
||||||
}
|
}
|
||||||
|
Commands::GetScreenReaderEnabled => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
let enabled = proxy.enabled().await?;
|
||||||
|
println!("Enabled: {enabled}");
|
||||||
|
}
|
||||||
|
Commands::SetScreenReaderEnabled { enable } => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
proxy.set_enabled(*enable).await?;
|
||||||
|
}
|
||||||
|
Commands::GetScreenReaderRate => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
let rate = proxy.rate().await?;
|
||||||
|
println!("Rate: {rate}");
|
||||||
|
}
|
||||||
|
Commands::SetScreenReaderRate { rate } => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
proxy.set_rate(*rate).await?;
|
||||||
|
}
|
||||||
|
Commands::GetScreenReaderPitch => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
let pitch = proxy.pitch().await?;
|
||||||
|
println!("Pitch: {pitch}");
|
||||||
|
}
|
||||||
|
Commands::SetScreenReaderPitch { pitch } => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
proxy.set_pitch(*pitch).await?;
|
||||||
|
}
|
||||||
|
Commands::GetScreenReaderVolume => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
let volume = proxy.volume().await?;
|
||||||
|
println!("Volume: {volume}");
|
||||||
|
}
|
||||||
|
Commands::SetScreenReaderVolume { volume } => {
|
||||||
|
let proxy = ScreenReader0Proxy::new(&conn).await?;
|
||||||
|
proxy.set_volume(*volume).await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -25,6 +25,7 @@ mod hdmi_cec1;
|
||||||
mod low_power_mode1;
|
mod low_power_mode1;
|
||||||
mod manager2;
|
mod manager2;
|
||||||
mod performance_profile1;
|
mod performance_profile1;
|
||||||
|
mod screenreader0;
|
||||||
mod storage1;
|
mod storage1;
|
||||||
mod tdp_limit1;
|
mod tdp_limit1;
|
||||||
mod update_bios1;
|
mod update_bios1;
|
||||||
|
@ -43,6 +44,7 @@ pub use crate::proxy::hdmi_cec1::HdmiCec1Proxy;
|
||||||
pub use crate::proxy::low_power_mode1::LowPowerMode1Proxy;
|
pub use crate::proxy::low_power_mode1::LowPowerMode1Proxy;
|
||||||
pub use crate::proxy::manager2::Manager2Proxy;
|
pub use crate::proxy::manager2::Manager2Proxy;
|
||||||
pub use crate::proxy::performance_profile1::PerformanceProfile1Proxy;
|
pub use crate::proxy::performance_profile1::PerformanceProfile1Proxy;
|
||||||
|
pub use crate::proxy::screenreader0::ScreenReader0Proxy;
|
||||||
pub use crate::proxy::storage1::Storage1Proxy;
|
pub use crate::proxy::storage1::Storage1Proxy;
|
||||||
pub use crate::proxy::tdp_limit1::TdpLimit1Proxy;
|
pub use crate::proxy::tdp_limit1::TdpLimit1Proxy;
|
||||||
pub use crate::proxy::update_bios1::UpdateBios1Proxy;
|
pub use crate::proxy::update_bios1::UpdateBios1Proxy;
|
||||||
|
|
45
src/proxy/screenreader0.rs
Normal file
45
src/proxy/screenreader0.rs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.ScreenReader0`
|
||||||
|
//!
|
||||||
|
//! This code was generated by `zbus-xmlgen` `5.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(
|
||||||
|
interface = "com.steampowered.SteamOSManager1.ScreenReader0",
|
||||||
|
default_service = "com.steampowered.SteamOSManager1",
|
||||||
|
default_path = "/com/steampowered/SteamOSManager1",
|
||||||
|
assume_defaults = true
|
||||||
|
)]
|
||||||
|
pub trait ScreenReader0 {
|
||||||
|
/// Enabled property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn enabled(&self) -> zbus::Result<bool>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_enabled(&self, value: bool) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
/// Pitch property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn pitch(&self) -> zbus::Result<f64>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_pitch(&self, value: f64) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
/// Rate property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn rate(&self) -> zbus::Result<f64>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_rate(&self, value: f64) -> zbus::Result<()>;
|
||||||
|
|
||||||
|
/// Volume property
|
||||||
|
#[zbus(property)]
|
||||||
|
fn volume(&self) -> zbus::Result<f64>;
|
||||||
|
#[zbus(property)]
|
||||||
|
fn set_volume(&self, value: f64) -> zbus::Result<()>;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue