Use correct fan max range for Steam Deck OLED; fixes #19

This commit is contained in:
NGnius (Graham) 2024-09-29 17:16:22 -04:00
parent 364d9650f2
commit 924f1aaa51
3 changed files with 400 additions and 269 deletions

648
backend-rs/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,7 @@ prost = "0.11"
tokio = { version = "1", features = ["sync", "rt"] } tokio = { version = "1", features = ["sync", "rt"] }
sysfuss = { version = "0.4", features = ["derive"], path = "../../sysfs-nav" } sysfuss = { version = "0.4", features = ["derive"], path = "../../sysfs-nav" }
sysinfo = "0.31"
# logging # logging
log = "0.4" log = "0.4"

View file

@ -175,7 +175,25 @@ fn read_fan(hwmon: &HwMonPath) -> std::io::Result<u64> {
} }
fn fan_range() -> std::ops::Range<f64> { fn fan_range() -> std::ops::Range<f64> {
1.0..7000.0 let sys = sysinfo::System::new_with_specifics(
sysinfo::RefreshKind::new().with_cpu(sysinfo::CpuRefreshKind::everything()),
);
if sys.cpus().is_empty() {
1.0..7123.0
} else {
let cpu_name = sys.cpus()[0].brand();
if cpu_name.contains("AMD Custom APU 0405") {
// LCD
1.0..7000.0
} else if cpu_name.contains("AMD Custom APU 0932") {
// OLED
1.0..9000.0
} else {
// Hopefully never reached
1.0..7001.0
}
}
} }
fn do_fan_control(settings: &Settings, hwmon: &HwMonPath, thermal_zone: f64) { fn do_fan_control(settings: &Settings, hwmon: &HwMonPath, thermal_zone: f64) {