From bd7fc2a2f22d96a4fec1f8e2fc092a6fa931a68a Mon Sep 17 00:00:00 2001 From: Jonathan Capps <68860609+cappsyco@users.noreply.github.com> Date: Mon, 8 Sep 2025 19:43:41 +0100 Subject: [PATCH] fix(about): add fallback for hardware model and processor --- Cargo.lock | 2 +- pages/system/src/about.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 504abd5..d5b9685 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8432,7 +8432,7 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.60.2", ] [[package]] diff --git a/pages/system/src/about.rs b/pages/system/src/about.rs index fb4542d..fa5116f 100644 --- a/pages/system/src/about.rs +++ b/pages/system/src/about.rs @@ -146,6 +146,9 @@ pub fn hardware_model(bump: &Bump, hardware_model: &mut String) { } } } + } else { + // simple fallback to sysinfo if DMI information is not available + hardware_model.push_str(&sysinfo::Product::name().unwrap_or("".to_string())); } } @@ -186,6 +189,12 @@ pub fn processor_name(bump: &Bump, name: &mut String) { } } } + + // fallback to sysinfo if /proc/cpuinfo is not present + let s = sysinfo::System::new_with_specifics( + sysinfo::RefreshKind::nothing().with_cpu(sysinfo::CpuRefreshKind::everything()), + ); + name.push_str(s.cpus().into_iter().nth(0).unwrap().brand()); } pub fn read_to_string<'a, P: AsRef>(