bug: fix reading temperature from disabled devices (#911)
This commit is contained in:
parent
4f00434210
commit
a0eebf3acb
|
@ -161,11 +161,16 @@ fn get_from_hwmon(
|
||||||
|
|
||||||
if is_temp_filtered(filter, &name) {
|
if is_temp_filtered(filter, &name) {
|
||||||
let temp = if should_read_temp {
|
let temp = if should_read_temp {
|
||||||
let temp = fs::read_to_string(temp)?;
|
if let Ok(temp) = fs::read_to_string(temp) {
|
||||||
let temp = temp.trim_end().parse::<f32>().map_err(|e| {
|
let temp = temp.trim_end().parse::<f32>().map_err(|e| {
|
||||||
crate::utils::error::BottomError::ConversionError(e.to_string())
|
crate::utils::error::BottomError::ConversionError(e.to_string())
|
||||||
})?;
|
})?;
|
||||||
temp / 1_000.0
|
temp / 1_000.0
|
||||||
|
} else {
|
||||||
|
// For some devices (e.g. iwlwifi), this file becomes empty when the device
|
||||||
|
// is disabled. In this case we skip the device.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue