Check whether the manufacturer in the SMBIOS says Framework
()
| 97 | |
| 98 | /// Check whether the manufacturer in the SMBIOS says Framework |
| 99 | pub 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 | |
| 131 | pub fn get_product_name() -> Option<String> { |
| 132 | // On FreeBSD we can short-circuit and avoid parsing SMBIOS |
no test coverage detected