summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Han Yang <chenghan@google.com>2019-03-17 18:12:23 +0800
committerCommit Bot <commit-bot@chromium.org>2019-05-22 23:26:40 +0000
commit469750fdd47be95b9d29ace6d87b22ec5db66025 (patch)
tree36ca1c77779569539a4c26e8f65c60b71891586a
parentdc3123e8942bb3b538f4b99a4043fa93148d4fac (diff)
downloadchrome-ec-469750fdd47be95b9d29ace6d87b22ec5db66025.tar.gz
gsctool: Add error code description if authcode fails.
When doing RMA reset and the auth code is rejected, gsctool only reports the error code, which is not clear for the user. This CL adds the failure reason to make the message clearer. BUG=b:128801501 TEST=make gsctool; manually test on DUT BRANCH=none [Before fix] localhost $ gsctool -a -r "A" rma unlock failed, code 1 Processing response... localhost $ gsctool -a -r "ABCDEFGH" rma unlock failed, code 6 Processing response... [After fix] localhost $ gsctool -a -r "A" Processing response... rma unlock failed, code 1 (wrong authcode size) localhost $ gsctool -a -r "ABCDEFGH" Processing response... rma unlock failed, code 6 (authcode mismatch) Change-Id: I5db4d8f7cffe5b582f48fdc3b7fb27493b3715ff Signed-off-by: Cheng-Han Yang <chenghan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1527905 Commit-Ready: Cheng-Han Yang <chenghan@chromium.org> Tested-by: Cheng-Han Yang <chenghan@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1621446 Reviewed-by: Cheng-Han Yang <chenghan@chromium.org> Commit-Queue: Cheng-Han Yang <chenghan@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 0f8c9a46c6..2cd5e24476 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -1906,7 +1906,7 @@ static void process_rma(struct transfer_descriptor *td, const char *authcode)
return;
}
- printf("Processing response...");
+ printf("Processing response...\n");
auth_size = strlen(authcode);
response_size = sizeof(rma_response);
@@ -1915,8 +1915,19 @@ static void process_rma(struct transfer_descriptor *td, const char *authcode)
rma_response, &response_size);
if (response_size == 1) {
- fprintf(stderr, "\nrma unlock failed, code %d\n",
+ fprintf(stderr, "\nrma unlock failed, code %d ",
*rma_response);
+ switch (*rma_response) {
+ case VENDOR_RC_BOGUS_ARGS:
+ fprintf(stderr, "(wrong authcode size)\n");
+ break;
+ case VENDOR_RC_INTERNAL_ERROR:
+ fprintf(stderr, "(authcode mismatch)\n");
+ break;
+ default:
+ fprintf(stderr, "(unknown error)\n");
+ break;
+ }
if (td->ep_type == usb_xfer)
shut_down(&td->uep);
exit(update_error);