LogAnalyzer: Binary Logs may end with \xff

- ignoreBadlines can be used to assume this is a proper EOF
This commit is contained in:
Markus Koetter 2014-07-15 10:25:36 +02:00 committed by Craig Elder
parent 07a74bc39f
commit cf4435989e
1 changed files with 7 additions and 1 deletions

View File

@ -612,7 +612,13 @@ class DataflashLog(object):
while len(data) > offset: while len(data) > offset:
h = logheader.from_buffer(data, offset) h = logheader.from_buffer(data, offset)
if not (h.head1 == 0xa3 and h.head2 == 0x95): if not (h.head1 == 0xa3 and h.head2 == 0x95):
if ignoreBadlines == False:
raise ValueError(h) raise ValueError(h)
else:
if h.head1 == 0xff and h.head2 == 0xff and h.msgid == 0xff:
print("Assuming EOF due to dataflash block tail filled with \\xff... (offset={off})".format(off=offset))
break
if h.msgid in self._formats: if h.msgid in self._formats:
typ = self._formats[h.msgid] typ = self._formats[h.msgid]
if len(data) <= offset + typ.SIZE: if len(data) <= offset + typ.SIZE: