mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-06 20:43:46 +08:00
a82935f326
Integrate onroad views, configurable widgets, local settings, steering-profile contracts, Bluetooth and Android Auto with their device and runtime services. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Daniel Koepping <elkoled@gmail.com> Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: Shane Smiskol <shane@smiskol.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: stef <19478336+stefpi@users.noreply.github.com> Co-authored-by: whoisdomi <dcantu83@gmail.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
47 lines
1.8 KiB
Python
Executable File
47 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Summarize Android Auto session logs into a shareable compatibility report.
|
|
|
|
On the comma, with no arguments it reports the newest session:
|
|
|
|
cd /data/openpilot
|
|
PYTHONPATH=/data/openpilot /usr/local/venv/bin/python openpilot/tools/android_auto/compat_report.py
|
|
... compat_report.py --all # every kept session, newest first
|
|
... compat_report.py session-000012-*.jsonl --json
|
|
... compat_report.py --bundle /tmp/android_auto.zip # logs, reports and settings in one zip
|
|
|
|
Logs pulled to another machine work too: pass their paths.
|
|
"""
|
|
|
|
import argparse
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from openpilot.starpilot.system.android_auto import compat_report
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
parser.add_argument("logs", nargs="*", type=Path, help="session logs (default: the newest on this comma)")
|
|
parser.add_argument("--all", action="store_true", help="every kept session on this comma")
|
|
parser.add_argument("--json", action="store_true", help="print the report as JSON")
|
|
parser.add_argument("--bundle", type=Path, help="write a zip of every log, report and the settings here")
|
|
args = parser.parse_args()
|
|
|
|
if args.bundle:
|
|
args.bundle.write_bytes(compat_report.bundle())
|
|
print(f"wrote {args.bundle}")
|
|
return 0
|
|
logs = args.logs or (compat_report.session_logs() if args.all else compat_report.session_logs()[:1])
|
|
if not logs:
|
|
print("No Android Auto session logs found.", file=sys.stderr)
|
|
return 1
|
|
for path in logs:
|
|
report = compat_report.summarize(compat_report.load_events(path))
|
|
print(json.dumps({"log": path.name, **report}, indent=2, default=str) if args.json else compat_report.render_text(report, path.name))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|