From 0bccbf240968eb76dcf588bdf8576dd3579ed64d Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Thu, 26 Jun 2014 17:46:20 -0700 Subject: [PATCH] tools: my change to use stdin, broke reading logs that have no header This fixes it (I'm careful to avoid seeking) --- Tools/LogAnalyzer/DataflashLog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tools/LogAnalyzer/DataflashLog.py b/Tools/LogAnalyzer/DataflashLog.py index a8ae0da980..30ae34b1b2 100644 --- a/Tools/LogAnalyzer/DataflashLog.py +++ b/Tools/LogAnalyzer/DataflashLog.py @@ -288,13 +288,14 @@ class DataflashLog: f = sys.stdin else: f = open(self.filename, 'r') - if f.read(4) == '\xa3\x95\x80\x80': - raise Exception("Unable to parse binary log files at this time, will be added soon") lineNumber = 0 knownHardwareTypes = ["APM", "PX4", "MPNG"] numBytes = 0 for line in f: + if len(line) >= 4 and line[0:4] == '\xa3\x95\x80\x80': + raise Exception("Unable to parse binary log files at this time, will be added soon") + lineNumber = lineNumber + 1 numBytes += len(line) + 1 try: