summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorCheng-Han Yang <chenghan@google.com>2019-03-17 18:12:23 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-20 08:52:35 -0700
commit99b60956d4ae10cc44c346444fc0347d25ec3742 (patch)
tree50e1ce91c8a510c739afd6e416b6aa82b70ce788 /extra
parent1765ce690f09320ca2740ada10c6bcafe4813e3a (diff)
downloadchrome-ec-99b60956d4ae10cc44c346444fc0347d25ec3742.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>
Diffstat (limited to 'extra')
-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 72fd7cdd10..8b9b95c818 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -2036,7 +2036,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);
@@ -2045,8 +2045,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);