mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 319373faea | |||
| f6aa3e3d01 | |||
| d11fc20bab | |||
| b0e1b21e4b | |||
| 1c1daaa6d2 | |||
| c3b5de843f | |||
| 09dcfb4065 | |||
| b2e7211bbe | |||
| 1ab1adf937 | |||
| a21bf779b0 | |||
| 0dba22529c | |||
| 180d63620b | |||
| daea1f538c | |||
| f5e2484797 | |||
| 7105ae40c6 | |||
| 33f9900ef9 |
@@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v6.1.15]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Reflect the current asus-armoury status on AC plug connection status change
|
||||||
|
|
||||||
|
## [v6.1.14]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Fix formatting
|
||||||
|
- Attempt to fix tests
|
||||||
|
|
||||||
## [v6.1.13]
|
## [v6.1.13]
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
Generated
+14
-14
@@ -155,7 +155,7 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusctl"
|
name = "asusctl"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
@@ -174,7 +174,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd"
|
name = "asusd"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cargo-husky",
|
"cargo-husky",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -201,7 +201,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "asusd-user"
|
name = "asusd-user"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"config-traits",
|
"config-traits",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -892,7 +892,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "config-traits"
|
name = "config-traits"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"ron",
|
"ron",
|
||||||
@@ -1232,7 +1232,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dmi_id"
|
name = "dmi_id"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"udev 0.8.0",
|
"udev 0.8.0",
|
||||||
@@ -4371,7 +4371,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog-control-center"
|
name = "rog-control-center"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
@@ -4402,7 +4402,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_anime"
|
name = "rog_anime"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
"gif 0.12.0",
|
"gif 0.12.0",
|
||||||
@@ -4416,7 +4416,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_aura"
|
name = "rog_aura"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
"log",
|
"log",
|
||||||
@@ -4427,7 +4427,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_dbus"
|
name = "rog_dbus"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"asusd",
|
"asusd",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -4441,7 +4441,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_platform"
|
name = "rog_platform"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"concat-idents",
|
"concat-idents",
|
||||||
"inotify",
|
"inotify",
|
||||||
@@ -4454,7 +4454,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_profiles"
|
name = "rog_profiles"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"rog_platform",
|
"rog_platform",
|
||||||
@@ -4465,7 +4465,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_scsi"
|
name = "rog_scsi"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ron",
|
"ron",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -4475,7 +4475,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_simulators"
|
name = "rog_simulators"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"rog_anime",
|
"rog_anime",
|
||||||
@@ -4485,7 +4485,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rog_slash"
|
name = "rog_slash"
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dmi_id",
|
"dmi_id",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "6.1.13"
|
version = "6.1.15"
|
||||||
rust-version = "1.82"
|
rust-version = "1.82"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
+2
-2
@@ -1171,9 +1171,9 @@ fn print_firmware_attr(attr: &AsusArmouryProxyBlocking) -> Result<(), Box<dyn st
|
|||||||
|
|
||||||
fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error::Error>> {
|
fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
{
|
{
|
||||||
if cmd.free.is_empty() || cmd.free.len() % 2 != 0 || cmd.help {
|
if cmd.free.is_empty() || !cmd.free.len().is_multiple_of(2) || cmd.help {
|
||||||
const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5";
|
const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5";
|
||||||
if cmd.free.len() % 2 != 0 {
|
if !cmd.free.len().is_multiple_of(2) {
|
||||||
println!(
|
println!(
|
||||||
"Incorrect number of args, each attribute label must be paired with a setting:"
|
"Incorrect number of args, each attribute label must be paired with a setting:"
|
||||||
);
|
);
|
||||||
|
|||||||
+185
-48
@@ -55,6 +55,25 @@ impl AsusArmouryAttribute {
|
|||||||
String::from(self.attr.name())
|
String::from(self.attr.name())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn resolve_i32_value(refreshed: Option<i32>, cached: &AttrValue) -> i32 {
|
||||||
|
refreshed
|
||||||
|
.or(match cached {
|
||||||
|
AttrValue::Integer(i) => Some(*i),
|
||||||
|
_ => None,
|
||||||
|
})
|
||||||
|
.unwrap_or(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn emit_limits(&self, connection: &Connection) -> Result<(), RogError> {
|
||||||
|
let path = dbus_path_for_attr(self.attr.name());
|
||||||
|
let signal = SignalEmitter::new(connection, path)?;
|
||||||
|
self.min_value_changed(&signal).await?;
|
||||||
|
self.max_value_changed(&signal).await?;
|
||||||
|
self.scalar_increment_changed(&signal).await?;
|
||||||
|
self.current_value_changed(&signal).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn move_to_zbus(self, connection: &Connection) -> Result<(), RogError> {
|
pub async fn move_to_zbus(self, connection: &Connection) -> Result<(), RogError> {
|
||||||
let path = dbus_path_for_attr(self.attr.name());
|
let path = dbus_path_for_attr(self.attr.name());
|
||||||
connection
|
connection
|
||||||
@@ -91,7 +110,8 @@ impl AsusArmouryAttribute {
|
|||||||
.await;
|
.await;
|
||||||
} else {
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"inotify event stream failed for {} ({}). You can ignore this if unsupported",
|
"inotify event stream failed for {} ({}). You can ignore this \
|
||||||
|
if unsupported",
|
||||||
name, $attr_str
|
name, $attr_str
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -116,6 +136,35 @@ impl AsusArmouryAttribute {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default)]
|
||||||
|
pub struct ArmouryAttributeRegistry {
|
||||||
|
attrs: Vec<AsusArmouryAttribute>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ArmouryAttributeRegistry {
|
||||||
|
pub fn push(&mut self, attr: AsusArmouryAttribute) {
|
||||||
|
self.attrs.push(attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn emit_limits(&self, connection: &Connection) -> Result<(), RogError> {
|
||||||
|
let mut last_err: Option<RogError> = None;
|
||||||
|
for attr in &self.attrs {
|
||||||
|
if let Err(e) = attr.emit_limits(connection).await {
|
||||||
|
error!(
|
||||||
|
"Failed to emit updated limits for attribute '{}': {e:?}",
|
||||||
|
attr.attribute_name()
|
||||||
|
);
|
||||||
|
last_err = Some(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(err) = last_err {
|
||||||
|
Err(err)
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl crate::Reloadable for AsusArmouryAttribute {
|
impl crate::Reloadable for AsusArmouryAttribute {
|
||||||
async fn reload(&mut self) -> Result<(), RogError> {
|
async fn reload(&mut self) -> Result<(), RogError> {
|
||||||
info!("Reloading {}", self.attr.name());
|
info!("Reloading {}", self.attr.name());
|
||||||
@@ -130,25 +179,31 @@ impl crate::Reloadable for AsusArmouryAttribute {
|
|||||||
error!("Could not get power status: {e:?}");
|
error!("Could not get power status: {e:?}");
|
||||||
e
|
e
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default()
|
||||||
let config = if power_plugged == 1 {
|
== 1;
|
||||||
&self.config.lock().await.ac_profile_tunings
|
|
||||||
} else {
|
let apply_value = {
|
||||||
&self.config.lock().await.dc_profile_tunings
|
let config = self.config.lock().await;
|
||||||
|
config
|
||||||
|
.select_tunings_ref(power_plugged, profile)
|
||||||
|
.and_then(|tuning| {
|
||||||
|
if tuning.enabled {
|
||||||
|
tuning.group.get(&self.name()).copied()
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
};
|
};
|
||||||
if let Some(tuning) = config.get(&profile) {
|
|
||||||
if tuning.enabled {
|
if let Some(tune) = apply_value {
|
||||||
if let Some(tune) = tuning.group.get(&self.name()) {
|
self.attr
|
||||||
self.attr
|
.set_current_value(&AttrValue::Integer(tune))
|
||||||
.set_current_value(&AttrValue::Integer(*tune))
|
.map_err(|e| {
|
||||||
.map_err(|e| {
|
error!("Could not set {} value: {e:?}", self.attr.name());
|
||||||
error!("Could not set {} value: {e:?}", self.attr.name());
|
self.attr.base_path_exists();
|
||||||
self.attr.base_path_exists();
|
e
|
||||||
e
|
})?;
|
||||||
})?;
|
info!("Set {} to {:?}", self.attr.name(), tune);
|
||||||
info!("Set {} to {:?}", self.attr.name(), tune);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Handle non-PPT attributes (boolean and other settings)
|
// Handle non-PPT attributes (boolean and other settings)
|
||||||
@@ -160,7 +215,11 @@ impl crate::Reloadable for AsusArmouryAttribute {
|
|||||||
self.attr.base_path_exists();
|
self.attr.base_path_exists();
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
info!("Restored armoury setting {} to {:?}", self.attr.name(), saved_value);
|
info!(
|
||||||
|
"Restored armoury setting {} to {:?}",
|
||||||
|
self.attr.name(),
|
||||||
|
saved_value
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,26 +310,20 @@ impl AsusArmouryAttribute {
|
|||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn min_value(&self) -> i32 {
|
async fn min_value(&self) -> i32 {
|
||||||
match self.attr.min_value() {
|
Self::resolve_i32_value(self.attr.refresh_min_value(), self.attr.min_value())
|
||||||
AttrValue::Integer(i) => *i,
|
|
||||||
_ => -1,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn max_value(&self) -> i32 {
|
async fn max_value(&self) -> i32 {
|
||||||
match self.attr.max_value() {
|
Self::resolve_i32_value(self.attr.refresh_max_value(), self.attr.max_value())
|
||||||
AttrValue::Integer(i) => *i,
|
|
||||||
_ => -1,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn scalar_increment(&self) -> i32 {
|
async fn scalar_increment(&self) -> i32 {
|
||||||
match self.attr.scalar_increment() {
|
Self::resolve_i32_value(
|
||||||
AttrValue::Integer(i) => *i,
|
self.attr.refresh_scalar_increment(),
|
||||||
_ => -1,
|
self.attr.scalar_increment(),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
@@ -292,12 +345,15 @@ impl AsusArmouryAttribute {
|
|||||||
error!("Could not get power status: {e:?}");
|
error!("Could not get power status: {e:?}");
|
||||||
e
|
e
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default()
|
||||||
let mut config = self.config.lock().await;
|
== 1;
|
||||||
let tuning = config.select_tunings(power_plugged == 1, profile);
|
let config = self.config.lock().await;
|
||||||
if let Some(tune) = tuning.group.get(&self.name()) {
|
if let Some(tuning) = config.select_tunings_ref(power_plugged, profile) {
|
||||||
return Ok(*tune);
|
if let Some(tune) = tuning.group.get(&self.name()) {
|
||||||
} else if let AttrValue::Integer(i) = self.attr.default_value() {
|
return Ok(*tune);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let AttrValue::Integer(i) = self.attr.default_value() {
|
||||||
return Ok(*i);
|
return Ok(*i);
|
||||||
}
|
}
|
||||||
return Err(fdo::Error::Failed(
|
return Err(fdo::Error::Failed(
|
||||||
@@ -313,6 +369,83 @@ impl AsusArmouryAttribute {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn stored_value_for_power(&self, on_ac: bool) -> fdo::Result<i32> {
|
||||||
|
if !self.name().is_ppt() {
|
||||||
|
return Err(fdo::Error::NotSupported(
|
||||||
|
"Stored values are only available for PPT attributes".to_string(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
|
let config = self.config.lock().await;
|
||||||
|
if let Some(tuning) = config.select_tunings_ref(on_ac, profile) {
|
||||||
|
if let Some(tune) = tuning.group.get(&self.name()) {
|
||||||
|
return Ok(*tune);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let AttrValue::Integer(i) = self.attr.default_value() {
|
||||||
|
return Ok(*i);
|
||||||
|
}
|
||||||
|
Err(fdo::Error::Failed(
|
||||||
|
"Could not read stored value".to_string(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn set_value_for_power(&mut self, on_ac: bool, value: i32) -> fdo::Result<()> {
|
||||||
|
if !self.name().is_ppt() {
|
||||||
|
return Err(fdo::Error::NotSupported(
|
||||||
|
"Setting stored values is only supported for PPT attributes".to_string(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let profile: PlatformProfile = self.platform.get_platform_profile()?.into();
|
||||||
|
let apply_now;
|
||||||
|
|
||||||
|
{
|
||||||
|
let mut config = self.config.lock().await;
|
||||||
|
let tuning = config.select_tunings(on_ac, profile);
|
||||||
|
|
||||||
|
if let Some(tune) = tuning.group.get_mut(&self.name()) {
|
||||||
|
*tune = value;
|
||||||
|
} else {
|
||||||
|
tuning.group.insert(self.name(), value);
|
||||||
|
debug!(
|
||||||
|
"Store {} value for {} power = {}",
|
||||||
|
self.attr.name(),
|
||||||
|
if on_ac { "AC" } else { "DC" },
|
||||||
|
value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_now = tuning.enabled;
|
||||||
|
config.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
if apply_now {
|
||||||
|
let power_plugged = self
|
||||||
|
.power
|
||||||
|
.get_online()
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("Could not get power status: {e:?}");
|
||||||
|
e
|
||||||
|
})
|
||||||
|
.unwrap_or_default()
|
||||||
|
!= 0;
|
||||||
|
|
||||||
|
if power_plugged == on_ac {
|
||||||
|
self.attr
|
||||||
|
.set_current_value(&AttrValue::Integer(value))
|
||||||
|
.map_err(|e| {
|
||||||
|
error!("Could not set value: {e:?}");
|
||||||
|
e
|
||||||
|
})?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[zbus(property)]
|
#[zbus(property)]
|
||||||
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
|
async fn set_current_value(&mut self, value: i32) -> fdo::Result<()> {
|
||||||
if self.name().is_ppt() {
|
if self.name().is_ppt() {
|
||||||
@@ -388,7 +521,8 @@ pub async fn start_attributes_zbus(
|
|||||||
power: AsusPower,
|
power: AsusPower,
|
||||||
attributes: FirmwareAttributes,
|
attributes: FirmwareAttributes,
|
||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
) -> Result<(), RogError> {
|
) -> Result<ArmouryAttributeRegistry, RogError> {
|
||||||
|
let mut registry = ArmouryAttributeRegistry::default();
|
||||||
for attr in attributes.attributes() {
|
for attr in attributes.attributes() {
|
||||||
let mut attr = AsusArmouryAttribute::new(
|
let mut attr = AsusArmouryAttribute::new(
|
||||||
attr.clone(),
|
attr.clone(),
|
||||||
@@ -397,6 +531,8 @@ pub async fn start_attributes_zbus(
|
|||||||
config.clone(),
|
config.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let registry_attr = attr.clone();
|
||||||
|
|
||||||
if let Err(e) = attr.reload().await {
|
if let Err(e) = attr.reload().await {
|
||||||
error!(
|
error!(
|
||||||
"Skipping attribute '{}' due to reload error: {e:?}",
|
"Skipping attribute '{}' due to reload error: {e:?}",
|
||||||
@@ -412,24 +548,25 @@ pub async fn start_attributes_zbus(
|
|||||||
match zbus::object_server::SignalEmitter::new(conn, path) {
|
match zbus::object_server::SignalEmitter::new(conn, path) {
|
||||||
Ok(sig) => {
|
Ok(sig) => {
|
||||||
if let Err(e) = attr.watch_and_notify(sig).await {
|
if let Err(e) = attr.watch_and_notify(sig).await {
|
||||||
error!(
|
error!("Failed to start watcher for '{}': {e:?}", attr.attr.name());
|
||||||
"Failed to start watcher for '{}': {e:?}",
|
|
||||||
attr.attr.name()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("Failed to create SignalEmitter for '{}': {e:?}", attr.attr.name());
|
error!(
|
||||||
|
"Failed to create SignalEmitter for '{}': {e:?}",
|
||||||
|
attr.attr.name()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = attr.move_to_zbus(conn).await {
|
if let Err(e) = attr.move_to_zbus(conn).await {
|
||||||
error!(
|
error!("Failed to register attribute '{attr_name}' on zbus: {e:?}");
|
||||||
"Failed to register attribute '{attr_name}' on zbus: {e:?}"
|
continue;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registry.push(registry_attr);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn set_config_or_default(
|
pub async fn set_config_or_default(
|
||||||
|
|||||||
@@ -82,8 +82,9 @@ impl AuraConfig {
|
|||||||
config
|
config
|
||||||
.builtins
|
.builtins
|
||||||
.insert(*n, AuraEffect::default_with_mode(*n));
|
.insert(*n, AuraEffect::default_with_mode(*n));
|
||||||
|
}
|
||||||
if !config.support_data.basic_zones.is_empty() {
|
if !config.support_data.basic_zones.is_empty() {
|
||||||
|
for n in &config.support_data.basic_modes {
|
||||||
let mut default = vec![];
|
let mut default = vec![];
|
||||||
for (i, tmp) in config.support_data.basic_zones.iter().enumerate() {
|
for (i, tmp) in config.support_data.basic_zones.iter().enumerate() {
|
||||||
default.push(AuraEffect {
|
default.push(AuraEffect {
|
||||||
@@ -118,14 +119,14 @@ impl AuraConfig {
|
|||||||
self.multizone_on = false;
|
self.multizone_on = false;
|
||||||
} else {
|
} else {
|
||||||
if let Some(multi) = self.multizone.as_mut() {
|
if let Some(multi) = self.multizone.as_mut() {
|
||||||
if let Some(fx) = multi.get_mut(effect.mode()) {
|
if let Some(fx_vec) = multi.get_mut(effect.mode()) {
|
||||||
for fx in fx.iter_mut() {
|
for fx in fx_vec.iter_mut() {
|
||||||
if fx.zone == effect.zone {
|
if fx.zone == effect.zone {
|
||||||
*fx = effect;
|
*fx = effect;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fx.push(effect);
|
fx_vec.push(effect);
|
||||||
} else {
|
} else {
|
||||||
multi.insert(*effect.mode(), vec![effect]);
|
multi.insert(*effect.mode(), vec![effect]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ impl Aura {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<AuraConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, AuraConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ impl ScsiAura {
|
|||||||
Self { device, config }
|
Self { device, config }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<ScsiConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, ScsiConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ impl Slash {
|
|||||||
Self { hid, usb, config }
|
Self { hid, usb, config }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<SlashConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, SlashConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-2
@@ -67,6 +67,19 @@ impl Config {
|
|||||||
};
|
};
|
||||||
config.entry(profile).or_insert_with(Tuning::default)
|
config.entry(profile).or_insert_with(Tuning::default)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn select_tunings_ref(
|
||||||
|
&self,
|
||||||
|
power_plugged: bool,
|
||||||
|
profile: PlatformProfile,
|
||||||
|
) -> Option<&Tuning> {
|
||||||
|
let config = if power_plugged {
|
||||||
|
&self.ac_profile_tunings
|
||||||
|
} else {
|
||||||
|
&self.dc_profile_tunings
|
||||||
|
};
|
||||||
|
config.get(&profile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@@ -146,7 +159,7 @@ pub struct Config611 {
|
|||||||
|
|
||||||
impl From<Config611> for Config {
|
impl From<Config611> for Config {
|
||||||
fn from(c: Config611) -> Self {
|
fn from(c: Config611) -> Self {
|
||||||
Self {
|
let mut config = Self {
|
||||||
// Restore the base charge limit
|
// Restore the base charge limit
|
||||||
charge_control_end_threshold: c.charge_control_end_threshold,
|
charge_control_end_threshold: c.charge_control_end_threshold,
|
||||||
base_charge_control_end_threshold: c.charge_control_end_threshold,
|
base_charge_control_end_threshold: c.charge_control_end_threshold,
|
||||||
@@ -168,7 +181,12 @@ impl From<Config611> for Config {
|
|||||||
armoury_settings: HashMap::default(),
|
armoury_settings: HashMap::default(),
|
||||||
screenpad_gamma: None,
|
screenpad_gamma: None,
|
||||||
screenpad_sync_primary: Default::default(),
|
screenpad_sync_primary: Default::default(),
|
||||||
}
|
};
|
||||||
|
|
||||||
|
config.ac_profile_tunings = c.ac_profile_tunings;
|
||||||
|
config.dc_profile_tunings = c.dc_profile_tunings;
|
||||||
|
config.armoury_settings = c.armoury_settings;
|
||||||
|
config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use zbus::fdo::Error as FdoErr;
|
|||||||
use zbus::object_server::SignalEmitter;
|
use zbus::object_server::SignalEmitter;
|
||||||
use zbus::{interface, Connection};
|
use zbus::{interface, Connection};
|
||||||
|
|
||||||
use crate::asus_armoury::set_config_or_default;
|
use crate::asus_armoury::{set_config_or_default, ArmouryAttributeRegistry};
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::error::RogError;
|
use crate::error::RogError;
|
||||||
use crate::{task_watch_item, CtrlTask, ReloadAndNotify};
|
use crate::{task_watch_item, CtrlTask, ReloadAndNotify};
|
||||||
@@ -46,6 +46,8 @@ pub struct CtrlPlatform {
|
|||||||
attributes: FirmwareAttributes,
|
attributes: FirmwareAttributes,
|
||||||
cpu_control: Option<CPUControl>,
|
cpu_control: Option<CPUControl>,
|
||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
|
connection: Connection,
|
||||||
|
armoury_registry: ArmouryAttributeRegistry,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CtrlPlatform {
|
impl CtrlPlatform {
|
||||||
@@ -56,6 +58,8 @@ impl CtrlPlatform {
|
|||||||
config: Arc<Mutex<Config>>,
|
config: Arc<Mutex<Config>>,
|
||||||
config_path: &Path,
|
config_path: &Path,
|
||||||
signal_context: SignalEmitter<'static>,
|
signal_context: SignalEmitter<'static>,
|
||||||
|
connection: Connection,
|
||||||
|
armoury_registry: ArmouryAttributeRegistry,
|
||||||
) -> Result<Self, RogError> {
|
) -> Result<Self, RogError> {
|
||||||
let config1 = config.clone();
|
let config1 = config.clone();
|
||||||
let config_path = config_path.to_owned();
|
let config_path = config_path.to_owned();
|
||||||
@@ -68,6 +72,8 @@ impl CtrlPlatform {
|
|||||||
cpu_control: CPUControl::new()
|
cpu_control: CPUControl::new()
|
||||||
.map_err(|e| error!("Couldn't get CPU control sysfs: {e}"))
|
.map_err(|e| error!("Couldn't get CPU control sysfs: {e}"))
|
||||||
.ok(),
|
.ok(),
|
||||||
|
connection,
|
||||||
|
armoury_registry,
|
||||||
};
|
};
|
||||||
let mut inotify_self = ret_self.clone();
|
let mut inotify_self = ret_self.clone();
|
||||||
|
|
||||||
@@ -729,6 +735,31 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
}
|
}
|
||||||
if !sleeping {
|
if !sleeping {
|
||||||
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
platform1.run_ac_or_bat_cmd(power_plugged > 0).await;
|
||||||
|
if let Ok(profile) =
|
||||||
|
platform1.platform.get_platform_profile().map(|p| p.into())
|
||||||
|
{
|
||||||
|
let attrs = FirmwareAttributes::new();
|
||||||
|
{
|
||||||
|
let mut cfg = platform1.config.lock().await;
|
||||||
|
set_config_or_default(
|
||||||
|
&attrs,
|
||||||
|
&mut cfg,
|
||||||
|
power_plugged > 0,
|
||||||
|
profile,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
if let Err(e) = platform1
|
||||||
|
.armoury_registry
|
||||||
|
.emit_limits(&platform1.connection)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
error!(
|
||||||
|
"Failed to emit armoury updates after power change: \
|
||||||
|
{e:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
platform1.config.lock().await.last_power_plugged = power_plugged;
|
platform1.config.lock().await.last_power_plugged = power_plugged;
|
||||||
}
|
}
|
||||||
@@ -789,13 +820,17 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
{
|
{
|
||||||
// TODO: manage this better, shouldn't need to create every time
|
// TODO: manage this better, shouldn't need to create every time
|
||||||
let attrs = FirmwareAttributes::new();
|
let attrs = FirmwareAttributes::new();
|
||||||
set_config_or_default(
|
{
|
||||||
&attrs,
|
let mut cfg = platform3.config.lock().await;
|
||||||
&mut *platform3.config.lock().await,
|
set_config_or_default(&attrs, &mut cfg, power_plugged, profile).await;
|
||||||
power_plugged,
|
}
|
||||||
profile,
|
if let Err(e) = platform3
|
||||||
)
|
.armoury_registry
|
||||||
.await;
|
.emit_limits(&platform3.connection)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
error!("Failed to emit armoury updates after AC/DC toggle: {e:?}");
|
||||||
|
}
|
||||||
platform3
|
platform3
|
||||||
.enable_ppt_group_changed(&signal_ctxt_copy)
|
.enable_ppt_group_changed(&signal_ctxt_copy)
|
||||||
.await
|
.await
|
||||||
@@ -852,6 +887,9 @@ impl CtrlTask for CtrlPlatform {
|
|||||||
profile,
|
profile,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
if let Err(e) = ctrl.armoury_registry.emit_limits(&ctrl.connection).await {
|
||||||
|
error!("Failed to emit armoury updates after profile change: {e:?}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-4
@@ -3,7 +3,7 @@ use std::error::Error;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use ::zbus::Connection;
|
use ::zbus::Connection;
|
||||||
use asusd::asus_armoury::start_attributes_zbus;
|
use asusd::asus_armoury::{start_attributes_zbus, ArmouryAttributeRegistry};
|
||||||
use asusd::aura_manager::DeviceManager;
|
use asusd::aura_manager::DeviceManager;
|
||||||
use asusd::config::Config;
|
use asusd::config::Config;
|
||||||
use asusd::ctrl_backlight::CtrlBacklight;
|
use asusd::ctrl_backlight::CtrlBacklight;
|
||||||
@@ -74,7 +74,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
|
let platform = RogPlatform::new()?; // TODO: maybe needs async mutex?
|
||||||
let power = AsusPower::new()?; // TODO: maybe needs async mutex?
|
let power = AsusPower::new()?; // TODO: maybe needs async mutex?
|
||||||
let attributes = FirmwareAttributes::new();
|
let attributes = FirmwareAttributes::new();
|
||||||
if let Err(e) = start_attributes_zbus(
|
let armoury_registry = match start_attributes_zbus(
|
||||||
&server,
|
&server,
|
||||||
platform.clone(),
|
platform.clone(),
|
||||||
power.clone(),
|
power.clone(),
|
||||||
@@ -83,8 +83,12 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
error!("Failed to initialize firmware attributes over zbus: {e:?}");
|
Ok(registry) => registry,
|
||||||
}
|
Err(e) => {
|
||||||
|
error!("Failed to initialize firmware attributes over zbus: {e:?}");
|
||||||
|
ArmouryAttributeRegistry::default()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
match CtrlFanCurveZbus::new() {
|
match CtrlFanCurveZbus::new() {
|
||||||
Ok(ctrl) => {
|
Ok(ctrl) => {
|
||||||
@@ -113,6 +117,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
config.clone(),
|
config.clone(),
|
||||||
&cfg_path,
|
&cfg_path,
|
||||||
CtrlPlatform::signal_context(&server)?,
|
CtrlPlatform::signal_context(&server)?,
|
||||||
|
server.clone(),
|
||||||
|
armoury_registry,
|
||||||
) {
|
) {
|
||||||
Ok(ctrl) => {
|
Ok(ctrl) => {
|
||||||
let sig_ctx = CtrlPlatform::signal_context(&server)?;
|
let sig_ctx = CtrlPlatform::signal_context(&server)?;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ ENV{DMI_FAMILY}=="*Strix*", GOTO="asusd_start"
|
|||||||
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
|
ENV{DMI_FAMILY}=="*Vivo*ook*", GOTO="asusd_start"
|
||||||
ENV{DMI_FAMILY}=="*Zenbook*", GOTO="asusd_start"
|
ENV{DMI_FAMILY}=="*Zenbook*", GOTO="asusd_start"
|
||||||
ENV{DMI_FAMILY}=="*ProArt*", GOTO="asusd_start"
|
ENV{DMI_FAMILY}=="*ProArt*", GOTO="asusd_start"
|
||||||
|
ENV{DMI_FAMILY}=="*TX Air*", GOTO="asusd_start"
|
||||||
ENV{DMI_FAMILY}=="*TX Gaming*", GOTO="asusd_start"
|
ENV{DMI_FAMILY}=="*TX Gaming*", GOTO="asusd_start"
|
||||||
# No match so
|
# No match so
|
||||||
GOTO="asusd_end"
|
GOTO="asusd_end"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define version 6.1.13
|
%define version 6.1.15
|
||||||
%define specrelease %{?dist}
|
%define specrelease %{?dist}
|
||||||
%define pkg_release 9%{specrelease}
|
%define pkg_release 9%{specrelease}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ impl AnimeImage {
|
|||||||
// first 5 rows for GA401 are always at X = 0
|
// first 5 rows for GA401 are always at X = 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
(y + 1) / 2 - 3
|
y.div_ceil(2) - 3
|
||||||
}
|
}
|
||||||
AnimeType::GU604 => {
|
AnimeType::GU604 => {
|
||||||
// first 9 rows start at zero
|
// first 9 rows start at zero
|
||||||
@@ -185,7 +185,7 @@ impl AnimeImage {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// and then their offset grows by one every two rows
|
// and then their offset grows by one every two rows
|
||||||
(y + 1) / 2 - 5
|
y.div_ceil(2) - 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ impl AnimeImage {
|
|||||||
// First 5 rows for GA401 are always 33 physical LEDs long
|
// First 5 rows for GA401 are always 33 physical LEDs long
|
||||||
return 33;
|
return 33;
|
||||||
}
|
}
|
||||||
36 - (y + 1) / 2
|
36 - y.div_ceil(2)
|
||||||
}
|
}
|
||||||
AnimeType::GU604 => {
|
AnimeType::GU604 => {
|
||||||
if y <= 9 {
|
if y <= 9 {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel};
|
|||||||
use super::show_toast;
|
use super::show_toast;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::zbus_proxies::find_iface_async;
|
use crate::zbus_proxies::find_iface_async;
|
||||||
use crate::{set_ui_callbacks, set_ui_props_async, AttrMinMax, MainWindow, SystemPageData};
|
use crate::{set_ui_callbacks, AttrMinMax, MainWindow, SystemPageData};
|
||||||
|
|
||||||
const MINMAX: AttrMinMax = AttrMinMax {
|
const MINMAX: AttrMinMax = AttrMinMax {
|
||||||
min: 0,
|
min: 0,
|
||||||
@@ -572,120 +572,123 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
|
|
||||||
for attr in armoury_attrs {
|
for attr in armoury_attrs {
|
||||||
if let Ok(value) = attr.current_value().await {
|
if let Ok(value) = attr.current_value().await {
|
||||||
let name = attr.name().await.unwrap();
|
if let Ok(name) = attr.name().await {
|
||||||
debug!("Setting up {} = {value}", <&str>::from(name));
|
debug!("Setting up {} = {value}", <&str>::from(name));
|
||||||
let platform = platform.clone();
|
let platform = platform.clone();
|
||||||
handle
|
handle
|
||||||
.upgrade_in_event_loop(move |handle| match name {
|
.upgrade_in_event_loop(move |handle| match name {
|
||||||
FirmwareAttribute::ApuMem => {}
|
FirmwareAttribute::ApuMem => {}
|
||||||
FirmwareAttribute::CoresPerformance => {}
|
FirmwareAttribute::CoresPerformance => {}
|
||||||
FirmwareAttribute::CoresEfficiency => {}
|
FirmwareAttribute::CoresEfficiency => {}
|
||||||
FirmwareAttribute::PptEnabled => {
|
FirmwareAttribute::PptEnabled => {
|
||||||
init_property!(ppt_enabled, handle, value, bool);
|
init_property!(ppt_enabled, handle, value, bool);
|
||||||
setup_callback!(ppt_enabled, handle, attr, bool);
|
setup_callback!(ppt_enabled, handle, attr, bool);
|
||||||
let handle_copy = handle.as_weak();
|
let handle_copy = handle.as_weak();
|
||||||
let proxy_copy = attr.clone();
|
let proxy_copy = attr.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut x = proxy_copy.receive_current_value_changed().await;
|
let mut x = proxy_copy.receive_current_value_changed().await;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
while let Some(e) = x.next().await {
|
while let Some(e) = x.next().await {
|
||||||
if let Ok(out) = e.get().await {
|
if let Ok(out) = e.get().await {
|
||||||
handle_copy
|
handle_copy
|
||||||
.upgrade_in_event_loop(move |handle| {
|
.upgrade_in_event_loop(move |handle| {
|
||||||
handle
|
handle
|
||||||
.global::<SystemPageData>()
|
.global::<SystemPageData>()
|
||||||
.set_enable_ppt_group(out == 1);
|
.set_enable_ppt_group(out == 1);
|
||||||
handle
|
handle
|
||||||
.global::<SystemPageData>()
|
.global::<SystemPageData>()
|
||||||
.set_ppt_enabled(out == 1);
|
.set_ppt_enabled(out == 1);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
handle
|
||||||
handle
|
.global::<SystemPageData>()
|
||||||
.global::<SystemPageData>()
|
.set_ppt_enabled_available(true);
|
||||||
.set_ppt_enabled_available(true);
|
handle
|
||||||
handle
|
.global::<SystemPageData>()
|
||||||
.global::<SystemPageData>()
|
.set_enable_ppt_group(value == 1);
|
||||||
.set_enable_ppt_group(value == 1);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl1Spl => {
|
||||||
FirmwareAttribute::PptPl1Spl => {
|
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
||||||
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
setup_callback!(ppt_pl1_spl, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl1_spl, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
|
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl2Sppt => {
|
||||||
FirmwareAttribute::PptPl2Sppt => {
|
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
|
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl3Fppt => {
|
||||||
FirmwareAttribute::PptPl3Fppt => {
|
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
||||||
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
|
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptFppt => {
|
||||||
FirmwareAttribute::PptFppt => {
|
init_minmax_property!(ppt_fppt, handle, attr);
|
||||||
init_minmax_property!(ppt_fppt, handle, attr);
|
setup_callback!(ppt_fppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_fppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptApuSppt => {
|
||||||
FirmwareAttribute::PptApuSppt => {
|
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
setup_callback!(ppt_apu_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_apu_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
|
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPlatformSppt => {
|
||||||
FirmwareAttribute::PptPlatformSppt => {
|
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
setup_callback!(ppt_platform_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_platform_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
|
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::NvDynamicBoost => {
|
||||||
FirmwareAttribute::NvDynamicBoost => {
|
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
||||||
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
setup_callback!(nv_dynamic_boost, handle, attr, i32);
|
||||||
setup_callback!(nv_dynamic_boost, handle, attr, i32);
|
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
|
||||||
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
|
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
|
||||||
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::NvTempTarget => {
|
||||||
FirmwareAttribute::NvTempTarget => {
|
init_minmax_property!(nv_temp_target, handle, attr);
|
||||||
init_minmax_property!(nv_temp_target, handle, attr);
|
setup_callback!(nv_temp_target, handle, attr, i32);
|
||||||
setup_callback!(nv_temp_target, handle, attr, i32);
|
setup_callback_restore_default!(nv_temp_target, handle, attr);
|
||||||
setup_callback_restore_default!(nv_temp_target, handle, attr);
|
setup_minmax_external!(nv_temp_target, handle, attr, platform);
|
||||||
setup_minmax_external!(nv_temp_target, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::DgpuBaseTgp => {}
|
||||||
FirmwareAttribute::DgpuBaseTgp => {}
|
FirmwareAttribute::DgpuTgp => {}
|
||||||
FirmwareAttribute::DgpuTgp => {}
|
FirmwareAttribute::ChargeMode => {}
|
||||||
FirmwareAttribute::ChargeMode => {}
|
FirmwareAttribute::BootSound => {
|
||||||
FirmwareAttribute::BootSound => {
|
init_property!(boot_sound, handle, value, i32);
|
||||||
init_property!(boot_sound, handle, value, i32);
|
setup_callback!(boot_sound, handle, attr, i32);
|
||||||
setup_callback!(boot_sound, handle, attr, i32);
|
setup_external!(boot_sound, i32, handle, attr, value)
|
||||||
setup_external!(boot_sound, i32, handle, attr, value)
|
}
|
||||||
}
|
FirmwareAttribute::McuPowersave => {}
|
||||||
FirmwareAttribute::McuPowersave => {}
|
FirmwareAttribute::PanelOverdrive => {
|
||||||
FirmwareAttribute::PanelOverdrive => {
|
init_property!(panel_overdrive, handle, value, i32);
|
||||||
init_property!(panel_overdrive, handle, value, i32);
|
setup_callback!(panel_overdrive, handle, attr, i32);
|
||||||
setup_callback!(panel_overdrive, handle, attr, i32);
|
setup_external!(panel_overdrive, i32, handle, attr, value)
|
||||||
setup_external!(panel_overdrive, i32, handle, attr, value)
|
}
|
||||||
}
|
FirmwareAttribute::PanelHdMode => {}
|
||||||
FirmwareAttribute::PanelHdMode => {}
|
FirmwareAttribute::EgpuConnected => {}
|
||||||
FirmwareAttribute::EgpuConnected => {}
|
FirmwareAttribute::EgpuEnable => {}
|
||||||
FirmwareAttribute::EgpuEnable => {}
|
FirmwareAttribute::DgpuDisable => {}
|
||||||
FirmwareAttribute::DgpuDisable => {}
|
FirmwareAttribute::GpuMuxMode => {}
|
||||||
FirmwareAttribute::GpuMuxMode => {}
|
FirmwareAttribute::MiniLedMode => {
|
||||||
FirmwareAttribute::MiniLedMode => {
|
init_property!(mini_led_mode, handle, value, i32);
|
||||||
init_property!(mini_led_mode, handle, value, i32);
|
setup_callback!(mini_led_mode, handle, attr, i32);
|
||||||
setup_callback!(mini_led_mode, handle, attr, i32);
|
setup_external!(mini_led_mode, i32, handle, attr, value);
|
||||||
setup_external!(mini_led_mode, i32, handle, attr, value);
|
}
|
||||||
}
|
FirmwareAttribute::PendingReboot => {}
|
||||||
FirmwareAttribute::PendingReboot => {}
|
FirmwareAttribute::None => {}
|
||||||
FirmwareAttribute::None => {}
|
})
|
||||||
})
|
.ok();
|
||||||
.ok();
|
} else {
|
||||||
|
error!("Attribute with no name, skipping");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle
|
handle
|
||||||
|
|||||||
@@ -190,7 +190,9 @@ export component MainWindow inherits Window {
|
|||||||
y: 0px;
|
y: 0px;
|
||||||
width: root.width;
|
width: root.width;
|
||||||
height: root.height;
|
height: root.height;
|
||||||
padding: 10px;
|
|
||||||
|
//padding only has effect on layout elements
|
||||||
|
//padding: 10px;
|
||||||
|
|
||||||
background: Palette.background;
|
background: Palette.background;
|
||||||
border-color: Palette.border;
|
border-color: Palette.border;
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export component PageAnime inherits Rectangle {
|
|||||||
property <bool> show_builtin_advanced: false;
|
property <bool> show_builtin_advanced: false;
|
||||||
clip: true;
|
clip: true;
|
||||||
// TODO: slow with border-radius
|
// TODO: slow with border-radius
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 8px;
|
||||||
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
|
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
|
||||||
// TODO: border-radius: 8px;
|
// TODO: border-radius: 8px;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export component PageAppSettings inherits VerticalLayout {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
clip: true;
|
clip: true;
|
||||||
// TODO: slow with border-radius
|
// TODO: slow with border-radius
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 8px;
|
||||||
|
|
||||||
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
|
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
|
||||||
// TODO: border-radius: 8px;
|
// TODO: border-radius: 8px;
|
||||||
mainview := VerticalLayout {
|
mainview := VerticalLayout {
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ export component PageAura inherits Rectangle {
|
|||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
max-height: 90px;
|
max-height: 90px;
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Zone");
|
text: @tr("Zone");
|
||||||
@@ -136,7 +137,8 @@ export component PageAura inherits Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Direction");
|
text: @tr("Direction");
|
||||||
@@ -158,7 +160,8 @@ export component PageAura inherits Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Speed");
|
text: @tr("Speed");
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ export component PageSystem inherits Rectangle {
|
|||||||
property <bool> show_fade_cover: false;
|
property <bool> show_fade_cover: false;
|
||||||
property <bool> show_throttle_advanced: false;
|
property <bool> show_throttle_advanced: false;
|
||||||
clip: true;
|
clip: true;
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 8px;
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -301,7 +302,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_pl1_spl.current != -1 || SystemPageData.ppt_pl2_sppt.current != -1 || SystemPageData.ppt_pl3_fppt.current != -1 || SystemPageData.ppt_fppt.current != -1 || SystemPageData.ppt_apu_sppt.current != -1 || SystemPageData.nv_temp_target.current != -1 || SystemPageData.nv_dynamic_boost.current != -1: HorizontalLayout {
|
if (SystemPageData.ppt_pl1_spl.max > 0 && SystemPageData.ppt_pl1_spl.current != -1) || (SystemPageData.ppt_pl2_sppt.max > 0 && SystemPageData.ppt_pl2_sppt.current != -1) || (SystemPageData.ppt_pl3_fppt.max > 0 && SystemPageData.ppt_pl3_fppt.current != -1) || (SystemPageData.ppt_fppt.max > 0 && SystemPageData.ppt_fppt.current != -1) || (SystemPageData.ppt_apu_sppt.max > 0 && SystemPageData.ppt_apu_sppt.current != -1) || (SystemPageData.nv_temp_target.max > 0 && SystemPageData.nv_temp_target.current != -1) || (SystemPageData.nv_dynamic_boost.max > 0 && SystemPageData.nv_dynamic_boost.current != -1): HorizontalLayout {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
alignment: LayoutAlignment.space-between;
|
alignment: LayoutAlignment.space-between;
|
||||||
@@ -330,7 +331,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_pl1_spl.current != -1: SystemSlider {
|
if SystemPageData.ppt_pl1_spl.max > 0 && SystemPageData.ppt_pl1_spl.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
text: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
||||||
title: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
title: @tr("ppt_pl1_spl" => "CPU Sustained Power Limit");
|
||||||
help_text: @tr("ppt_pl1_spl_help" => "Long-term CPU power limit that affects sustained workload performance. Higher values may increase heat and power consumption.");
|
help_text: @tr("ppt_pl1_spl_help" => "Long-term CPU power limit that affects sustained workload performance. Higher values may increase heat and power consumption.");
|
||||||
@@ -348,7 +349,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_pl2_sppt.current != -1: SystemSlider {
|
if SystemPageData.ppt_pl2_sppt.max > 0 && SystemPageData.ppt_pl2_sppt.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
text: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
||||||
title: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
title: @tr("ppt_pl2_sppt" => "CPU Turbo Power Limit");
|
||||||
help_text: @tr("ppt_pl2_sppt_help" => "Short-term CPU power limit for boost periods. Controls maximum power during brief high-performance bursts.");
|
help_text: @tr("ppt_pl2_sppt_help" => "Short-term CPU power limit for boost periods. Controls maximum power during brief high-performance bursts.");
|
||||||
@@ -366,7 +367,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_pl3_fppt.current != -1: SystemSlider {
|
if SystemPageData.ppt_pl3_fppt.max > 0 && SystemPageData.ppt_pl3_fppt.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
text: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
||||||
title: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
title: @tr("ppt_pl3_fppt" => "CPU Fast Burst Power Limit");
|
||||||
help_text: @tr("ppt_pl3_fppt_help" => "Ultra-short duration power limit for instantaneous CPU bursts. Affects responsiveness during sudden workload spikes.");
|
help_text: @tr("ppt_pl3_fppt_help" => "Ultra-short duration power limit for instantaneous CPU bursts. Affects responsiveness during sudden workload spikes.");
|
||||||
@@ -383,7 +384,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
SystemPageData.cb_ppt_pl3_fppt(Math.round(value));
|
SystemPageData.cb_ppt_pl3_fppt(Math.round(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if SystemPageData.ppt_fppt.current != -1: SystemSlider {
|
if SystemPageData.ppt_fppt.max > 0 && SystemPageData.ppt_fppt.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_fppt" => "Fast Package Power Limit");
|
text: @tr("ppt_fppt" => "Fast Package Power Limit");
|
||||||
title: @tr("ppt_fppt" => "Fast Package Power Limit");
|
title: @tr("ppt_fppt" => "Fast Package Power Limit");
|
||||||
help_text: @tr("ppt_fppt_help" => "Ultra-short duration power limit for system package. Controls maximum power during millisecond-scale load spikes.");
|
help_text: @tr("ppt_fppt_help" => "Ultra-short duration power limit for system package. Controls maximum power during millisecond-scale load spikes.");
|
||||||
@@ -401,7 +402,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_apu_sppt.current != -1: SystemSlider {
|
if SystemPageData.ppt_apu_sppt.max > 0 && SystemPageData.ppt_apu_sppt.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
text: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
||||||
title: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
title: @tr("ppt_apu_sppt" => "APU Sustained Power Limit");
|
||||||
help_text: @tr("ppt_apu_sppt_help" => "Long-term power limit for integrated graphics and CPU combined. Affects sustained performance of APU-based workloads.");
|
help_text: @tr("ppt_apu_sppt_help" => "Long-term power limit for integrated graphics and CPU combined. Affects sustained performance of APU-based workloads.");
|
||||||
@@ -419,7 +420,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.ppt_platform_sppt.current != -1: SystemSlider {
|
if SystemPageData.ppt_platform_sppt.max > 0 && SystemPageData.ppt_platform_sppt.current != -1: SystemSlider {
|
||||||
text: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
text: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
||||||
title: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
title: @tr("ppt_platform_sppt" => "Platform Sustained Power Limit");
|
||||||
help_text: @tr("ppt_platform_sppt_help" => "Overall system power limit for sustained operations. Controls total platform power consumption over extended periods.");
|
help_text: @tr("ppt_platform_sppt_help" => "Overall system power limit for sustained operations. Controls total platform power consumption over extended periods.");
|
||||||
@@ -437,7 +438,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.nv_dynamic_boost.current != -1: SystemSlider {
|
if SystemPageData.nv_dynamic_boost.max > 0 && SystemPageData.nv_dynamic_boost.current != -1: SystemSlider {
|
||||||
text: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
text: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
||||||
title: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
title: @tr("nv_dynamic_boost" => "GPU Power Boost");
|
||||||
help_text: @tr("nv_dynamic_boost_help" => "Additional power allocation for GPU dynamic boost. Higher values increase GPU performance but generate more heat.");
|
help_text: @tr("nv_dynamic_boost_help" => "Additional power allocation for GPU dynamic boost. Higher values increase GPU performance but generate more heat.");
|
||||||
@@ -455,7 +456,7 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if SystemPageData.nv_temp_target.current != -1: SystemSlider {
|
if SystemPageData.nv_temp_target.max > 0 && SystemPageData.nv_temp_target.current != -1: SystemSlider {
|
||||||
text: @tr("nv_temp_target" => "GPU Temperature Limit");
|
text: @tr("nv_temp_target" => "GPU Temperature Limit");
|
||||||
title: @tr("nv_temp_target" => "GPU Temperature Limit");
|
title: @tr("nv_temp_target" => "GPU Temperature Limit");
|
||||||
help_text: @tr("nv_temp_target_help" => "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain temperature below this limit.");
|
help_text: @tr("nv_temp_target_help" => "Maximum GPU temperature threshold in Celsius. GPU will throttle to maintain temperature below this limit.");
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
||||||
|
|
||||||
component SideBarItem inherits Rectangle {
|
component SideBarItem inherits Rectangle {
|
||||||
padding: 10px;
|
// padding only has effect on layout elements
|
||||||
|
// padding: 10px;
|
||||||
in property <bool> selected;
|
in property <bool> selected;
|
||||||
in property <bool> has-focus;
|
in property <bool> has-focus;
|
||||||
in-out property <string> text <=> label.text;
|
in-out property <string> text <=> label.text;
|
||||||
|
|||||||
@@ -124,6 +124,22 @@ impl Attribute {
|
|||||||
&self.scalar_increment
|
&self.scalar_increment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_attr_i32(&self, name: &str) -> Option<i32> {
|
||||||
|
read_i32(&self.base_path.join(name)).ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn refresh_min_value(&self) -> Option<i32> {
|
||||||
|
self.read_attr_i32("min_value")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn refresh_max_value(&self) -> Option<i32> {
|
||||||
|
self.read_attr_i32("max_value")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn refresh_scalar_increment(&self) -> Option<i32> {
|
||||||
|
self.read_attr_i32("scalar_increment")
|
||||||
|
}
|
||||||
|
|
||||||
/// Read all the immutable values to struct data. These should *never*
|
/// Read all the immutable values to struct data. These should *never*
|
||||||
/// change, if they do then it is possibly a driver issue - although this is
|
/// change, if they do then it is possibly a driver issue - although this is
|
||||||
/// subject to `firmware_attributes` class changes in kernel.
|
/// subject to `firmware_attributes` class changes in kernel.
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ pub fn find_fan_curve_node() -> Result<Device, ProfileError> {
|
|||||||
derive(Type, Value, OwnedValue),
|
derive(Type, Value, OwnedValue),
|
||||||
zvariant(signature = "s")
|
zvariant(signature = "s")
|
||||||
)]
|
)]
|
||||||
#[derive(Deserialize, Serialize, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
#[derive(Default, Deserialize, Serialize, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum FanCurvePU {
|
pub enum FanCurvePU {
|
||||||
|
#[default]
|
||||||
CPU = 0,
|
CPU = 0,
|
||||||
GPU = 1,
|
GPU = 1,
|
||||||
MID = 2,
|
MID = 2,
|
||||||
@@ -100,12 +101,6 @@ impl std::str::FromStr for FanCurvePU {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FanCurvePU {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::CPU
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Main purpose of `FanCurves` is to enable restoring state on system boot
|
/// Main purpose of `FanCurves` is to enable restoring state on system boot
|
||||||
#[cfg_attr(feature = "dbus", derive(Type))]
|
#[cfg_attr(feature = "dbus", derive(Type))]
|
||||||
#[derive(Deserialize, Serialize, Debug, Default)]
|
#[derive(Deserialize, Serialize, Debug, Default)]
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
canvas.set_draw_color(Color::RGB(*b, *b, *b));
|
canvas.set_draw_color(Color::RGB(*b, *b, *b));
|
||||||
|
|
||||||
let x: i32 = w + x_count as i32 * w
|
let x: i32 = w + x_count as i32 * w
|
||||||
- if (y_count + y_offset as usize) % 2 != 0 {
|
- if !(y_count + y_offset as usize).is_multiple_of(2) {
|
||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
w / 2
|
w / 2
|
||||||
|
|||||||
Reference in New Issue
Block a user