mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Fix applying disabled and enabled fan curves
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
|
||||
use log::trace;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use typeshare::typeshare;
|
||||
@@ -186,14 +183,9 @@ impl CurveData {
|
||||
}
|
||||
|
||||
// Enable must be done *after* all points are written pwm3_enable
|
||||
// device.syspath()
|
||||
let mut path = device.syspath().to_path_buf();
|
||||
path.push(format!("pwm{pwm_num}_enable"));
|
||||
let mut f = OpenOptions::new().write(true).open(path).unwrap();
|
||||
f.write_all(&[enable as u8]).unwrap();
|
||||
// device
|
||||
// .set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string())
|
||||
// .unwrap();
|
||||
device
|
||||
.set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string())
|
||||
.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,13 @@ impl FanCurveProfiles {
|
||||
ThrottlePolicy::Performance => &mut self.performance,
|
||||
ThrottlePolicy::Quiet => &mut self.quiet,
|
||||
};
|
||||
for fan in fans {
|
||||
for fan in fans.iter().filter(|f| !f.enabled) {
|
||||
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
||||
fan.write_to_device(device)?;
|
||||
}
|
||||
// Write enabled fans last because the kernel currently resets *all* if one is
|
||||
// disabled
|
||||
for fan in fans.iter().filter(|f| f.enabled) {
|
||||
debug!("write_profile_curve_to_platform: writing profile:{profile}, {fan:?}");
|
||||
fan.write_to_device(device)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user