From b349b8550710bf7527680b4097450330fcee2d86 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Mon, 19 Feb 2018 13:12:40 -0800 Subject: gsctool: fix Board ID retrieval function The function used to read or write Board ID value, when invoked for reading, reports the value on the console, but does not save the read value in the passed in structure. Let's always save it in the structure so that the caller of this function has access to the retrieved value. BRANCH=none BUG=chromium:812880 TEST=verified that 'gsctool -i' still operates as expected. Change-Id: I9bc713386758ca6701e6b853e042652e2f392871 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/925692 Reviewed-by: Randall Spangler (cherry picked from commit cd76cde2173e7e18d54865d97beece25fa2cb14e) Reviewed-on: https://chromium-review.googlesource.com/1141524 Reviewed-by: Nick Sanders Commit-Queue: Nick Sanders Tested-by: Nick Sanders Reviewed-on: https://chromium-review.googlesource.com/c/1221371 Reviewed-by: Marco Chen Commit-Queue: Marco Chen Tested-by: Marco Chen --- extra/usb_updater/gsctool.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c index ae4c2a1738..7372179e97 100644 --- a/extra/usb_updater/gsctool.c +++ b/extra/usb_updater/gsctool.c @@ -1719,19 +1719,17 @@ static void process_bid(struct transfer_descriptor *td, size_t response_size; if (bid_action == bid_get) { - struct board_id bid; - response_size = sizeof(bid); + response_size = sizeof(*bid); send_vendor_command(td, VENDOR_CC_GET_BOARD_ID, - &bid, sizeof(bid), - &bid, &response_size); + bid, sizeof(*bid), + bid, &response_size); - if (response_size == sizeof(bid)) { + if (response_size == sizeof(*bid)) { printf("Board ID space: %08x:%08x:%08x\n", - be32toh(bid.type), be32toh(bid.type_inv), - be32toh(bid.flags)); + be32toh(bid->type), be32toh(bid->type_inv), + be32toh(bid->flags)); return; - } fprintf(stderr, "Error reading board ID: response size %zd," " first byte %#02x\n", response_size, -- cgit v1.2.1