Skip to content

Commit f2943e7

Browse files
committed
Keep hwmon sensor name for GPUs
1 parent 6f7573d commit f2943e7

File tree

1 file changed

+7
-3
lines changed
  • src/app/data_harvester/temperature

1 file changed

+7
-3
lines changed

src/app/data_harvester/temperature/linux.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,20 @@ fn get_from_hwmon(
114114
let drm = device.join("drm");
115115
if drm.exists() {
116116
// This should never actually be empty
117-
let mut gpu = String::new();
117+
let mut gpu = None;
118118
for card in drm.read_dir()? {
119119
let card = card?;
120120
let name = card.file_name().to_str().unwrap_or_default().to_owned();
121121
if name.starts_with("card") {
122-
gpu = name;
122+
if let Some(hwmon_name) = hwmon_name.as_ref() {
123+
gpu = Some(format!("{} ({})", name, hwmon_name.trim()));
124+
} else {
125+
gpu = Some(name)
126+
}
123127
break;
124128
}
125129
}
126-
Some(gpu)
130+
gpu
127131
} else {
128132
// This little mess is to account for stuff like k10temp
129133
// This is needed because the `device` symlink

0 commit comments

Comments
 (0)