34 lines
905 B
Python
34 lines
905 B
Python
"""Dump the M5Stack's in-RAM BLE debug ring via USB serial.
|
|
|
|
Use right after a failed Open BLE attempt — the device's ring holds
|
|
recent connect/subscribe/notify events that tell us exactly what its
|
|
side of the BLE handshake observed.
|
|
"""
|
|
import sys
|
|
|
|
from serial_manager import SerialManager
|
|
|
|
|
|
def main():
|
|
s = SerialManager()
|
|
if not s.scan_and_connect():
|
|
print("[dbg] could not find/connect to M5Stack over USB")
|
|
sys.exit(1)
|
|
print(f"[dbg] connected to {s.port}")
|
|
entries = s.get_ble_log()
|
|
if entries is None:
|
|
print("[dbg] get_ble_log returned None (device may not support it)")
|
|
return
|
|
if not entries:
|
|
print("[dbg] ring is empty")
|
|
return
|
|
print(f"[dbg] {len(entries)} entries:")
|
|
for e in entries:
|
|
t = e.get("t", "?")
|
|
m = e.get("m", "")
|
|
print(f" [{t:>10}] {m}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|