MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / flash_ec

Function flash_ec

framework_lib/src/commandline/mod.rs:1087–1112  ·  view source on GitHub ↗
(ec: &CrosEc, ec_bin_path: &str, flash_type: EcFlashType, dry_run: bool)

Source from the content-addressed store, hash-verified

1085}
1086
1087fn flash_ec(ec: &CrosEc, ec_bin_path: &str, flash_type: EcFlashType, dry_run: bool) {
1088 #[cfg(feature = "uefi")]
1089 let data = crate::fw_uefi::fs::shell_read_file(ec_bin_path);
1090 #[cfg(not(feature = "uefi"))]
1091 let data: Option<Vec<u8>> = {
1092 match fs::read(ec_bin_path) {
1093 Ok(data) => Some(data),
1094 // TODO: Perhaps a more user-friendly error
1095 Err(e) => {
1096 println!("Error {:?}", e);
1097 None
1098 }
1099 }
1100 };
1101
1102 if let Some(data) = data {
1103 println!("File");
1104 println!(" Size: {:>20} B", data.len());
1105 println!(" Size: {:>20} KB", data.len() / 1024);
1106 if let Err(err) = ec.reflash(&data, flash_type, dry_run) {
1107 println!("Error: {:?}", err);
1108 } else {
1109 println!("Success!");
1110 }
1111 }
1112}
1113
1114fn dump_ec_flash(ec: &CrosEc, dump_path: &str) {
1115 let flash_bin = ec.get_entire_ec_flash().unwrap();

Callers 1

run_with_argsFunction · 0.85

Calls 2

shell_read_fileFunction · 0.85
reflashMethod · 0.80

Tested by

no test coverage detected