summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2021-03-23 11:18:14 -0600
committerCommit Bot <commit-bot@chromium.org>2021-03-23 22:41:22 +0000
commitbe928b9383a0227691040ec0bfa1def0a7d4c95c (patch)
tree7e8d635b3a5524459ef0af78eb48a89aaad67bb2
parente68e10cfd0c5417bf1719cb3690d17fca12f3a65 (diff)
downloadchrome-ec-be928b9383a0227691040ec0bfa1def0a7d4c95c.tar.gz
gsctool: use dauntless vid:pid as default for d2 images
If a dauntless image is passed in on the command line, then default the vid:pid to daunltess's vid:pid if it wasn't specified on the command line. BUG=none TEST=upgraded d2 image without specifying -d option TEST=upgraded cr50 image without specifying -d option Change-Id: I8387d9d27432f6911df03e16249e91bd44b5558b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782361 Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index bc72f73085..3ab7e5f51c 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -155,8 +155,8 @@
*/
/* Look for Cr50 FW update interface */
-#define VID USB_VID_GOOGLE
-#define PID CONFIG_USB_PID
+#define H1_PID 0x5014
+#define D2_PID 0x504A
#define SUBCLASS USB_SUBCLASS_GOOGLE_CR50
#define PROTOCOL USB_PROTOCOL_GOOGLE_CR50_NON_HC_FW_UPDATE
@@ -270,7 +270,7 @@ static const struct option_container cmd_line_options[] = {
{{"corrupt", no_argument, NULL, 'c'},
"Corrupt the inactive rw"},
{{"device", required_argument, NULL, 'd'},
- " VID:PID%USB device (default 18d1:5014)"},
+ " 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'},
@@ -3187,15 +3187,6 @@ int main(int argc, char *argv[])
if (errorcnt)
usage(errorcnt);
- /*
- * If no usb device information was given, default to the using cr50
- * vendor and product id to find the usb device.
- */
- if (!serial && !vid && !pid) {
- vid = VID;
- pid = PID;
- }
-
if ((bid_action == bid_none) &&
!ccd_info &&
!ccd_lock &&
@@ -3240,6 +3231,15 @@ int main(int argc, char *argv[])
printf("Ignoring binary image %s\n", argv[optind]);
}
+ /*
+ * If no usb device information was given, default to the using haven
+ * or dauntless vendor and product id to find the usb device.
+ */
+ if (!serial && !vid && !pid) {
+ vid = USB_VID_GOOGLE;
+ /* Set default product id based on image type */
+ pid = (image_magic == MAGIC_DAUNTLESS) ? D2_PID : H1_PID;
+ }
if (((bid_action != bid_none) + !!rma + !!password + !!ccd_open +
!!ccd_unlock + !!ccd_lock + !!ccd_info + !!get_flog +