Add packaged per-camera X4 wake and preview recovery

This commit is contained in:
DCCONSTRUCTIONS
2026-09-10 14:20:52 +03:00
parent f164606828
commit d45b329de8
22 changed files with 1045 additions and 16 deletions
+8 -1
View File
@@ -3,6 +3,7 @@
import hashlib
import json
import re
import signal
import sys
from pathlib import Path
@@ -33,7 +34,9 @@ def wake_payload(target):
ident = "instax4_" + hashlib.sha256(serial.encode()).hexdigest()[:32]
if target["device_id"] != ident or target["wakeup_enabled"] is not True:
raise ValueError("USB identity and enabled camera wakeup must be confirmed")
if not re.fullmatch(r"(?:[0-9A-F]{2}:){5}[0-9A-F]{2}", target["bluetooth_address"]):
if target["bluetooth_address"] is not None and not re.fullmatch(
r"(?:[0-9A-F]{2}:){5}[0-9A-F]{2}", target["bluetooth_address"]
):
raise ValueError("Prior correlated Bluetooth address is required")
# Company ID 0x004c is passed separately to BlueZ. X4 remote spec section1.
return (
@@ -189,6 +192,10 @@ def run(target, report):
def main():
def cancel(*_):
raise RuntimeError("Wake cancelled")
signal.signal(signal.SIGTERM, cancel)
report = {
"schema": "missioncore.insta360.ble-wake/v1",
"started": timestamp(),