logextract: Improve detection of clock and tmc uart parameters

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-09-20 11:08:54 -04:00
parent 7527e57e5a
commit ddb59440a8
1 changed files with 4 additions and 4 deletions

View File

@ -216,10 +216,10 @@ clock_r = re.compile(r"^clocksync state: mcu_freq=(?P<freq>[0-9]+) .*"
+ r" (?P<sc>[0-9]+) (?P<f>[^ ]+)\)")
repl_seq_r = re.compile(r": seq: 1" + shortseq_s)
clock_s = r"(?P<clock>[0-9]+)"
repl_clock_r = re.compile(r"clock=" + clock_s + r"(?: |$)")
repl_clock_r = re.compile(r"clock=" + clock_s)
repl_uart_r = re.compile(r"tmcuart_(?:response|send) oid=[0-9]+"
+ r" (?:read|write)=(?P<msg>(?:'[^']*'"
+ r'|"[^"]*"))(?: |$)')
+ r'|"[^"]*"))')
# MCU shutdown message parsing
class MCUStream:
@ -245,7 +245,7 @@ class MCUStream:
line = repl_clock_r.sub(clock_update, line)
def uart_update(m):
msg = TMCUartHelper().parse_msg(ast.literal_eval(m.group('msg')))
return m.group(0).rstrip() + "%s " % (msg,)
return m.group(0).rstrip() + msg
line = repl_uart_r.sub(uart_update, line)
if self.name != 'mcu':
line = "mcu '%s': %s" % (self.name, line)