mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-13 03:15:06 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user