mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- Fixes to asusctl CLI tool to show fan curves
|
- Fixes to asusctl CLI tool to show fan curves
|
||||||
- Fixes to asusd to ensure fan curve defaults are loaded if the config file fails
|
- Fixes to asusd to ensure fan curve defaults are loaded if the config file fails
|
||||||
|
- Further refine the asusctl CLI for fan-curve control
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Support for GV601V LED modes
|
- Support for GV601V LED modes
|
||||||
|
|||||||
@@ -678,10 +678,13 @@ fn handle_fan_curve(
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd.enabled.is_some() || cmd.fan.is_some() || cmd.data.is_some())
|
if (cmd.enable_fan_curves.is_some() || cmd.fan.is_some() || cmd.data.is_some())
|
||||||
&& cmd.mod_profile.is_none()
|
&& cmd.mod_profile.is_none()
|
||||||
{
|
{
|
||||||
println!("--enabled, --fan, and --data options require --mod-profile");
|
println!(
|
||||||
|
"--enable-fan-curves, --enable-fan-curve, --fan, and --data options require \
|
||||||
|
--mod-profile"
|
||||||
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,18 +701,31 @@ fn handle_fan_curve(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(profile) = cmd.mod_profile {
|
if let Some(profile) = cmd.mod_profile {
|
||||||
if cmd.enabled.is_none() && cmd.data.is_none() {
|
if cmd.enable_fan_curves.is_none() && cmd.data.is_none() {
|
||||||
let data = dbus.proxies().profile().fan_curve_data(profile)?;
|
let data = dbus.proxies().profile().fan_curve_data(profile)?;
|
||||||
let data = toml::to_string(&data)?;
|
let data = toml::to_string(&data)?;
|
||||||
println!("\nFan curves for {:?}\n\n{}", profile, data);
|
println!("\nFan curves for {:?}\n\n{}", profile, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(enabled) = cmd.enabled {
|
if let Some(enabled) = cmd.enable_fan_curves {
|
||||||
dbus.proxies()
|
dbus.proxies()
|
||||||
.profile()
|
.profile()
|
||||||
.set_fan_curves_enabled(profile, enabled)?;
|
.set_fan_curves_enabled(profile, enabled)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(enabled) = cmd.enable_fan_curve {
|
||||||
|
if let Some(fan) = cmd.fan {
|
||||||
|
dbus.proxies()
|
||||||
|
.profile()
|
||||||
|
.set_profile_fan_curve_enabled(profile, fan, enabled)?;
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"--enable-fan-curves, --enable-fan-curve, --fan, and --data options require \
|
||||||
|
--mod-profile"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(mut curve) = cmd.data.clone() {
|
if let Some(mut curve) = cmd.data.clone() {
|
||||||
let fan = cmd.fan.unwrap_or_default();
|
let fan = cmd.fan.unwrap_or_default();
|
||||||
curve.set_fan(fan);
|
curve.set_fan(fan);
|
||||||
|
|||||||
@@ -39,20 +39,28 @@ pub struct FanCurveCommand {
|
|||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
meta = "",
|
meta = "",
|
||||||
help = "enable or disable <true/false> fan curve. `mod_profile` required"
|
help = "enable or disable <true/false> fan all curves for a profile. `--mod_profile` \
|
||||||
|
required"
|
||||||
)]
|
)]
|
||||||
pub enabled: Option<bool>,
|
pub enable_fan_curves: Option<bool>,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
meta = "",
|
meta = "",
|
||||||
help = "select fan <cpu/gpu/mid> to modify. `mod_profile` required"
|
help = "enable or disable <true/false> a single fan curve for a profile. `--mod_profile` \
|
||||||
|
and `--fan` required"
|
||||||
|
)]
|
||||||
|
pub enable_fan_curve: Option<bool>,
|
||||||
|
|
||||||
|
#[options(
|
||||||
|
meta = "",
|
||||||
|
help = "select fan <cpu/gpu/mid> to modify. `--mod_profile` required"
|
||||||
)]
|
)]
|
||||||
pub fan: Option<FanCurvePU>,
|
pub fan: Option<FanCurvePU>,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
meta = "",
|
meta = "",
|
||||||
help = "data format = 30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%,109c:58%.
|
help = "data format = 30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%,109c:58%. \
|
||||||
`--mod-profile` required. If '%' is omitted the fan range is 0-255"
|
`--mod-profile` required. If '%' is omitted the fan range is 0-255"
|
||||||
)]
|
)]
|
||||||
pub data: Option<CurveData>,
|
pub data: Option<CurveData>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ trait Profile {
|
|||||||
/// Set a single fan curve for a profile to enabled status. Will also
|
/// Set a single fan curve for a profile to enabled status. Will also
|
||||||
/// activate a fan curve.
|
/// activate a fan curve.
|
||||||
async fn set_profile_fan_curve_enabled(
|
async fn set_profile_fan_curve_enabled(
|
||||||
&mut self,
|
&self,
|
||||||
profile: Profile,
|
profile: Profile,
|
||||||
fan: FanCurvePU,
|
fan: FanCurvePU,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ pub struct CurveData {
|
|||||||
impl From<&CurveData> for String {
|
impl From<&CurveData> for String {
|
||||||
fn from(c: &CurveData) -> Self {
|
fn from(c: &CurveData) -> Self {
|
||||||
format!(
|
format!(
|
||||||
"{:?}: {}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%",
|
"{:?}: enabled: {}, {}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%,{}c:{}%",
|
||||||
c.fan,
|
c.fan,
|
||||||
|
c.enabled,
|
||||||
c.temp[0],
|
c.temp[0],
|
||||||
(c.pwm[0] as u32) * 100 / 255,
|
(c.pwm[0] as u32) * 100 / 255,
|
||||||
c.temp[1],
|
c.temp[1],
|
||||||
@@ -193,9 +194,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn curve_data_from_str_to_str() {
|
fn curve_data_from_str_to_str() {
|
||||||
let curve =
|
let mut curve =
|
||||||
CurveData::from_str("30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%,109c:58%")
|
CurveData::from_str("30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%,109c:58%")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
curve.enabled = true;
|
||||||
assert_eq!(curve.fan, FanCurvePU::CPU);
|
assert_eq!(curve.fan, FanCurvePU::CPU);
|
||||||
assert_eq!(curve.temp, [30, 49, 59, 69, 79, 89, 99, 109]);
|
assert_eq!(curve.temp, [30, 49, 59, 69, 79, 89, 99, 109]);
|
||||||
assert_eq!(curve.pwm, [3, 5, 8, 10, 79, 125, 143, 148]);
|
assert_eq!(curve.pwm, [3, 5, 8, 10, 79, 125, 143, 148]);
|
||||||
@@ -204,7 +206,7 @@ mod tests {
|
|||||||
// End result is slightly different due to type conversions and rounding errors
|
// End result is slightly different due to type conversions and rounding errors
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
string.as_str(),
|
string.as_str(),
|
||||||
"CPU: 30c:1%,49c:1%,59c:3%,69c:3%,79c:30%,89c:49%,99c:56%,109c:58%"
|
"CPU: enabled: true, 30c:1%,49c:1%,59c:3%,69c:3%,79c:30%,89c:49%,99c:56%,109c:58%"
|
||||||
);
|
);
|
||||||
|
|
||||||
let curve = CurveData::from_str("30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%");
|
let curve = CurveData::from_str("30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%");
|
||||||
|
|||||||
Reference in New Issue
Block a user