Skip to content

Commit

Permalink
Merge pull request #54 from FrameworkComputer/smbios-baseboard
Browse files Browse the repository at this point in the history
smbios: Print some BaseBoard information
  • Loading branch information
JohnAZoidberg authored Aug 13, 2024
2 parents a0fb07d + 5d03584 commit cc8d1ef
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions framework_lib/src/commandline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,13 +993,13 @@ 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 @@ -1014,10 +1014,37 @@ fn smbios_info() {
if let Some(sku_number) = dmidecode_string_val(&data.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 cc8d1ef

Please sign in to comment.