diff options
| author | Keith Packard <keithp@keithp.com> | 2018-08-05 08:43:06 +0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2018-08-05 09:04:19 +0800 | 
| commit | a90d205d41cb4f9f8e669473247786a23a678368 (patch) | |
| tree | 7ab25b087153915105ad641b140f5bc8205b088b | |
| parent | 08e7fdb9f2db4b54279c0c5b18735aa1d5abc19e (diff) | |
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 <keithp@keithp.com>
| -rw-r--r-- | ao-tools/ao-dumplog/ao-dumplog.c | 17 | 
1 files changed, 15 insertions, 2 deletions
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');  | 
