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

@ -121,7 +121,7 @@ struct GpuPowerProfile1 {
proxy: Proxy<'static>,
}
struct GpuTdpLimit1 {
struct TdpLimit1 {
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 {
async fn new(connection: &Connection) -> Result<HdmiCec1> {
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")]
impl UpdateBios1 {
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 {
proxy: proxy.clone(),
};
let gpu_tdp_limit = GpuTdpLimit1 {
proxy: proxy.clone(),
};
let hdmi_cec = HdmiCec1::new(&session).await?;
let manager2 = Manager2 {
proxy: proxy.clone(),
@ -552,6 +549,9 @@ pub(crate) async fn create_interfaces(
proxy: proxy.clone(),
job_manager: job_manager.clone(),
};
let tdp_limit = TdpLimit1 {
proxy: proxy.clone(),
};
let update_bios = UpdateBios1 {
proxy: proxy.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?;
}
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() {
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?;
}
if get_tdp_limit().await.is_ok() {
object_server.at(MANAGER_PATH, tdp_limit).await?;
}
if config
.as_ref()
.is_some_and(|config| config.update_bios.is_some())
@ -836,10 +836,10 @@ mod test {
}
#[tokio::test]
async fn interface_matches_gpu_tdp_limit1() {
async fn interface_matches_tdp_limit1() {
let test = start(all_config()).await.expect("start");
assert!(test_interface_matches::<GpuTdpLimit1>(&test.connection)
assert!(test_interface_matches::<TdpLimit1>(&test.connection)
.await
.unwrap());
}