Files
DCCONSTRUCTIONS a3c15e11e9 Add packaged Insta360 X4 integration and recover paired Node channels
Discover independent camera instances and prepare their versioned runtime
from Node or remote Core. Add isolated SDK workers, camera controls, raw
dual-fisheye WebRTC preview, and shared action/region loading states.

Recover existing Node bindings over known Tailscale addresses after a Core
LAN address change. Preserve identities and trust, pin both peers, migrate
endpoints with revision checks, and require real heartbeats for online status.
Fix the Python client certificate profile for Go X509 verification.

Pin Design Guideline 8c53f73 and retain installer/build/acceptance history.
Node 0.8.19 is installed; X4 0.1.3-3 is bundled but hardware activation is pending.

Validation: qualified DG/Node builds and Go race tests; 31 fleet tests;
Python-to-Go certificate interoperability and live tailnet recovery with five
fresh heartbeats; prior 38 X4 tests and bounded remote WebRTC acceptance.
Clean-OS, replug/power autonomy, local X4 video and long-run stability remain open.
2026-09-10 09:21:24 +03:00

25 lines
939 B
Python

"""OS lock shared by every SDK effect and exclusive profile activation."""
import fcntl
from contextlib import contextmanager
from pathlib import Path
ROOT = Path("/var/lib/mission-core-insta360")
@contextmanager
def acquisition(wait=False):
path = ROOT / "lifecycle.lock"
for item in (ROOT, path):
info = item.lstat()
if item.is_symlink() or info.st_uid != 0 or info.st_mode & 0o022:
raise RuntimeError("Untrusted camera lifecycle lock")
with path.open("rb") as handle:
try:
fcntl.flock(handle, fcntl.LOCK_SH | (0 if wait else fcntl.LOCK_NB))
except BlockingIOError:
raise RuntimeError("Подготовка драйвера ещё выполняется.") from None
if (ROOT / "maintenance").exists():
raise RuntimeError("Драйвер X4 обновляется. Повторите после подготовки.")
yield