Skip to content

Commit

Permalink
fix: avoid resetting fan control mode when it is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-zlobintsev committed Oct 31, 2023
1 parent 2bfd4e0 commit df28a63
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lact-daemon/src/server/gpu_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,15 @@ impl GpuController {
}

if reset_mode {
let hw_mon = self
.handle
.hw_monitors
.first()
.cloned()
.context("This GPU has no monitor")?;
hw_mon
.set_fan_control_method(FanControlMethod::Auto)
.context("Could not set fan control back to automatic")?;
if let Some(hw_mon) = self.handle.hw_monitors.first().cloned() {
if let Ok(current_control) = hw_mon.get_fan_control_method() {
if !matches!(current_control, FanControlMethod::Auto) {
hw_mon
.set_fan_control_method(FanControlMethod::Auto)
.context("Could not set fan control back to automatic")?;
}
}
}
}

Ok(())
Expand Down

0 comments on commit df28a63

Please sign in to comment.