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

Function get_baseboard_version

framework_lib/src/smbios.rs:148–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148pub fn get_baseboard_version() -> Option<ConfigDigit0> {
149 let Some(smbios) = get_smbios() else {
150 error!("Failed to find SMBIOS");
151 return None;
152 };
153 smbios.structures().find_map(|result| {
154 let Ok(Structure::BaseBoard(board)) = result else {
155 return None;
156 };
157 let version = board.version;
158 if version.is_empty() {
159 return None;
160 }
161 // Assumes it's ASCII, which is guaranteed by SMBIOS
162 let config_digit0 = u8::from_str_radix(&version[0..1], 16);
163 match config_digit0.map(<ConfigDigit0 as FromPrimitive>::from_u8) {
164 Ok(version_config) => version_config,
165 Err(_) => {
166 debug!(" Invalid BaseBoard Version: {}'", version);
167 None
168 }
169 }
170 })
171}
172
173pub fn get_family() -> Option<PlatformFamily> {
174 get_platform().and_then(Platform::which_family)

Callers 1

print_versionsFunction · 0.85

Calls 2

get_smbiosFunction · 0.85
structuresMethod · 0.80

Tested by

no test coverage detected