@@ -184,7 +184,6 @@ pub struct Cli {
184184 pub ec_bin : Option < String > ,
185185 pub capsule : Option < String > ,
186186 pub dump : Option < String > ,
187- pub h2o_capsule : Option < String > ,
188187 pub dump_ec_flash : Option < String > ,
189188 pub flash_full_ec : Option < String > ,
190189 pub flash_ec : Option < String > ,
@@ -274,7 +273,6 @@ pub fn parse(args: &[String]) -> Cli {
274273 ec_bin : cli. ec_bin ,
275274 capsule : cli. capsule ,
276275 dump : cli. dump ,
277- h2o_capsule : cli. h2o_capsule ,
278276 // dump_ec_flash
279277 // flash_full_ec
280278 // flash_ec
@@ -1701,41 +1699,29 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
17011699 }
17021700 }
17031701 } else {
1704- println ! ( "Capsule is invalid." ) ;
1705- }
1706- }
1707- } else if let Some ( capsule_path) = & args. h2o_capsule {
1708- #[ cfg( feature = "uefi" ) ]
1709- let data = crate :: fw_uefi:: fs:: shell_read_file ( capsule_path) ;
1710- #[ cfg( not( feature = "uefi" ) ) ]
1711- let data = match fs:: read ( capsule_path) {
1712- Ok ( data) => Some ( data) ,
1713- // TODO: Perhaps a more user-friendly error
1714- Err ( e) => {
1715- println ! ( "Error {:?}" , e) ;
1716- None
1717- }
1718- } ;
1719-
1720- if let Some ( data) = data {
1721- println ! ( "File" ) ;
1722- println ! ( " Size: {:>20} B" , data. len( ) ) ;
1723- println ! ( " Size: {:>20} KB" , data. len( ) / 1024 ) ;
1724- if let Some ( cap) = find_bios_version ( & data) {
1725- println ! ( " BIOS Platform:{:>18}" , cap. platform) ;
1726- println ! ( " BIOS Version: {:>18}" , cap. version) ;
1727- }
1728- if let Some ( ec_bin) = find_ec_in_bios_cap ( & data) {
1729- debug ! ( "Found EC binary in BIOS capsule" ) ;
1730- analyze_ec_fw ( ec_bin) ;
1731- } else {
1732- debug ! ( "Didn't find EC binary in BIOS capsule" ) ;
1733- }
1734- if let Some ( pd_bin) = find_pd_in_bios_cap ( & data) {
1735- debug ! ( "Found PD binary in BIOS capsule" ) ;
1736- analyze_ccgx_pd_fw ( pd_bin) ;
1737- } else {
1738- debug ! ( "Didn't find PD binary in BIOS capsule" ) ;
1702+ // No valid capsule header - try to extract embedded firmware directly
1703+ // This handles raw H2O BIOS files that aren't wrapped in a UEFI capsule
1704+ println ! ( "No valid capsule header, searching for embedded firmware..." ) ;
1705+ let mut found_any = false ;
1706+ if let Some ( cap) = find_bios_version ( & data) {
1707+ found_any = true ;
1708+ println ! ( "BIOS" ) ;
1709+ println ! ( " Platform: {:>18}" , cap. platform) ;
1710+ println ! ( " Version: {:>18}" , cap. version) ;
1711+ }
1712+ if let Some ( ec_bin) = find_ec_in_bios_cap ( & data) {
1713+ found_any = true ;
1714+ println ! ( "Embedded EC" ) ;
1715+ analyze_ec_fw ( ec_bin) ;
1716+ }
1717+ if let Some ( pd_bin) = find_pd_in_bios_cap ( & data) {
1718+ found_any = true ;
1719+ println ! ( "Embedded PD" ) ;
1720+ analyze_ccgx_pd_fw ( pd_bin) ;
1721+ }
1722+ if !found_any {
1723+ println ! ( "No embedded firmware found." ) ;
1724+ }
17391725 }
17401726 }
17411727 } else if let Some ( dump_path) = & args. dump_ec_flash {
@@ -1863,7 +1849,6 @@ Options:
18631849 --ec-bin <EC_BIN> Parse versions from EC firmware binary file
18641850 --capsule <CAPSULE> Parse UEFI Capsule information from binary file
18651851 --dump <DUMP> Dump extracted UX capsule bitmap image to a file
1866- --h2o-capsule <H2O_CAPSULE> Parse UEFI Capsule information from binary file
18671852 --dump-ec-flash <DUMP_EC_FLASH> Dump EC flash contents
18681853 --flash-ec <FLASH_EC> Flash EC with new firmware from file
18691854 --flash-ro-ec <FLASH_EC> Flash EC with new firmware from file
0 commit comments