@@ -56,8 +56,8 @@ use crate::nvme;
5656use crate :: os_specific;
5757use crate :: parade_retimer;
5858use crate :: power;
59+ use crate :: serialnum:: Cfg0 ;
5960use crate :: smbios;
60- use crate :: smbios:: ConfigDigit0 ;
6161use crate :: smbios:: { dmidecode_string_val, get_smbios, is_framework} ;
6262#[ cfg( feature = "hidapi" ) ]
6363use crate :: touchpad:: print_touchpad_fw_ver;
@@ -226,6 +226,7 @@ pub struct Cli {
226226 pub flash_gpu_descriptor : Option < ( u8 , String ) > ,
227227 pub flash_gpu_descriptor_file : Option < String > ,
228228 pub dump_gpu_descriptor_file : Option < String > ,
229+ pub serialnums : bool ,
229230 pub nvidia : bool ,
230231 // UEFI only
231232 pub allupdate : bool ,
@@ -1542,6 +1543,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
15421543 } else if let Some ( dump_path) = & args. meinfo {
15431544 let verbose = args. verbosity . 0 >= log:: LevelFilter :: Warn ;
15441545 me_info ( verbose, dump_path. as_deref ( ) ) ;
1546+ } else if args. serialnums {
1547+ serialnum_info ( ) ;
15451548 } else if args. pd_info {
15461549 print_pd_details ( & ec) ;
15471550 } else if let Some ( pd) = args. pd_reset {
@@ -1822,7 +1825,8 @@ Options:
18221825 --fansetrpm Set fan RPM (limited by EC fan table max RPM)
18231826 --autofanctrl [<FANID>]Turn on automatic fan speed control (optionally provide fan index)
18241827 --pdports Show information about USB-C PD ports
1825- --info Show info from SMBIOS (Only on UEFI)
1828+ --info Show info from SMBIOS
1829+ --serialnums Show info about system serial numbers
18261830 --pd-info Show details about the PD controllers
18271831 --privacy Show privacy switch statuses (camera and microphone)
18281832 --pd-bin <PD_BIN> Parse versions from PD firmware binary file
@@ -2091,8 +2095,7 @@ fn smbios_info() {
20912095 // Assumes it's ASCII, which is guaranteed by SMBIOS
20922096 let config_digit0 = & version[ 0 ..1 ] ;
20932097 let config_digit0 = u8:: from_str_radix ( config_digit0, 16 ) ;
2094- if let Ok ( version_config) =
2095- config_digit0. map ( <ConfigDigit0 as FromPrimitive >:: from_u8)
2098+ if let Ok ( version_config) = config_digit0. map ( <Cfg0 as FromPrimitive >:: from_u8)
20962099 {
20972100 println ! ( " Version: {:?} ({})" , version_config, version) ;
20982101 } else {
@@ -2130,8 +2133,7 @@ fn smbios_info() {
21302133 // Assumes it's ASCII, which is guaranteed by SMBIOS
21312134 let config_digit0 = & version[ 0 ..1 ] ;
21322135 let config_digit0 = u8:: from_str_radix ( config_digit0, 16 ) ;
2133- if let Ok ( version_config) =
2134- config_digit0. map ( <ConfigDigit0 as FromPrimitive >:: from_u8)
2136+ if let Ok ( version_config) = config_digit0. map ( <Cfg0 as FromPrimitive >:: from_u8)
21352137 {
21362138 println ! ( " Version: {:?} ({})" , version_config, version) ;
21372139 } else {
@@ -2280,6 +2282,19 @@ fn me_info(verbose: bool, dump_path: Option<&str>) {
22802282 }
22812283}
22822284
2285+ fn serialnum_info ( ) {
2286+ let smbios = get_smbios ( ) ;
2287+ if smbios. is_none ( ) {
2288+ error ! ( "Failed to find SMBIOS" ) ;
2289+ return ;
2290+ }
2291+ for undefined_struct in smbios. unwrap ( ) . iter ( ) {
2292+ if let DefinedStruct :: OemStrings ( data) = undefined_struct. defined_struct ( ) {
2293+ smbios:: dump_oem_strings ( data. oem_strings ( ) ) ;
2294+ }
2295+ }
2296+ }
2297+
22832298fn analyze_ccgx_pd_fw ( data : & [ u8 ] ) {
22842299 if let Some ( versions) = ccgx:: binary:: read_versions ( data, Ccg3 ) {
22852300 println ! ( "Detected CCG3 firmware" ) ;
0 commit comments