@@ -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_ec : Option < String > ,
190189 pub flash_ro_ec : Option < String > ,
@@ -272,7 +271,6 @@ pub fn parse(args: &[String]) -> Cli {
272271 ec_bin : cli. ec_bin ,
273272 capsule : cli. capsule ,
274273 dump : cli. dump ,
275- h2o_capsule : cli. h2o_capsule ,
276274 // dump_ec_flash
277275 // flash_ec
278276 // flash_ro_ec
@@ -1678,41 +1676,29 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
16781676 }
16791677 }
16801678 } else {
1681- println ! ( "Capsule is invalid." ) ;
1682- }
1683- }
1684- } else if let Some ( capsule_path) = & args. h2o_capsule {
1685- #[ cfg( feature = "uefi" ) ]
1686- let data = crate :: fw_uefi:: fs:: shell_read_file ( capsule_path) ;
1687- #[ cfg( not( feature = "uefi" ) ) ]
1688- let data = match fs:: read ( capsule_path) {
1689- Ok ( data) => Some ( data) ,
1690- // TODO: Perhaps a more user-friendly error
1691- Err ( e) => {
1692- println ! ( "Error {:?}" , e) ;
1693- None
1694- }
1695- } ;
1696-
1697- if let Some ( data) = data {
1698- println ! ( "File" ) ;
1699- println ! ( " Size: {:>20} B" , data. len( ) ) ;
1700- println ! ( " Size: {:>20} KB" , data. len( ) / 1024 ) ;
1701- if let Some ( cap) = find_bios_version ( & data) {
1702- println ! ( " BIOS Platform:{:>18}" , cap. platform) ;
1703- println ! ( " BIOS Version: {:>18}" , cap. version) ;
1704- }
1705- if let Some ( ec_bin) = find_ec_in_bios_cap ( & data) {
1706- debug ! ( "Found EC binary in BIOS capsule" ) ;
1707- analyze_ec_fw ( ec_bin) ;
1708- } else {
1709- debug ! ( "Didn't find EC binary in BIOS capsule" ) ;
1710- }
1711- if let Some ( pd_bin) = find_pd_in_bios_cap ( & data) {
1712- debug ! ( "Found PD binary in BIOS capsule" ) ;
1713- analyze_ccgx_pd_fw ( pd_bin) ;
1714- } else {
1715- debug ! ( "Didn't find PD binary in BIOS capsule" ) ;
1679+ // No valid capsule header - try to extract embedded firmware directly
1680+ // This handles raw H2O BIOS files that aren't wrapped in a UEFI capsule
1681+ println ! ( "No valid capsule header, searching for embedded firmware..." ) ;
1682+ let mut found_any = false ;
1683+ if let Some ( cap) = find_bios_version ( & data) {
1684+ found_any = true ;
1685+ println ! ( "BIOS" ) ;
1686+ println ! ( " Platform: {:>18}" , cap. platform) ;
1687+ println ! ( " Version: {:>18}" , cap. version) ;
1688+ }
1689+ if let Some ( ec_bin) = find_ec_in_bios_cap ( & data) {
1690+ found_any = true ;
1691+ println ! ( "Embedded EC" ) ;
1692+ analyze_ec_fw ( ec_bin) ;
1693+ }
1694+ if let Some ( pd_bin) = find_pd_in_bios_cap ( & data) {
1695+ found_any = true ;
1696+ println ! ( "Embedded PD" ) ;
1697+ analyze_ccgx_pd_fw ( pd_bin) ;
1698+ }
1699+ if !found_any {
1700+ println ! ( "No embedded firmware found." ) ;
1701+ }
17161702 }
17171703 }
17181704 } else if let Some ( dump_path) = & args. dump_ec_flash {
@@ -1829,7 +1815,6 @@ Options:
18291815 --ec-bin <EC_BIN> Parse versions from EC firmware binary file
18301816 --capsule <CAPSULE> Parse UEFI Capsule information from binary file
18311817 --dump <DUMP> Dump extracted UX capsule bitmap image to a file
1832- --h2o-capsule <H2O_CAPSULE> Parse UEFI Capsule information from binary file
18331818 --dump-ec-flash <DUMP_EC_FLASH> Dump EC flash contents
18341819 --flash-ec <FLASH_EC> Flash EC with new firmware from file
18351820 --flash-ro-ec <FLASH_EC> Flash EC with new firmware from file
0 commit comments