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

Function is_framework

framework_lib/src/smbios.rs:99–129  ·  view source on GitHub ↗

Check whether the manufacturer in the SMBIOS says Framework

()

Source from the content-addressed store, hash-verified

97
98/// Check whether the manufacturer in the SMBIOS says Framework
99pub fn is_framework() -> bool {
100 if matches!(
101 get_platform(),
102 Some(Platform::GenericFramework((_, _, _), (_, _, _))) | Some(Platform::UnknownSystem)
103 ) {
104 return true;
105 }
106
107 // If we match any of our platforms, it's our platform
108 if get_platform().is_some() {
109 return true;
110 }
111
112 // Don't need to parse SMBIOS on FreeBSD, can just read kenv
113 #[cfg(target_os = "freebsd")]
114 if let Ok(maker) = kenv_get("smbios.system.maker") {
115 return maker == "Framework";
116 }
117
118 let Some(smbios) = get_smbios() else {
119 return false;
120 };
121
122 for result in smbios.structures() {
123 if let Ok(Structure::System(sys)) = result {
124 return sys.manufacturer == "Framework";
125 }
126 }
127
128 false
129}
130
131pub fn get_product_name() -> Option<String> {
132 // On FreeBSD we can short-circuit and avoid parsing SMBIOS

Callers 3

read_memoryMethod · 0.85
send_commandMethod · 0.85
print_pd_detailsFunction · 0.85

Calls 4

get_platformFunction · 0.85
kenv_getFunction · 0.85
get_smbiosFunction · 0.85
structuresMethod · 0.80

Tested by

no test coverage detected