diff options
author | Mary Ruthven <mruthven@google.com> | 2018-06-11 13:29:53 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-06-11 22:26:19 -0700 |
commit | dc13fa31444e6c476f7f0072d7b5890f93ceca0a (patch) | |
tree | 1d3ca00b3d5be006921d39924cda31570f83467e | |
parent | 827765d0d3ab712dd2d27d3a01a324950f7f7301 (diff) | |
download | chrome-ec-dc13fa31444e6c476f7f0072d7b5890f93ceca0a.tar.gz |
gsctool: fix '-F disable' error handling
The FACTORY_DISABLE vendor command could return VENDOR_RC_INTERNAL_ERROR
in which case the EC error code is included in the response payload.
Print both errors if rv is nonzero and the response size is 1.
BUG=none
BRANCH=none
TEST=run 'gsctool -a -F disable' and make sure the vc and ec errors are
printed correctly.
Change-Id: Idc75d6d809865f1f3b685ca775ffbef9f6a1d860
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1096103
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | extra/usb_updater/gsctool.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c index 03c20dd03e..045c8dfcf5 100644 --- a/extra/usb_updater/gsctool.c +++ b/extra/usb_updater/gsctool.c @@ -1933,6 +1933,8 @@ static void process_rma(struct transfer_descriptor *td, const char *authcode) static void process_factory_mode(struct transfer_descriptor *td, const char *arg) { + uint8_t rma_response; + size_t response_size = sizeof(rma_response); char *cmd_str; int rv; uint16_t subcommand; @@ -1950,10 +1952,13 @@ static void process_factory_mode(struct transfer_descriptor *td, } printf("%sabling factory mode\n", cmd_str); - rv = send_vendor_command(td, subcommand, NULL, 0, NULL, NULL); + rv = send_vendor_command(td, subcommand, NULL, 0, &rma_response, + &response_size); if (rv) { - fprintf(stderr, "Failed %sabling factory mode, error " + fprintf(stderr, "Failed %sabling factory mode\nvc error " "%d\n", cmd_str, rv); + if (response_size == 1) + fprintf(stderr, "ec error %d\n", rma_response); exit(update_error); } printf("Factory %sable succeeded.\n", cmd_str); |