Remove the use of bytes in zbus signatures

This commit is contained in:
Luke D. Jones
2024-02-23 21:50:53 +13:00
parent 7613eded95
commit 96f281d789
11 changed files with 23 additions and 22 deletions

View File

@@ -7,14 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Reintroduce persisting dark/light mode in config file
### Changed
- Added ability to change what EPP is linked with each throttle profile
- Don't change EPP or thermal profile if the battery/ac state hasn't actually changed on resume
- Re-implement the `asusctl -s` command (not fully)
- Add more docs to some parts of code, and dbus interfaces
- Reload asusd.ron if changed. Does not notify any dbus listeners (yet)
- Fix the broken pipe error
- Remove the use of bytes in zbus signatures (another cause of broken pipe)
### Added
- Support for G614J LED modes

View File

@@ -20,6 +20,7 @@ use rog_dbus::RogDbusClientBlocking;
use rog_platform::error::PlatformError;
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
use rog_profiles::error::ProfileError;
use rog_profiles::fan_curve_set::CurveData;
use crate::aura_cli::{AuraPowerStates, LedBrightness};
use crate::cli_opts::*;

View File

@@ -222,10 +222,7 @@ impl CtrlFanCurveZbus {
/// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile.
async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
let active = self
.platform
.get_throttle_thermal_policy()
.unwrap_or(ThrottlePolicy::Balanced.into());
let active = self.platform.get_throttle_thermal_policy()?;
self.platform.set_throttle_thermal_policy(profile.into())?;
self.fan_curves
@@ -281,7 +278,6 @@ impl CtrlTask for CtrlFanCurveZbus {
}
}
}
dbg!("STREAM ENDED");
}
});

View File

@@ -137,7 +137,7 @@ pub struct AuraPowerDev {
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "y")
zvariant(signature = "u")
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
@@ -172,7 +172,7 @@ impl AuraDevTuf {
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "y")
zvariant(signature = "u")
)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]

View File

@@ -230,7 +230,6 @@ pub fn aura_modes_group(states: &mut SystemState, freq: &mut Arc<AtomicU8>, ui:
.aura()
.set_led_mode_data(states.aura.modes.get(&selected).unwrap().clone())
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();

View File

@@ -133,7 +133,6 @@ fn aura_power1(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();
@@ -184,7 +183,6 @@ fn aura_power1(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();
@@ -250,7 +248,6 @@ fn aura_power2(states: &mut SystemState, ui: &mut Ui) {
.aura()
.set_led_power((options, enable))
.map_err(|err| {
dbg!(&err);
states.error = Some(err.to_string());
})
.ok();

View File

@@ -13,6 +13,10 @@ pub fn fan_graphs(
do_error: &mut Option<String>,
ui: &mut Ui,
) {
if curves.available_fans.is_empty() {
return; // TODO:
}
ui.separator();
let mut item = |profile: ThrottlePolicy, ui: &mut Ui| {

View File

@@ -39,7 +39,7 @@ trait FanCurves {
///
/// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile.
fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()>;
fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::Result<()>;
/// SetActiveCurveToDefaults method
fn set_active_curve_to_defaults(&self) -> zbus::Result<()>;

View File

@@ -180,7 +180,7 @@ impl From<CPUGovernor> for String {
}
#[typeshare]
#[repr(u8)]
#[repr(u32)]
#[derive(
Deserialize,
Serialize,
@@ -194,7 +194,7 @@ impl From<CPUGovernor> for String {
Clone,
Copy,
)]
#[zvariant(signature = "y")]
#[zvariant(signature = "u")]
pub enum CPUEPP {
#[default]
Default = 0,

View File

@@ -249,7 +249,7 @@ impl Display for GpuMode {
}
#[typeshare]
#[repr(u8)]
#[repr(u32)]
#[derive(
Deserialize,
Serialize,
@@ -266,7 +266,7 @@ impl Display for GpuMode {
Clone,
Copy,
)]
#[zvariant(signature = "y")]
#[zvariant(signature = "u")]
/// `throttle_thermal_policy` in asus_wmi
pub enum ThrottlePolicy {
#[default]

View File

@@ -10,6 +10,7 @@ use typeshare::typeshare;
pub use udev::Device;
#[cfg(feature = "dbus")]
use zbus::zvariant::Type;
use zbus::zvariant::{OwnedValue, Value};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
@@ -31,12 +32,16 @@ pub fn find_fan_curve_node() -> Result<Device, ProfileError> {
}
#[typeshare]
#[cfg_attr(feature = "dbus", derive(Type), zvariant(signature = "s"))]
#[cfg_attr(
feature = "dbus",
derive(Type, Value, OwnedValue),
zvariant(signature = "s")
)]
#[derive(Deserialize, Serialize, Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum FanCurvePU {
CPU,
GPU,
MID,
CPU = 0,
GPU = 1,
MID = 2,
}
impl FanCurvePU {