Add packaged per-camera X4 wake and preview recovery
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user