From 00904e96037e48e492ffb54f8bf264c38014b4c9 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 19 May 2024 22:38:45 +1200 Subject: [PATCH] Don't panic if -ENODEV on fan_curve enable --- CHANGELOG.md | 1 + rog-profiles/src/fan_curve_set.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f64b7562..26a1d6d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Aura support return a default aura definition instead of nothing - Minor updates in aura controller to ensure configs are updated if the support file changes +- Don't panic if -ENODEV on fan_curve enable ## [v6.0.9] diff --git a/rog-profiles/src/fan_curve_set.rs b/rog-profiles/src/fan_curve_set.rs index 0c76d518..1ff43cad 100644 --- a/rog-profiles/src/fan_curve_set.rs +++ b/rog-profiles/src/fan_curve_set.rs @@ -1,4 +1,4 @@ -use log::trace; +use log::{error, trace}; use serde_derive::{Deserialize, Serialize}; use typeshare::typeshare; use udev::Device; @@ -185,7 +185,8 @@ impl CurveData { // Enable must be done *after* all points are written pwm3_enable device .set_attribute_value(format!("pwm{pwm_num}_enable"), enable.to_string()) - .unwrap(); + .map_err(|e| error!("Failed to set pwm{pwm_num}_enable to {enable}: {e:?}")) + .ok(); Ok(()) } }