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] ## [Unreleased]
### Changed ### Changed
- Reintroduce persisting dark/light mode in config file - Reintroduce persisting dark/light mode in config file
### Changed
- Added ability to change what EPP is linked with each throttle profile - 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 - 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) - Re-implement the `asusctl -s` command (not fully)
- Add more docs to some parts of code, and dbus interfaces - Add more docs to some parts of code, and dbus interfaces
- Reload asusd.ron if changed. Does not notify any dbus listeners (yet) - Reload asusd.ron if changed. Does not notify any dbus listeners (yet)
- Fix the broken pipe error - Fix the broken pipe error
- Remove the use of bytes in zbus signatures (another cause of broken pipe)
### Added ### Added
- Support for G614J LED modes - Support for G614J LED modes

View File

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

View File

@@ -222,10 +222,7 @@ impl CtrlFanCurveZbus {
/// Each platform_profile has a different default and the defualt can be /// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile. /// read only for the currently active profile.
async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> { async fn reset_profile_curves(&self, profile: ThrottlePolicy) -> zbus::fdo::Result<()> {
let active = self let active = self.platform.get_throttle_thermal_policy()?;
.platform
.get_throttle_thermal_policy()
.unwrap_or(ThrottlePolicy::Balanced.into());
self.platform.set_throttle_thermal_policy(profile.into())?; self.platform.set_throttle_thermal_policy(profile.into())?;
self.fan_curves 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( #[cfg_attr(
feature = "dbus", feature = "dbus",
derive(Type, Value, OwnedValue), derive(Type, Value, OwnedValue),
zvariant(signature = "y") zvariant(signature = "u")
)] )]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)] #[repr(u32)]
@@ -172,7 +172,7 @@ impl AuraDevTuf {
#[cfg_attr( #[cfg_attr(
feature = "dbus", feature = "dbus",
derive(Type, Value, OwnedValue), derive(Type, Value, OwnedValue),
zvariant(signature = "y") zvariant(signature = "u")
)] )]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)] #[repr(u32)]

View File

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

View File

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

View File

@@ -13,6 +13,10 @@ pub fn fan_graphs(
do_error: &mut Option<String>, do_error: &mut Option<String>,
ui: &mut Ui, ui: &mut Ui,
) { ) {
if curves.available_fans.is_empty() {
return; // TODO:
}
ui.separator(); ui.separator();
let mut item = |profile: ThrottlePolicy, ui: &mut Ui| { 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 /// Each platform_profile has a different default and the defualt can be
/// read only for the currently active profile. /// 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 /// SetActiveCurveToDefaults method
fn set_active_curve_to_defaults(&self) -> zbus::Result<()>; fn set_active_curve_to_defaults(&self) -> zbus::Result<()>;

View File

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

View File

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

View File

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