diff options
| author | Keith Packard <keithp@keithp.com> | 2009-11-04 21:59:51 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2009-11-04 21:59:51 -0800 | 
| commit | 5a79a04ddb0b3ee64de34e366f71a0f6db509c01 (patch) | |
| tree | 6d2eeb50508a26bdc78e8da98e62def0a7620b0b | |
| parent | 843ee489aac34ad6d81f55f1c85fb9eecc42d86b (diff) | |
Stop recording in ao-dumplog after receiving an invalid block
If no samples in a block are valid, assume the flight log is over.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | ao-tools/ao-dumplog/ao-dumplog.c | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/ao-tools/ao-dumplog/ao-dumplog.c b/ao-tools/ao-dumplog/ao-dumplog.c index 4bfb7e51..b3a0a25a 100644 --- a/ao-tools/ao-dumplog/ao-dumplog.c +++ b/ao-tools/ao-dumplog/ao-dumplog.c @@ -82,6 +82,8 @@ main (int argc, char **argv)  	int		done;  	int		column;  	int		remote = 0; +	int		any_valid; +	int		invalid;  	while ((c = getopt_long(argc, argv, "T:D:R", options, NULL)) != -1) {  		switch (c) { @@ -146,6 +148,7 @@ main (int argc, char **argv)  			column = 0;  		}  		putchar('.'); fflush(stdout); column++; +		any_valid = 0;  		for (addr = 0; addr < 0x100;) {  			cc_usb_getline(cc, line, sizeof (line));  			if (sscanf(line, "00%x %x %x %x %x %x %x %x %x", @@ -160,6 +163,8 @@ main (int argc, char **argv)  				if (log_checksum(data) != 0)  					fprintf (stderr, "invalid checksum at 0x%x\n",  						 block * 256 + received_addr); +				else +					any_valid = 1;  				cmd = data[0];  				tick = data[2] + (data[3] << 8); @@ -182,6 +187,11 @@ main (int argc, char **argv)  				addr += 8;  			}  		} +		if (!any_valid) { +			fclose(out); +			out = NULL; +			done = 1; +		}  	}  	if (column)  		putchar('\n');  | 
