diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2017-07-11 16:47:28 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2017-08-03 04:40:50 +0000 |
commit | eb45a173374662217751e586d48310442524a7e3 (patch) | |
tree | 0110d1cded4859e4239c346f73f46fe1408ad561 | |
parent | 06a4499472b1919eea0fdd12ef75b946e246b924 (diff) | |
download | chrome-ec-eb45a173374662217751e586d48310442524a7e3.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>
(cherry picked from commit a9c26a97ef3910e4a12434519be6b29763475f8b)
Reviewed-on: https://chromium-review.googlesource.com/599170
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Trybot-Ready: Hung-Te Lin <hungte@chromium.org>
-rw-r--r-- | extra/usb_updater/usb_updater.c | 7 |
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); |