Skip to content

Commit

Permalink
boards: up_squared_adsp: Update logging tools
Browse files Browse the repository at this point in the history
Add debug and do not split on newline, fixes hexdump logs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg authored and jhedberg committed Feb 6, 2020
1 parent d4e769c commit d64b3fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions boards/xtensa/up_squared_adsp/tools/lib/loglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def read_bytes(buffer):
class Loglist:
"""Loglist class"""

def __init__(self, argument):
def __init__(self, argument, debug=False):
"""Constructor for the loglist takes argument filename or buffer"""

if isinstance(argument, str):
Expand All @@ -29,13 +29,14 @@ def __init__(self, argument):

self.loglist = []
self.parse()
self.debug = debug

def parse_slot(self, slot):
magic = read_bytes(slot[0:2])

if magic == MAGIC:
id_num = read_bytes(slot[2:4])
logstr = slot[4:].decode(errors='replace').split('\r', 1)[0]
logstr = slot[4:].decode(errors='replace')
self.loglist.append((id_num, logstr))

def parse(self):
Expand All @@ -45,4 +46,8 @@ def parse(self):

def print(self):
for pair in sorted(self.loglist):
print('{} : {}'.format(*pair))
if self.debug:
# Add slot number when debug is enabled
print('[{}] : {}'.format(*pair), end='')
else:
print('{}'.format(pair[1]), end='')

0 comments on commit d64b3fb

Please sign in to comment.