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>2021-01-28 12:11:10 +0000
commitc549ed89d8bc74774d0537231adf087a3d6c5522 (patch)
tree6b120f3f0514ba0acb2170dfef137b50ebae9dd5
parent6674b24ac5a1a4fe05fe5b4d2c74e9981b4304b0 (diff)
downloadchrome-ec-c549ed89d8bc74774d0537231adf087a3d6c5522.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/+/2655685 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 996ac42749..a57eecd549 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -2022,7 +2022,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);
@@ -2031,8 +2031,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);