MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / smbios_info

Function smbios_info

framework_lib/src/commandline/mod.rs:2236–2334  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2234}
2235
2236fn smbios_info() {
2237 println!("Summary");
2238 println!(" Is Framework: {}", is_framework());
2239 if let Some(platform) = smbios::get_platform() {
2240 println!(" Platform: {:?}", platform);
2241 } else {
2242 println!(" Platform: Unknown",);
2243 }
2244
2245 let smbios = get_smbios();
2246 if smbios.is_none() {
2247 error!("Failed to find SMBIOS");
2248 return;
2249 }
2250 for result in smbios.unwrap().structures() {
2251 match result {
2252 Ok(Structure::Bios(data)) => {
2253 println!("BIOS Information");
2254 if !data.vendor.is_empty() {
2255 println!(" Vendor: {}", data.vendor);
2256 }
2257 if !data.bios_version.is_empty() {
2258 println!(" Version: {}", data.bios_version);
2259 }
2260 if !data.bios_release_date.is_empty() {
2261 println!(" Release Date: {}", data.bios_release_date);
2262 }
2263 }
2264 Ok(Structure::System(data)) => {
2265 println!("System Information");
2266 if !data.version.is_empty() {
2267 let version = data.version;
2268 // Assumes it's ASCII, which is guaranteed by SMBIOS
2269 let config_digit0 = &version[0..1];
2270 let config_digit0 = u8::from_str_radix(config_digit0, 16);
2271 if let Ok(version_config) =
2272 config_digit0.map(<ConfigDigit0 as FromPrimitive>::from_u8)
2273 {
2274 println!(" Version: {:?} ({})", version_config, version);
2275 } else {
2276 println!(" Version: '{}'", version);
2277 }
2278 }
2279 if !data.manufacturer.is_empty() {
2280 println!(" Manufacturer: {}", data.manufacturer);
2281 }
2282 if !data.product.is_empty() {
2283 println!(" Product Name: {}", data.product);
2284 }
2285 if let Some(wakeup) = data.wakeup {
2286 println!(" Wake-Up-Type: {:?}", wakeup);
2287 }
2288 if let Some(sku) = data.sku {
2289 if !sku.is_empty() {
2290 println!(" SKU Number: {}", sku);
2291 }
2292 }
2293 if !data.serial.is_empty() {

Callers 1

run_with_argsFunction · 0.85

Calls 3

get_platformFunction · 0.85
get_smbiosFunction · 0.85
structuresMethod · 0.80

Tested by

no test coverage detected