Skip to content

Commit

Permalink
smbios: Print some BaseBoard information
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Jul 19, 2024
1 parent acc908a commit a076f9b
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,13 +960,11 @@ fn smbios_info() {
if let Some(version) = dmidecode_string_val(&data.version()) {
// Assumes it's ASCII, which is guaranteed by SMBIOS
let config_digit0 = &version[0..1];
let config_digit0 = u8::from_str_radix(config_digit0, 16).unwrap();
if let Some(version_config) =
<ConfigDigit0 as FromPrimitive>::from_u8(config_digit0)
{
let config_digit0 = u8::from_str_radix(config_digit0, 16);
if let Ok(version_config) = config_digit0.map(<ConfigDigit0 as FromPrimitive>::from_u8) {
println!(" Version: {:?} ({})", version_config, version);
} else {
println!(" Version: {}", version);
println!(" Version: '{}'", version);
}
}
if let Some(manufacturer) = dmidecode_string_val(&data.manufacturer()) {
Expand All @@ -979,12 +977,37 @@ fn smbios_info() {
println!(" Wake-Up-Type: {:?}", wake_up_type.value);
}
if let Some(sku_number) = dmidecode_string_val(&data.sku_number()) {
println!(" SKU Number: {}", sku_number);
println!(" SKU Number: '{}'", sku_number);
}
if let Some(sn) = dmidecode_string_val(&data.serial_number()) {
println!(" Serial Number:{}", sn);
}
if let Some(family) = dmidecode_string_val(&data.family()) {
println!(" Family: {}", family);
}
}
DefinedStruct::BaseBoardInformation(data) => {
println!("BaseBoard Information");
if let Some(version) = dmidecode_string_val(&data.version()) {
// Assumes it's ASCII, which is guaranteed by SMBIOS
let config_digit0 = &version[0..1];
let config_digit0 = u8::from_str_radix(config_digit0, 16);
if let Ok(version_config) = config_digit0.map(<ConfigDigit0 as FromPrimitive>::from_u8) {
println!(" Version: {:?} ({})", version_config, version);
} else {
println!(" Version: '{}'", version);
}
}
if let Some(manufacturer) = dmidecode_string_val(&data.manufacturer()) {
println!(" Manufacturer: {}", manufacturer);
}
if let Some(product_name) = dmidecode_string_val(&data.product()) {
println!(" Product: {}", product_name);
}
if let Some(sn) = dmidecode_string_val(&data.serial_number()) {
println!(" Serial Number:{}", sn);
}
}
_ => {}
}
}
Expand Down

0 comments on commit a076f9b

Please sign in to comment.