fix(about): add fallback for hardware model and processor

This commit is contained in:
Jonathan Capps 2025-09-08 19:43:41 +01:00 committed by GitHub
parent f3456ffc18
commit bd7fc2a2f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -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<OsStr>>(