Skip to content

Commit d64b3fb

Browse files
finikorgjhedberg
authored andcommitted
boards: up_squared_adsp: Update logging tools
Add debug and do not split on newline, fixes hexdump logs. Signed-off-by: Andrei Emeltchenko <[email protected]>
1 parent d4e769c commit d64b3fb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

boards/xtensa/up_squared_adsp/tools/lib/loglist.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def read_bytes(buffer):
1616
class Loglist:
1717
"""Loglist class"""
1818

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

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

3030
self.loglist = []
3131
self.parse()
32+
self.debug = debug
3233

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

3637
if magic == MAGIC:
3738
id_num = read_bytes(slot[2:4])
38-
logstr = slot[4:].decode(errors='replace').split('\r', 1)[0]
39+
logstr = slot[4:].decode(errors='replace')
3940
self.loglist.append((id_num, logstr))
4041

4142
def parse(self):
@@ -45,4 +46,8 @@ def parse(self):
4546

4647
def print(self):
4748
for pair in sorted(self.loglist):
48-
print('{} : {}'.format(*pair))
49+
if self.debug:
50+
# Add slot number when debug is enabled
51+
print('[{}] : {}'.format(*pair), end='')
52+
else:
53+
print('{}'.format(pair[1]), end='')

0 commit comments

Comments
 (0)