mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-25 07:52:03 +08:00
debug FW fingerprinting: live support (#32585)
* live debug! * clean up
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
|
||||
from openpilot.tools.lib.live_logreader import live_logreader
|
||||
from openpilot.tools.lib.logreader import LogReader, ReadMode
|
||||
from panda.python import uds
|
||||
|
||||
|
||||
def main(route: str, addrs: list[int]):
|
||||
def main(route: str | None, addrs: list[int]):
|
||||
"""
|
||||
TODO:
|
||||
- highlight TX vs RX clearly
|
||||
@@ -13,7 +14,10 @@ def main(route: str, addrs: list[int]):
|
||||
- print as fixed width table, easier to read
|
||||
"""
|
||||
|
||||
lr = LogReader(route, default_mode=ReadMode.RLOG, sort_by_time=True)
|
||||
if route is None:
|
||||
lr = live_logreader()
|
||||
else:
|
||||
lr = LogReader(route, default_mode=ReadMode.RLOG, sort_by_time=True)
|
||||
|
||||
start_mono_time = None
|
||||
prev_mono_time = 0
|
||||
@@ -28,7 +32,7 @@ def main(route: str, addrs: list[int]):
|
||||
|
||||
if msg.which() in ("can", 'sendcan'):
|
||||
for can in getattr(msg, msg.which()):
|
||||
if can.address in addrs:
|
||||
if can.address in addrs or not len(addrs):
|
||||
if msg.logMonoTime != prev_mono_time:
|
||||
print()
|
||||
prev_mono_time = msg.logMonoTime
|
||||
@@ -38,8 +42,8 @@ def main(route: str, addrs: list[int]):
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='View back and forth ISO-TP communication between various ECUs given an address')
|
||||
parser.add_argument('route', help='Route name')
|
||||
parser.add_argument('addrs', nargs='*', help='List of tx address to view (0x7e0 for engine)')
|
||||
parser.add_argument('route', nargs='?', help='Route name, live if not specified')
|
||||
parser.add_argument('--addrs', nargs='*', default=[], help='List of tx address to view (0x7e0 for engine)')
|
||||
args = parser.parse_args()
|
||||
|
||||
addrs = [int(addr, base=16) if addr.startswith('0x') else int(addr) for addr in args.addrs]
|
||||
|
||||
Reference in New Issue
Block a user