From 1b94bf2a2662f929e37583ce431de13090bc07c7 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 also add note about rust 1.53 or newer to README.md and bump ./rust-toolchain to 1.55 (latest release) 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 (and, I believe, is being used in the Linux daemon) moron --- .gitignore | 1 + README.md | 2 +- rust-toolchain | 2 +- src/main.rs | 13 +++++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c4bf..d81f12e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/.idea diff --git a/README.md b/README.md index 1ff7432..ab58729 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Thelio Io Windows Driver (WORK IN PROGRESS) - Install GIT LFS prior to cloning this repository -- Install Rust from https://rustup.rs/ +- Install Rust from https://rustup.rs/ 1.53.0 or newer (ie `rustup toolchain install 1.55.0`) - Install Chocolaty from https://chocolatey.org/install - Launch an Administrator Command Prompt and run the following: ``` diff --git a/rust-toolchain b/rust-toolchain index 5a5c721..094d6ad 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.50.0 +1.55.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!(