uzbek-plus/tools/uartlog.py
q 105bef466a Project Aurora: mainline ARM64 Linux on JZ08AU (MSM8916) LTE modem
Sanitized research log, build/reproducibility docs, DTS, kernel configs,
patches, initramfs sources, bootchain migration plans and test logs.
B5 direct boot PASS; B6 modem lifecycle in progress.
No dumps, NV/EFS, vendor firmware or device identifiers included.
2026-09-30 17:23:18 +03:00

17 lines
757 B
Python

#!/usr/bin/env python3
# Read-only UART logger: raw bytes -> <base>.raw, host-timestamped lines -> <base>.log
import serial, sys, time, datetime
port, base = sys.argv[1], sys.argv[2]
s = serial.Serial(port, 115200, bytesize=8, parity="N", stopbits=1, timeout=0.2)
raw = open(base + ".raw", "ab", buffering=0); log = open(base + ".log", "a", buffering=1)
log.write(f"### uartlog start {datetime.datetime.now().isoformat()} {port} 115200 8N1\n")
buf = b""
while True:
d = s.read(4096)
if not d:
continue
raw.write(d); buf += d
while b"\n" in buf:
ln, buf = buf.split(b"\n", 1)
ts = datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3]
log.write(f"{ts} {ln.rstrip(b'\r').decode('utf-8', 'backslashreplace')}\n")