From: Keith Packard Date: Sun, 5 Aug 2018 00:43:06 +0000 (+0800) Subject: ao-tools/ao-dumplog: Dump entire eeprom contents X-Git-Tag: 1.8.6~1^2~5 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=a90d205d41cb4f9f8e669473247786a23a678368;hp=08e7fdb9f2db4b54279c0c5b18735aa1d5abc19e ao-tools/ao-dumplog: Dump entire eeprom contents This gets the eeprom size from the device and uses that to dump the whole thing. Signed-off-by: Keith Packard --- diff --git a/ao-tools/ao-dumplog/ao-dumplog.c b/ao-tools/ao-dumplog/ao-dumplog.c index 6d4fa5bf..41d0ac10 100644 --- a/ao-tools/ao-dumplog/ao-dumplog.c +++ b/ao-tools/ao-dumplog/ao-dumplog.c @@ -90,6 +90,8 @@ main (int argc, char **argv) int any_valid; int invalid; char serial_line[8192]; + unsigned storage_size; + int blocks; while ((c = getopt_long(argc, argv, "T:D:C:R", options, NULL)) != -1) { switch (c) { @@ -140,10 +142,21 @@ main (int argc, char **argv) cc_usb_close(cc); exit(1); } - printf ("Serial number: %d\n", serial_number); + cc_usb_printf(cc, "f\n"); + storage_size = 0; + for (;;) { + cc_usb_getline(cc, line, sizeof(line)); + if (sscanf(line, "Storage size: %u", &storage_size) == 1) + break; + } + printf ("Serial number: %d Storage size: %u\n", serial_number, storage_size); + if (storage_size) + blocks = storage_size / 256; + else + blocks = 511; done = 0; column = 0; - for (block = 0; !done && block < 511; block++) { + for (block = 0; !done && block < blocks; block++) { cc_usb_printf(cc, "e %x\n", block); if (column == 64) { putchar('\n');