summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-07-11 16:47:28 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-07-11 22:19:59 -0700
commita9c26a97ef3910e4a12434519be6b29763475f8b (patch)
tree56747d169f5700db65454ede089b617c53fac4e2
parent9015087c90f71198b72df9ef1563e3f21ac852c7 (diff)
downloadchrome-ec-a9c26a97ef3910e4a12434519be6b29763475f8b.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 ... Change-Id: I852cf9505d6b8b9e7133ca1008be1b22081a9d88 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/567681 Reviewed-by: Mary Ruthven <mruthven@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);