Skip to content

Commit

Permalink
fix: gracefully handle transient fan control errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-zlobintsev committed May 11, 2024
1 parent 974e6ff commit aa670be
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lact-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact-cli"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion lact-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact-client"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion lact-daemon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact-daemon"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[features]
Expand Down
19 changes: 15 additions & 4 deletions lact-daemon/src/server/gpu_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use tokio::{
task::JoinHandle,
time::{sleep, timeout},
};
use tracing::{debug, error, trace, warn};
use tracing::{debug, error, info, trace, warn};
#[cfg(feature = "libdrm_amdgpu_sys")]
use {
lact_schema::DrmMemoryInfo,
Expand Down Expand Up @@ -470,6 +470,9 @@ impl GpuController {
let mut last_pwm = (None, Instant::now());
let mut last_temp = 0.0;

// If the fan speed could was able to be set at least once
let mut control_available = false;

let temp_key = settings.temperature_key.clone();
let interval = Duration::from_millis(settings.interval_ms);
let spindown_delay = Duration::from_millis(settings.spindown_delay_ms.unwrap_or(0));
Expand Down Expand Up @@ -513,9 +516,17 @@ impl GpuController {

trace!("fan control tick: setting pwm to {target_pwm}");

if let Err(err) = hw_mon.set_fan_pwm(target_pwm) {
error!("could not set fan speed: {err}, disabling fan control");
break;
match hw_mon.set_fan_pwm(target_pwm) {
Ok(()) => control_available = true,
Err(err) => {
error!("could not set fan speed: {err}");
if control_available {
info!("fan control was previously available, assuming the error is temporary");
} else {
info!("disabling fan control");
break;
}
}
}
}
debug!("exited fan control task");
Expand Down
2 changes: 1 addition & 1 deletion lact-gui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact-gui"
version = "0.5.4"
version = "0.5.5"
authors = ["Ilya Zlobintsev <ilya.zl@protonmail.com>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion lact-schema/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact-schema"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[features]
Expand Down
2 changes: 1 addition & 1 deletion lact/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lact"
version = "0.5.4"
version = "0.5.5"
edition = "2021"

[features]
Expand Down
2 changes: 1 addition & 1 deletion pkg/recipes/lact-headless/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
Expand Down
2 changes: 1 addition & 1 deletion pkg/recipes/lact-libadwaita/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
Expand Down
2 changes: 1 addition & 1 deletion pkg/recipes/lact/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ metadata:
description: AMDGPU control utility
arch: x86_64
license: MIT
version: 0.5.4
version: 0.5.5
maintainer: ilya-zlobintsev
url: https://github.com/ilya-zlobintsev/lact
source:
Expand Down

0 comments on commit aa670be

Please sign in to comment.