Skip to content

Commit

Permalink
add fan curve support parity with Linux daemon
Browse files Browse the repository at this point in the history
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: rust-lang/rust#79278

I see similar syntax used in the Linux daemon, but that uses rust
1.41... I'm uncertain how that was building previously?

hurr
  • Loading branch information
draeath committed Sep 10, 2021
1 parent 264b41a commit 3f6255c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.50.0
1.53.0
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down

0 comments on commit 3f6255c

Please sign in to comment.