diff options
-rw-r--r-- | util/flashrom_tester/flashrom/src/cmd.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/util/flashrom_tester/flashrom/src/cmd.rs b/util/flashrom_tester/flashrom/src/cmd.rs index b5aacf48..1fbb9444 100644 --- a/util/flashrom_tester/flashrom/src/cmd.rs +++ b/util/flashrom_tester/flashrom/src/cmd.rs @@ -60,11 +60,11 @@ pub struct WPOpt { #[derive(Default)] pub struct IOOpt<'a> { - pub read: Option<&'a str>, // -r <file> - pub write: Option<&'a str>, // -w <file> - pub verify: Option<&'a str>, // -v <file> - pub erase: bool, // -E - pub region: Option<&'a str>, // --image + pub read: Option<&'a str>, // -r <file> + pub write: Option<&'a str>, // -w <file> + pub verify: Option<&'a str>, // -v <file> + pub erase: bool, // -E + pub region: Option<(&'a str, &'a str)>, // --image } #[derive(PartialEq, Debug)] @@ -243,8 +243,7 @@ impl crate::Flashrom for FlashromCmd { fn read_region(&self, path: &str, region: &str) -> Result<(), FlashromError> { let opts = FlashromOpt { io_opt: IOOpt { - read: Some(path), - region: Some(region), + region: Some((region, path)), ..Default::default() }, ..Default::default() @@ -322,11 +321,11 @@ fn flashrom_decode_opts(opts: FlashromOpt) -> Vec<String> { } // io_opt - if let Some(region) = opts.io_opt.region { + if let Some((region, path)) = opts.io_opt.region { params.push("--image".to_string()); - params.push(region.to_string()); - } - if opts.io_opt.read.is_some() { + params.push(format!("{}:{}", region, path)); + params.push("-r".to_string()); + } else if opts.io_opt.read.is_some() { params.push("-r".to_string()); params.push(opts.io_opt.read.unwrap().to_string()); } else if opts.io_opt.write.is_some() { |