From 9f9753d665987cc42a4ca2fe496f6e9d58c91be8 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Thu, 10 Jun 2021 11:51:46 -0600 Subject: gsctool: add --dauntless flag and default to haven For commands that do not take in an image, we cannot tell if we are communicating with a haven or dauntless chip automatically. Add a way to specify if we are communicating with a dauntless chip. Default to haven if the optional --dauntless flag is not present BUG=b:190659004 TEST=execute `gsctool -I` on haven chip and see success TEST=execute `gsctool -I --dauntless` on haven chip and see failure that it cannot find device with dauntless VID:PID Change-Id: Ia92422846d283eba5b27cfaa130c782f13af90ca Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2952837 Commit-Queue: Mary Ruthven Reviewed-by: Mary Ruthven --- extra/usb_updater/gsctool.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c index 3ab7e5f51c..62c1cff112 100644 --- a/extra/usb_updater/gsctool.c +++ b/extra/usb_updater/gsctool.c @@ -269,8 +269,11 @@ static const struct option_container cmd_line_options[] = { "RW and RO headers, do not update"}, {{"corrupt", no_argument, NULL, 'c'}, "Corrupt the inactive rw"}, + {{"dauntless", no_argument, NULL, 'D'}, + "Communicate with Dauntless chip. This may be implied or overridden by" + " --image flag values"}, {{"device", required_argument, NULL, 'd'}, - " VID:PID%USB device (default 18d1:5014 or 18d1:504a based on image)"}, + "VID:PID%USB device (default 18d1:5014 or 18d1:504a based on image)"}, {{"endorsement_seed", optional_argument, NULL, 'e'}, "[state]%get/set the endorsement key seed"}, {{"fwver", no_argument, NULL, 'f'}, @@ -2993,6 +2996,7 @@ int main(int argc, char *argv[]) int sn_inc_rma = 0; uint8_t sn_inc_rma_arg; int erase_ap_ro_hash = 0; + int is_dauntless = 0; /* * All options which result in setting a Boolean flag to True, along @@ -3001,6 +3005,7 @@ int main(int argc, char *argv[]) const struct options_map omap[] = { { 'b', &binary_vers }, { 'c', &corrupt_inactive_rw }, + { 'D', &is_dauntless }, { 'f', &show_fw_ver }, { 'g', &get_boot_mode}, { 'H', &erase_ap_ro_hash}, @@ -3187,6 +3192,13 @@ int main(int argc, char *argv[]) if (errorcnt) usage(errorcnt); + /* + * If dauntless was explicitly asked for, then use it; otherwise default + * to haven. Note this may get overridden if the --image flag specifies + * a dauntless or haven image. + */ + image_magic = is_dauntless ? MAGIC_DAUNTLESS : MAGIC_HAVEN; + if ((bid_action == bid_none) && !ccd_info && !ccd_lock && -- cgit v1.2.1