summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-07-11 16:47:28 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-13 23:50:23 +0000
commitda2fa21f8365dec2042b31a0361d0f0f9a4660a7 (patch)
tree5594f552c4f7b318e8bc5b89adf5840210d1e668
parent6fa46c71c22e4e58f94f2aa498c26d4a3fb7bddb (diff)
downloadchrome-ec-da2fa21f8365dec2042b31a0361d0f0f9a4660a7.tar.gz
usb_updater: fix transposed symbolic board ID representation
When usb_udpater reads board ID information from a binary blob, in case the ID field can be represented as a 4 character ASCII string the updater transposes the characters, resulting in a reversed string printed. Fix the transposition to verify that the result is printed properly. BRANCH=none BUG=b:63597142 TEST=ran the following commands: $ make BOARD=cr50 $ CR50_BOARD_ID='TEST:ff00:ff00' H1_DEVIDS='0x0169c181 0x04656742' \ ./util/signer/bs $ ./extra/usb_updater/usb_updater -b build/cr50/ec.bin read 524288(0x80000) bytes from build/cr50/ec.bin RO_A:4919.0.0 RW_A:0.0.21[TEST:0000ff00:0000ff00] RO_B:-1.-1.-1 ... Original Change-Id: I852cf9505d6b8b9e7133ca1008be1b22081a9d88 Original Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original Reviewed-on: https://chromium-review.googlesource.com/567681 Original Reviewed-by: Mary Ruthven <mruthven@chromium.org> Change-Id: I3a880c9382e50bee1d9dfc0793f1c753e56c06bc Reviewed-on: https://chromium-review.googlesource.com/958720 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org>
-rw-r--r--extra/usb_updater/usb_updater.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index 48d45d08fb..c063198b20 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -1265,10 +1265,13 @@ static int show_headers_versions(const void *image)
if (!isalnum(((const char *)&bid)[j]))
break;
- if (j == sizeof(bid))
+ if (j == sizeof(bid)) {
+ /* Convert it for proper string representation. */
+ bid = be32toh(bid);
printf("%.4s", (const char *)&bid);
- else
+ } else {
printf("%08x", bid);
+ }
/* Print the rest of the board ID fields. */
printf(":%08x:%08x]", bid_mask, bid_flags);