manager/user: Rename GpuTdpLimit1 to TdpLimit1

This commit is contained in:
Vicki Pfau 2024-08-27 19:51:14 -07:00
parent 6815b7d695
commit 2d4647a918
5 changed files with 77 additions and 78 deletions

View file

@ -162,37 +162,6 @@
</interface> </interface>
<!--
com.steampowered.SteamOSManager1.GpuTdpLimit1
@short_description: Optional interface for GPU TDP limits.
-->
<interface name="com.steampowered.SteamOSManager1.GpuTdpLimit1">
<!--
TdpLimit:
Controls the GPU TDP limit.
Valid states: In range of [ TdpLimitMin, TdpLimitMax ]
-->
<property name="TdpLimit" type="u" access="readwrite"/>
<!--
TdpLimitMin:
Minimum allowed TDP Limit.
-->
<property name="TdpLimitMin" type="u" access="read"/>
<!--
TdpLimitMax:
Maximum allowed TDP Limit.
-->
<property name="TdpLimitMax" type="u" access="read"/>
</interface>
<!-- <!--
com.steampowered.SteamOSManager1.HdmiCec1 com.steampowered.SteamOSManager1.HdmiCec1
@short_description: Optional interface for HDMI-CEC. @short_description: Optional interface for HDMI-CEC.
@ -278,6 +247,37 @@
</interface> </interface>
<!--
com.steampowered.SteamOSManager1.TdpLimit1
@short_description: Optional interface for TDP limits.
-->
<interface name="com.steampowered.SteamOSManager1.TdpLimit1">
<!--
TdpLimit:
Controls the TDP limit.
Valid states: In range of [ TdpLimitMin, TdpLimitMax ]
-->
<property name="TdpLimit" type="u" access="readwrite"/>
<!--
TdpLimitMin:
Minimum allowed TDP Limit.
-->
<property name="TdpLimitMin" type="u" access="read"/>
<!--
TdpLimitMax:
Maximum allowed TDP Limit.
-->
<property name="TdpLimitMax" type="u" access="read"/>
</interface>
<!-- <!--
com.steampowered.SteamOSManager1.UpdateBios1 com.steampowered.SteamOSManager1.UpdateBios1
@short_description: Optional interface for hardware that can update its @short_description: Optional interface for hardware that can update its

View file

@ -16,9 +16,8 @@ use steamos_manager::hardware::FanControlState;
use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile}; use steamos_manager::power::{CPUScalingGovernor, GPUPerformanceLevel, GPUPowerProfile};
use steamos_manager::proxy::{ use steamos_manager::proxy::{
AmbientLightSensor1Proxy, CpuScaling1Proxy, FactoryReset1Proxy, FanControl1Proxy, AmbientLightSensor1Proxy, CpuScaling1Proxy, FactoryReset1Proxy, FanControl1Proxy,
GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, GpuTdpLimit1Proxy, HdmiCec1Proxy, GpuPerformanceLevel1Proxy, GpuPowerProfile1Proxy, HdmiCec1Proxy, Manager2Proxy, Storage1Proxy,
Manager2Proxy, Storage1Proxy, UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, TdpLimit1Proxy, UpdateBios1Proxy, UpdateDock1Proxy, WifiDebug1Proxy, WifiPowerManagement1Proxy,
WifiPowerManagement1Proxy,
}; };
use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement}; use steamos_manager::wifi::{WifiBackend, WifiDebugMode, WifiPowerManagement};
use zbus::fdo::{IntrospectableProxy, PropertiesProxy}; use zbus::fdo::{IntrospectableProxy, PropertiesProxy};
@ -329,21 +328,21 @@ async fn main() -> Result<()> {
println!("Manual GPU Clock Min: {value}"); println!("Manual GPU Clock Min: {value}");
} }
Commands::SetTDPLimit { limit } => { Commands::SetTDPLimit { limit } => {
let proxy = GpuTdpLimit1Proxy::new(&conn).await?; let proxy = TdpLimit1Proxy::new(&conn).await?;
proxy.set_tdp_limit(*limit).await?; proxy.set_tdp_limit(*limit).await?;
} }
Commands::GetTDPLimit => { Commands::GetTDPLimit => {
let proxy = GpuTdpLimit1Proxy::new(&conn).await?; let proxy = TdpLimit1Proxy::new(&conn).await?;
let limit = proxy.tdp_limit().await?; let limit = proxy.tdp_limit().await?;
println!("TDP limit: {limit}"); println!("TDP limit: {limit}");
} }
Commands::GetTDPLimitMax => { Commands::GetTDPLimitMax => {
let proxy = GpuTdpLimit1Proxy::new(&conn).await?; let proxy = TdpLimit1Proxy::new(&conn).await?;
let value = proxy.tdp_limit_max().await?; let value = proxy.tdp_limit_max().await?;
println!("TDP limit max: {value}"); println!("TDP limit max: {value}");
} }
Commands::GetTDPLimitMin => { Commands::GetTDPLimitMin => {
let proxy = GpuTdpLimit1Proxy::new(&conn).await?; let proxy = TdpLimit1Proxy::new(&conn).await?;
let value = proxy.tdp_limit_min().await?; let value = proxy.tdp_limit_min().await?;
println!("TDP limit min: {value}"); println!("TDP limit min: {value}");
} }

View file

@ -121,7 +121,7 @@ struct GpuPowerProfile1 {
proxy: Proxy<'static>, proxy: Proxy<'static>,
} }
struct GpuTdpLimit1 { struct TdpLimit1 {
proxy: Proxy<'static>, proxy: Proxy<'static>,
} }
@ -348,31 +348,6 @@ impl GpuPowerProfile1 {
} }
} }
#[interface(name = "com.steampowered.SteamOSManager1.GpuTdpLimit1")]
impl GpuTdpLimit1 {
#[zbus(property(emits_changed_signal = "false"))]
async fn tdp_limit(&self) -> fdo::Result<u32> {
get_tdp_limit().await.map_err(to_zbus_fdo_error)
}
#[zbus(property)]
async fn set_tdp_limit(&self, limit: u32) -> zbus::Result<()> {
self.proxy.call("SetTdpLimit", &(limit)).await
}
#[zbus(property(emits_changed_signal = "const"))]
async fn tdp_limit_min(&self) -> u32 {
// TODO: Can this be queried from somewhere?
3
}
#[zbus(property(emits_changed_signal = "const"))]
async fn tdp_limit_max(&self) -> u32 {
// TODO: Can this be queried from somewhere?
15
}
}
impl HdmiCec1 { impl HdmiCec1 {
async fn new(connection: &Connection) -> Result<HdmiCec1> { async fn new(connection: &Connection) -> Result<HdmiCec1> {
let hdmi_cec = HdmiCecControl::new(connection).await?; let hdmi_cec = HdmiCecControl::new(connection).await?;
@ -440,6 +415,31 @@ impl Storage1 {
} }
} }
#[interface(name = "com.steampowered.SteamOSManager1.TdpLimit1")]
impl TdpLimit1 {
#[zbus(property(emits_changed_signal = "false"))]
async fn tdp_limit(&self) -> fdo::Result<u32> {
get_tdp_limit().await.map_err(to_zbus_fdo_error)
}
#[zbus(property)]
async fn set_tdp_limit(&self, limit: u32) -> zbus::Result<()> {
self.proxy.call("SetTdpLimit", &(limit)).await
}
#[zbus(property(emits_changed_signal = "const"))]
async fn tdp_limit_min(&self) -> u32 {
// TODO: Can this be queried from somewhere?
3
}
#[zbus(property(emits_changed_signal = "const"))]
async fn tdp_limit_max(&self) -> u32 {
// TODO: Can this be queried from somewhere?
15
}
}
#[interface(name = "com.steampowered.SteamOSManager1.UpdateBios1")] #[interface(name = "com.steampowered.SteamOSManager1.UpdateBios1")]
impl UpdateBios1 { impl UpdateBios1 {
async fn update_bios(&mut self) -> fdo::Result<zvariant::OwnedObjectPath> { async fn update_bios(&mut self) -> fdo::Result<zvariant::OwnedObjectPath> {
@ -540,9 +540,6 @@ pub(crate) async fn create_interfaces(
let gpu_power_profile = GpuPowerProfile1 { let gpu_power_profile = GpuPowerProfile1 {
proxy: proxy.clone(), proxy: proxy.clone(),
}; };
let gpu_tdp_limit = GpuTdpLimit1 {
proxy: proxy.clone(),
};
let hdmi_cec = HdmiCec1::new(&session).await?; let hdmi_cec = HdmiCec1::new(&session).await?;
let manager2 = Manager2 { let manager2 = Manager2 {
proxy: proxy.clone(), proxy: proxy.clone(),
@ -552,6 +549,9 @@ pub(crate) async fn create_interfaces(
proxy: proxy.clone(), proxy: proxy.clone(),
job_manager: job_manager.clone(), job_manager: job_manager.clone(),
}; };
let tdp_limit = TdpLimit1 {
proxy: proxy.clone(),
};
let update_bios = UpdateBios1 { let update_bios = UpdateBios1 {
proxy: proxy.clone(), proxy: proxy.clone(),
job_manager: job_manager.clone(), job_manager: job_manager.clone(),
@ -609,10 +609,6 @@ pub(crate) async fn create_interfaces(
object_server.at(MANAGER_PATH, gpu_power_profile).await?; object_server.at(MANAGER_PATH, gpu_power_profile).await?;
} }
if get_tdp_limit().await.is_ok() {
object_server.at(MANAGER_PATH, gpu_tdp_limit).await?;
}
if hdmi_cec.hdmi_cec.get_enabled_state().await.is_ok() { if hdmi_cec.hdmi_cec.get_enabled_state().await.is_ok() {
object_server.at(MANAGER_PATH, hdmi_cec).await?; object_server.at(MANAGER_PATH, hdmi_cec).await?;
} }
@ -626,6 +622,10 @@ pub(crate) async fn create_interfaces(
object_server.at(MANAGER_PATH, storage).await?; object_server.at(MANAGER_PATH, storage).await?;
} }
if get_tdp_limit().await.is_ok() {
object_server.at(MANAGER_PATH, tdp_limit).await?;
}
if config if config
.as_ref() .as_ref()
.is_some_and(|config| config.update_bios.is_some()) .is_some_and(|config| config.update_bios.is_some())
@ -836,10 +836,10 @@ mod test {
} }
#[tokio::test] #[tokio::test]
async fn interface_matches_gpu_tdp_limit1() { async fn interface_matches_tdp_limit1() {
let test = start(all_config()).await.expect("start"); let test = start(all_config()).await.expect("start");
assert!(test_interface_matches::<GpuTdpLimit1>(&test.connection) assert!(test_interface_matches::<TdpLimit1>(&test.connection)
.await .await
.unwrap()); .unwrap());
} }

View file

@ -26,10 +26,10 @@ mod factory_reset1;
mod fan_control1; mod fan_control1;
mod gpu_performance_level1; mod gpu_performance_level1;
mod gpu_power_profile1; mod gpu_power_profile1;
mod gpu_tdp_limit1;
mod hdmi_cec1; mod hdmi_cec1;
mod manager2; mod manager2;
mod storage1; mod storage1;
mod tdp_limit1;
mod update_bios1; mod update_bios1;
mod update_dock1; mod update_dock1;
mod wifi_debug1; mod wifi_debug1;
@ -40,10 +40,10 @@ pub use crate::proxy::factory_reset1::FactoryReset1Proxy;
pub use crate::proxy::fan_control1::FanControl1Proxy; pub use crate::proxy::fan_control1::FanControl1Proxy;
pub use crate::proxy::gpu_performance_level1::GpuPerformanceLevel1Proxy; pub use crate::proxy::gpu_performance_level1::GpuPerformanceLevel1Proxy;
pub use crate::proxy::gpu_power_profile1::GpuPowerProfile1Proxy; pub use crate::proxy::gpu_power_profile1::GpuPowerProfile1Proxy;
pub use crate::proxy::gpu_tdp_limit1::GpuTdpLimit1Proxy;
pub use crate::proxy::hdmi_cec1::HdmiCec1Proxy; pub use crate::proxy::hdmi_cec1::HdmiCec1Proxy;
pub use crate::proxy::manager2::Manager2Proxy; pub use crate::proxy::manager2::Manager2Proxy;
pub use crate::proxy::storage1::Storage1Proxy; pub use crate::proxy::storage1::Storage1Proxy;
pub use crate::proxy::tdp_limit1::TdpLimit1Proxy;
pub use crate::proxy::update_bios1::UpdateBios1Proxy; pub use crate::proxy::update_bios1::UpdateBios1Proxy;
pub use crate::proxy::update_dock1::UpdateDock1Proxy; pub use crate::proxy::update_dock1::UpdateDock1Proxy;
pub use crate::proxy::wifi_debug1::WifiDebug1Proxy; pub use crate::proxy::wifi_debug1::WifiDebug1Proxy;

View file

@ -1,4 +1,4 @@
//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.GpuTdpLimit1` //! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.TdpLimit1`
//! //!
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data. //! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
//! Source: `com.steampowered.SteamOSManager1.xml`. //! Source: `com.steampowered.SteamOSManager1.xml`.
@ -13,12 +13,12 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy; use zbus::proxy;
#[proxy( #[proxy(
interface = "com.steampowered.SteamOSManager1.GpuTdpLimit1", interface = "com.steampowered.SteamOSManager1.TdpLimit1",
default_service = "com.steampowered.SteamOSManager1", default_service = "com.steampowered.SteamOSManager1",
default_path = "/com/steampowered/SteamOSManager1", default_path = "/com/steampowered/SteamOSManager1",
assume_defaults = true assume_defaults = true
)] )]
trait GpuTdpLimit1 { trait TdpLimit1 {
/// TdpLimit property /// TdpLimit property
#[zbus(property)] #[zbus(property)]
fn tdp_limit(&self) -> zbus::Result<u32>; fn tdp_limit(&self) -> zbus::Result<u32>;