mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d55c2befed | |||
| 4cd9918e1a | |||
| 3a900f23fe |
@@ -2,6 +2,11 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v6.1.10]
|
||||
|
||||
### Changed
|
||||
- asusd: single line fix for profile switching
|
||||
|
||||
## [v6.1.9]
|
||||
|
||||
### Changed
|
||||
|
||||
Generated
+14
-14
@@ -158,7 +158,7 @@ checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||
|
||||
[[package]]
|
||||
name = "asusctl"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"env_logger",
|
||||
@@ -177,7 +177,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"cargo-husky",
|
||||
"concat-idents",
|
||||
@@ -204,7 +204,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "asusd-user"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"config-traits",
|
||||
"dirs",
|
||||
@@ -918,7 +918,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "config-traits"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ron",
|
||||
@@ -1310,7 +1310,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dmi_id"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"log",
|
||||
"udev 0.8.0",
|
||||
@@ -4542,7 +4542,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog-control-center"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"concat-idents",
|
||||
@@ -4573,7 +4573,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_anime"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"gif 0.12.0",
|
||||
@@ -4587,7 +4587,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_aura"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"log",
|
||||
@@ -4598,7 +4598,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_dbus"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"asusd",
|
||||
"rog_anime",
|
||||
@@ -4612,7 +4612,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_platform"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"concat-idents",
|
||||
"inotify",
|
||||
@@ -4625,7 +4625,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_profiles"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_platform",
|
||||
@@ -4636,7 +4636,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_scsi"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"ron",
|
||||
"serde",
|
||||
@@ -4646,7 +4646,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_simulators"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rog_anime",
|
||||
@@ -4656,7 +4656,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rog_slash"
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
dependencies = [
|
||||
"dmi_id",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workspace.package]
|
||||
version = "6.1.9"
|
||||
version = "6.1.10"
|
||||
rust-version = "1.82"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -374,7 +374,7 @@ impl CtrlPlatform {
|
||||
self.config.lock().await.write();
|
||||
|
||||
let choices = self.platform.get_platform_profile_choices()?;
|
||||
if !choices.contains(&PlatformProfile::LowPower) {
|
||||
if !choices.contains(&policy) {
|
||||
return Err(FdoErr::NotSupported(format!(
|
||||
"RogPlatform: platform_profile: {} not supported",
|
||||
policy
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
%define version 6.1.9
|
||||
%define version 6.1.10
|
||||
%define specrelease %{?dist}
|
||||
%define pkg_release 9%{specrelease}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ pub enum Error {
|
||||
ConfigLockFail,
|
||||
XdgVars,
|
||||
Zbus(zbus::Error),
|
||||
ZbusFdo(zbus::fdo::Error),
|
||||
Notification(notify_rust::error::Error),
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ impl fmt::Display for Error {
|
||||
Error::ConfigLockFail => write!(f, "Failed to lock user config"),
|
||||
Error::XdgVars => write!(f, "XDG environment vars appear unset"),
|
||||
Error::Zbus(err) => write!(f, "Error: {}", err),
|
||||
Error::ZbusFdo(err) => write!(f, "Error: {}", err),
|
||||
Error::Notification(err) => write!(f, "Notification Error: {}", err),
|
||||
}
|
||||
}
|
||||
@@ -40,6 +42,12 @@ impl From<zbus::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<zbus::fdo::Error> for Error {
|
||||
fn from(err: zbus::fdo::Error) -> Self {
|
||||
Error::ZbusFdo(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<notify_rust::error::Error> for Error {
|
||||
fn from(err: notify_rust::error::Error) -> Self {
|
||||
Error::Notification(err)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{error, info};
|
||||
use log::error;
|
||||
use rog_dbus::zbus_fan_curves::FanCurvesProxy;
|
||||
use rog_dbus::zbus_platform::PlatformProxy;
|
||||
use rog_platform::platform::PlatformProfile;
|
||||
use rog_profiles::fan_curve_set::CurveData;
|
||||
use slint::{ComponentHandle, Model, Weak};
|
||||
@@ -100,96 +101,122 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
|
||||
|
||||
tokio::spawn(async move {
|
||||
// Create the connections/proxies here to prevent future delays in process
|
||||
let conn = if let Ok(conn) = zbus::Connection::system().await.map_err(|e| error!("{e:}")) {
|
||||
conn
|
||||
} else {
|
||||
return;
|
||||
let conn = match zbus::Connection::system().await {
|
||||
Ok(conn) => conn,
|
||||
Err(e) => {
|
||||
error!("{e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let fans = if let Ok(fans) = FanCurvesProxy::new(&conn).await.map_err(|e| error!("{e:}")) {
|
||||
fans
|
||||
} else {
|
||||
info!(
|
||||
"This device may not have an Fan Curve control. If not then the error can be \
|
||||
ignored"
|
||||
);
|
||||
return;
|
||||
|
||||
let fans = match FanCurvesProxy::new(&conn).await {
|
||||
Ok(fans) => fans,
|
||||
Err(e) => {
|
||||
error!("{e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let platform = match PlatformProxy::new(&conn).await {
|
||||
Ok(platform) => platform,
|
||||
Err(e) => {
|
||||
error!("{e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let platform_profile_choices = match platform.platform_profile_choices().await {
|
||||
Ok(choices) => choices,
|
||||
Err(e) => {
|
||||
error!("{e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let handle_copy = handle.clone();
|
||||
// Do initial setup
|
||||
let Ok(balanced) = fans
|
||||
.fan_curve_data(PlatformProfile::Balanced)
|
||||
.await
|
||||
.map_err(|e| error!("Couldn't get balanced data: {e:}"))
|
||||
else {
|
||||
return;
|
||||
let balanced = match fans.fan_curve_data(PlatformProfile::Balanced).await {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
error!("Couldn't get balanced data: {e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let Ok(perf) = fans
|
||||
.fan_curve_data(PlatformProfile::Performance)
|
||||
.await
|
||||
.map_err(|e| error!("Couldn't get performance data: {e:}"))
|
||||
else {
|
||||
return;
|
||||
|
||||
let perf = match fans.fan_curve_data(PlatformProfile::Performance).await {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
error!("Couldn't get performance data: {e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
let Ok(quiet) = fans
|
||||
.fan_curve_data(PlatformProfile::Quiet)
|
||||
.await
|
||||
.map_err(|e| error!("Couldn't get quiet data: {e:}"))
|
||||
else {
|
||||
return;
|
||||
|
||||
// TODO: the fan curve stuff was written donkeys ago with the expectation that
|
||||
// only 3 profiles existed
|
||||
let profile = if platform_profile_choices.contains(&PlatformProfile::Quiet) {
|
||||
PlatformProfile::Quiet
|
||||
} else {
|
||||
PlatformProfile::Quiet
|
||||
};
|
||||
let quiet = match fans.fan_curve_data(profile).await {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
error!("Couldn't get quiet data: {e:}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
update_fan_data(handle, balanced, perf, quiet);
|
||||
|
||||
let handle_next1 = handle_copy.clone();
|
||||
handle_copy
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
let global = handle.global::<FanPageData>();
|
||||
let fans1 = fans.clone();
|
||||
global.on_set_profile_default(move |profile| {
|
||||
let fans = fans1.clone();
|
||||
let handle_next = handle_next1.clone();
|
||||
tokio::spawn(async move {
|
||||
if fans.set_curves_to_defaults(profile.into()).await.is_err() {
|
||||
return;
|
||||
}
|
||||
let Ok(balanced) = fans
|
||||
.fan_curve_data(PlatformProfile::Balanced)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(perf) = fans
|
||||
.fan_curve_data(PlatformProfile::Performance)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(quiet) = fans
|
||||
.fan_curve_data(PlatformProfile::Quiet)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
update_fan_data(handle_next, balanced, perf, quiet);
|
||||
});
|
||||
if let Err(e) = handle_copy.upgrade_in_event_loop(move |handle| {
|
||||
let global = handle.global::<FanPageData>();
|
||||
let fans1 = fans.clone();
|
||||
global.on_set_profile_default(move |profile| {
|
||||
let fans = fans1.clone();
|
||||
let handle_next = handle_next1.clone();
|
||||
tokio::spawn(async move {
|
||||
if fans.set_curves_to_defaults(profile.into()).await.is_err() {
|
||||
return;
|
||||
}
|
||||
let Ok(balanced) = fans
|
||||
.fan_curve_data(PlatformProfile::Balanced)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(perf) = fans
|
||||
.fan_curve_data(PlatformProfile::Performance)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Ok(quiet) = fans
|
||||
.fan_curve_data(PlatformProfile::Quiet)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
update_fan_data(handle_next, balanced, perf, quiet);
|
||||
});
|
||||
global.on_set_fan_data(move |fan, profile, enabled, data| {
|
||||
let fans = fans.clone();
|
||||
let data: Vec<Node> = data.iter().collect();
|
||||
let data = fan_data_for(fan, enabled, data);
|
||||
tokio::spawn(async move {
|
||||
fans.set_fan_curve(profile.into(), data)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
.ok()
|
||||
});
|
||||
});
|
||||
global.on_set_fan_data(move |fan, profile, enabled, data| {
|
||||
let fans = fans.clone();
|
||||
let data: Vec<Node> = data.iter().collect();
|
||||
let data = fan_data_for(fan, enabled, data);
|
||||
tokio::spawn(async move {
|
||||
fans.set_fan_curve(profile.into(), data)
|
||||
.await
|
||||
.map_err(|e| error!("{e:}"))
|
||||
.ok()
|
||||
});
|
||||
})
|
||||
.map_err(|e| error!("setup_fan_curve_page: upgrade_in_event_loop: {e:?}"))
|
||||
.ok();
|
||||
});
|
||||
}) {
|
||||
error!("setup_fan_curve_page: upgrade_in_event_loop: {e:?}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user