@@ -6,10 +6,10 @@ use std::prelude::v1::*;
66#[ cfg( all( not( feature = "uefi" ) , not( target_os = "freebsd" ) ) ) ]
77use std:: io:: ErrorKind ;
88
9+ use crate :: serialnum:: Cfg0 ;
910use crate :: serialnum:: FrameworkSerial ;
1011use crate :: util:: Config ;
1112pub use crate :: util:: { Platform , PlatformFamily } ;
12- use num_derive:: FromPrimitive ;
1313use num_traits:: FromPrimitive ;
1414use smbioslib:: * ;
1515#[ cfg( feature = "uefi" ) ]
@@ -26,25 +26,6 @@ static CACHED_PLATFORM: Mutex<Option<Option<Platform>>> = Mutex::new(None);
2626// TODO: Should cache SMBIOS and values gotten from it
2727// SMBIOS is fixed after boot. Oh, so maybe not cache when we're running in UEFI
2828
29- #[ repr( u8 ) ]
30- #[ derive( Debug , PartialEq , FromPrimitive , Clone , Copy ) ]
31- pub enum ConfigDigit0 {
32- Poc1 = 0x01 ,
33- Proto1 = 0x02 ,
34- Proto2 = 0x03 ,
35- Evt1 = 0x04 ,
36- Evt2 = 0x05 ,
37- Dvt1 = 0x07 ,
38- Dvt2 = 0x08 ,
39- Pvt = 0x09 ,
40- MassProduction = 0x0A ,
41- MassProductionB = 0x0B ,
42- MassProductionC = 0x0C ,
43- MassProductionD = 0x0D ,
44- MassProductionE = 0x0E ,
45- MassProductionF = 0x0F ,
46- }
47-
4829/// Check whether the manufacturer in the SMBIOS says Framework
4930pub fn is_framework ( ) -> bool {
5031 if matches ! (
@@ -241,7 +222,7 @@ pub fn get_product_name() -> Option<String> {
241222 } )
242223}
243224
244- pub fn get_baseboard_version ( ) -> Option < ConfigDigit0 > {
225+ pub fn get_baseboard_version ( ) -> Option < Cfg0 > {
245226 // TODO: On FreeBSD we can short-circuit and avoid parsing SMBIOS
246227 // #[cfg(target_os = "freebsd")]
247228 // if let Ok(product) = kenv_get("smbios.system.product") {
@@ -260,9 +241,7 @@ pub fn get_baseboard_version() -> Option<ConfigDigit0> {
260241 // Assumes it's ASCII, which is guaranteed by SMBIOS
261242 let config_digit0 = & version[ 0 ..1 ] ;
262243 let config_digit0 = u8:: from_str_radix ( config_digit0, 16 ) ;
263- if let Ok ( version_config) =
264- config_digit0. map ( <ConfigDigit0 as FromPrimitive >:: from_u8)
265- {
244+ if let Ok ( version_config) = config_digit0. map ( <Cfg0 as FromPrimitive >:: from_u8) {
266245 return version_config;
267246 } else {
268247 error ! ( " Invalid BaseBoard Version: {}'" , version) ;
0 commit comments