projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stop recording in ao-dumplog after receiving an invalid block
[fw/altos]
/
ao-tools
/
ao-dumplog
/
ao-dumplog.c
diff --git
a/ao-tools/ao-dumplog/ao-dumplog.c
b/ao-tools/ao-dumplog/ao-dumplog.c
index 4bfb7e51857fb1d5355678af4593c4dc35da55c2..b3a0a25ad9b8729f6d314f1ca9f2506e545335ea 100644
(file)
--- 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 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) {
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++;
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",
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);
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);
cmd = data[0];
tick = data[2] + (data[3] << 8);
@@
-182,6
+187,11
@@
main (int argc, char **argv)
addr += 8;
}
}
addr += 8;
}
}
+ if (!any_valid) {
+ fclose(out);
+ out = NULL;
+ done = 1;
+ }
}
if (column)
putchar('\n');
}
if (column)
putchar('\n');