Skip to content

Commit bd7fc2a

Browse files
authored
fix(about): add fallback for hardware model and processor
1 parent f3456ff commit bd7fc2a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pages/system/src/about.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ pub fn hardware_model(bump: &Bump, hardware_model: &mut String) {
146146
}
147147
}
148148
}
149+
} else {
150+
// simple fallback to sysinfo if DMI information is not available
151+
hardware_model.push_str(&sysinfo::Product::name().unwrap_or("".to_string()));
149152
}
150153
}
151154

@@ -186,6 +189,12 @@ pub fn processor_name(bump: &Bump, name: &mut String) {
186189
}
187190
}
188191
}
192+
193+
// fallback to sysinfo if /proc/cpuinfo is not present
194+
let s = sysinfo::System::new_with_specifics(
195+
sysinfo::RefreshKind::nothing().with_cpu(sysinfo::CpuRefreshKind::everything()),
196+
);
197+
name.push_str(s.cpus().into_iter().nth(0).unwrap().brand());
189198
}
190199

191200
pub fn read_to_string<'a, P: AsRef<OsStr>>(

0 commit comments

Comments
 (0)