summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMarius Schilder <mschilder@google.com>2018-06-06 18:20:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-06-07 23:33:14 -0700
commit866c67086757eddf84680a2de4377fd3a5a893d7 (patch)
tree6c41cfb9fcd22b8a233f03b3a9d3b7ab3046137e /extra
parentc671b901b2f8f5eb22ac996d2ffcd1692d370690 (diff)
downloadchrome-ec-866c67086757eddf84680a2de4377fd3a5a893d7.tar.gz
gsctool: add -B to override version sniffing.
Not all boards that use gsctool use the cr50 versioning scheme. Add override option to detangle the version sniffing logic. Signed-off-by: mschilder@google.com BRANCH=none BUG=none TEST=cr53; gsctool w/o -B does not update to valid RW_A; with -B it does. Change-Id: I004fe85135ebb34fef500a3765cd026b44f2a164 Reviewed-on: https://chromium-review.googlesource.com/1090229 Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/usb_updater/gsctool.c65
-rw-r--r--extra/usb_updater/gsctool.h5
2 files changed, 40 insertions, 30 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 082b1556bc..03c20dd03e 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -196,31 +196,32 @@ struct upgrade_pkt {
static int verbose_mode;
static uint32_t protocol_version;
static char *progname;
-static char *short_opts = "abcd:F:fhIikO:oPprstUuVvw";
+static char *short_opts = "aBbcd:F:fhIikO:oPprstUuVvw";
static const struct option long_opts[] = {
/* name hasarg *flag val */
- {"any", 0, NULL, 'a'},
- {"binvers", 0, NULL, 'b'},
- {"board_id", 2, NULL, 'i'},
- {"ccd_info", 0, NULL, 'I'},
- {"ccd_lock", 0, NULL, 'k'},
- {"ccd_open", 0, NULL, 'o'},
- {"ccd_unlock", 0, NULL, 'U'},
- {"corrupt", 0, NULL, 'c'},
- {"device", 1, NULL, 'd'},
- {"factory", 1, NULL, 'F'},
- {"fwver", 0, NULL, 'f'},
- {"help", 0, NULL, 'h'},
- {"openbox_rma", 1, NULL, 'O'},
- {"password", 0, NULL, 'P'},
- {"post_reset", 0, NULL, 'p'},
- {"rma_auth", 2, NULL, 'r'},
- {"systemdev", 0, NULL, 's'},
- {"trunks_send", 0, NULL, 't'},
- {"verbose", 0, NULL, 'V'},
- {"version", 0, NULL, 'v'},
- {"wp", 0, NULL, 'w'},
- {"upstart", 0, NULL, 'u'},
+ {"any", 0, NULL, 'a'},
+ {"background_update_supported", 0, NULL, 'B'},
+ {"binvers", 0, NULL, 'b'},
+ {"board_id", 2, NULL, 'i'},
+ {"ccd_info", 0, NULL, 'I'},
+ {"ccd_lock", 0, NULL, 'k'},
+ {"ccd_open", 0, NULL, 'o'},
+ {"ccd_unlock", 0, NULL, 'U'},
+ {"corrupt", 0, NULL, 'c'},
+ {"device", 1, NULL, 'd'},
+ {"factory", 1, NULL, 'F'},
+ {"fwver", 0, NULL, 'f'},
+ {"help", 0, NULL, 'h'},
+ {"openbox_rma", 1, NULL, 'O'},
+ {"password", 0, NULL, 'P'},
+ {"post_reset", 0, NULL, 'p'},
+ {"rma_auth", 2, NULL, 'r'},
+ {"systemdev", 0, NULL, 's'},
+ {"trunks_send", 0, NULL, 't'},
+ {"verbose", 0, NULL, 'V'},
+ {"version", 0, NULL, 'v'},
+ {"wp", 0, NULL, 'w'},
+ {"upstart", 0, NULL, 'u'},
{},
};
@@ -1337,7 +1338,8 @@ static void generate_reset_request(struct transfer_descriptor *td)
}
/* RW version 0.0.19 and above has support for background updates. */
- background_update_supported = !a_newer_than_b(&ver19, &targ.shv[1]);
+ background_update_supported = td->background_update_supported ||
+ !a_newer_than_b(&ver19, &targ.shv[1]);
/*
* If this is an upstart request and there is support for background
@@ -2021,9 +2023,15 @@ int main(int argc, char *argv[])
/* Try dev_xfer first. */
td.ep_type = dev_xfer;
break;
+ case 'B':
+ td.background_update_supported = 1;
+ break;
case 'b':
binary_vers = 1;
break;
+ case 'c':
+ corrupt_inactive_rw = 1;
+ break;
case 'd':
if (!parse_vidpid(optarg, &vid, &pid)) {
fprintf(stderr,
@@ -2032,8 +2040,9 @@ int main(int argc, char *argv[])
errorcnt++;
}
break;
- case 'c':
- corrupt_inactive_rw = 1;
+ case 'F':
+ factory_mode = 1;
+ factory_mode_arg = optarg;
break;
case 'f':
show_fw_ver = 1;
@@ -2071,10 +2080,6 @@ int main(int argc, char *argv[])
case 'P':
password = 1;
break;
- case 'F':
- factory_mode = 1;
- factory_mode_arg = optarg;
- break;
case 'r':
rma = 1;
diff --git a/extra/usb_updater/gsctool.h b/extra/usb_updater/gsctool.h
index 23108f7a84..707ddfde87 100644
--- a/extra/usb_updater/gsctool.h
+++ b/extra/usb_updater/gsctool.h
@@ -31,6 +31,11 @@ struct transfer_descriptor {
* header timestamp.
*/
uint32_t upstart_mode;
+ /*
+ * Override in case updater is used w/ boards that do not follow
+ * the cr50 versioning scheme.
+ */
+ uint32_t background_update_supported;
/*
* offsets of RO and WR sections available for update (not currently