SmartFox: launcher, Siri Remote driver, Debian image and installer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
33
tools/siri-remote/notifs.py
Normal file
33
tools/siri-remote/notifs.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Extracts ATT notifications from `btmon -r capture.btsnoop` text output.
|
||||
|
||||
usage: btmon -r cap.btsnoop | notifs.py [handle ...]
|
||||
Prints: time handle hexdata
|
||||
"""
|
||||
import re
|
||||
import sys
|
||||
|
||||
want = set(sys.argv[1:])
|
||||
ts = 0.0
|
||||
lines = sys.stdin.read().split("\n")
|
||||
i = 0
|
||||
while i < len(lines):
|
||||
l = lines[i]
|
||||
m = re.search(r"LE-ACL:.*\]\s+(\d+\.\d+)\s*$", l)
|
||||
if m:
|
||||
ts = float(m.group(1))
|
||||
if "Handle Value Notification" in l:
|
||||
h = re.search(r"Handle: (0x[0-9a-f]+)", lines[i + 1]).group(1)
|
||||
data = []
|
||||
j = i + 3
|
||||
while j < len(lines):
|
||||
m2 = re.match(r"^\s{8}((?:[0-9a-f]{2} )+)", lines[j] + " ")
|
||||
if not m2:
|
||||
break
|
||||
data += m2.group(1).split()
|
||||
j += 1
|
||||
if not want or h in want:
|
||||
print(f"{ts:9.3f} {h} {' '.join(data)}")
|
||||
i = j
|
||||
continue
|
||||
i += 1
|
||||
Reference in New Issue
Block a user