From 6a7e15b7cb4267dca65b168522ef9f3bbc5cb355 Mon Sep 17 00:00:00 2001 From: Paul Bransford Date: Fri, 10 Sep 2021 13:14:30 -0400 Subject: [PATCH] add fan curve support parity with Linux daemon fan curves and model strings current as-of: https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs bump to rust 1.53 (or newer is OK) This is due to the use of "or patterns" inside a match. This was stabilized in rust 1.53: https://github.com/rust-lang/rust/pull/79278 I see similar syntax used in the Linux daemon, but that uses rust 1.41... I'm uncertain how that was building previously? --- rust-toolchain | 2 +- src/main.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index 5a5c721..3f48301 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.50.0 +1.53.0 diff --git a/src/main.rs b/src/main.rs index 284ad8e..1942ffb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,6 +90,19 @@ fn driver() -> io::Result<()> { debug!("{} {} uses standard fan curve", sys_vendor, product_version); FanCurve::standard() }, + ("System76", "thelio-major-r1") => { + debug!("{} {} uses threadripper2 fan curve", sys_vendor, product_version); + FanCurve::threadripper2() + }, + ("System76", "thelio-major-r2" | "thelio-major-r2.1" | "thelio-major-b1" | "thelio-major-b2" + | "thelio-major-b3" | "thelio-mega-r1" | "thelio-mega-r1.1" ) => { + debug!("{} {} uses hedt fan curve", sys_vendor, product_version); + FanCurve::hedt() + }, + ("System76", "thelio-massive-b1") => { + debug!("{} {} uses xeon fan curve", sys_vendor, product_version); + FanCurve::xeon() + }, _ => return Err(io::Error::new( io::ErrorKind::Other, format!(