feat(x4): add per-camera manual wake and hide power action when connected

This commit is contained in:
DCCONSTRUCTIONS
2026-09-10 16:27:48 +03:00
parent db14ee5435
commit 99f29218d7
27 changed files with 992 additions and 126 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ import sys
ROOT = Path(__file__).resolve().parents[1]
BINARY_VERSION = "0.8.20"
VERSION = "0.8.20"
BINARY_VERSION = "0.8.21"
VERSION = "0.8.21-3"
sys.path.insert(0, str(ROOT.parents[1] / "scripts/packaging"))
from debian import package
@@ -1,8 +1,8 @@
{
"schema": "missioncore.node.bundled-model/v1",
"model_id": "insta360.x4",
"version": "0.1.3-7",
"revision": "45e14de38a278914eedf5cbb",
"bytes": 58210794,
"sha256": "96ce6b52fa72d79ec6f8b0d13bc2af53afda61077b40a3358a3d145295a62d19"
"version": "0.1.3-9",
"revision": "0b1085386d53e65760a9610f",
"bytes": 58211732,
"sha256": "eb6331680fbe8cac56eb745c31d7c37618a9dff67bc2a190681a384813cdc709"
}
@@ -121,6 +121,68 @@ def finish_legacy_monitor_pager():
raise RuntimeError("Старая транзакция ещё не завершилась; она не прерывалась.")
def update_installed_x4(run):
"""Upgrade an existing model through its fixed profile, even with camera off.
Bare Ubuntu still uses the application's first preparation. No SDK check or
wake is implied by updating installed package bytes.
"""
result = subprocess.run(
["/usr/bin/dpkg-query", "-W", "-f", "${Status}", "mission-core-insta360-x4"],
capture_output=True,
text=True,
timeout=10,
)
if result.returncode or result.stdout.strip() != "install ok installed":
return {"state": "not-installed"}
profile = json.loads(
Path("/usr/share/mission-core-node/profiles/insta360-x4/profile.json").read_text()
)
installed = run(
"x4-installed-before",
[
"/usr/bin/dpkg-query",
"-W",
"-f",
"${Version}",
"mission-core-insta360-x4",
],
)
if installed == profile["version"]:
return {"state": "current", "version": installed}
# The shipped profile verifies root-owned bytes, lifecycle quiescence and
# dependency closure. It never requires a connected camera for package upgrade.
run(
"x4-bundle-update",
[
"/usr/bin/systemctl",
"start",
"mission-core-node-insta360-x4-profile.service",
],
timeout=None,
)
after = run(
"x4-installed-after",
[
"/usr/bin/dpkg-query",
"-W",
"-f",
"${Version}",
"mission-core-insta360-x4",
],
)
state = json.loads(
Path("/var/lib/mission-core-node-profiles/insta360-x4/preparation.json").read_text()
)
if (
after != profile["version"]
or state.get("state") != "complete"
or state.get("revision") != profile["revision"]
):
raise RuntimeError("Обновление установленного драйвера X4 не подтверждено.")
return {"state": "updated", "version": after, "camera_verification": "not-performed"}
def main():
if os.geteuid() or sys.argv[1:]:
raise ValueError("Use the release's local Ubuntu installer")
@@ -163,7 +225,7 @@ def main():
"started_at": datetime.now(UTC).isoformat(),
"monotonic_started": time.monotonic(),
"state": "running",
"scope": "Node-package-and-UI-only; X4-prepare-remains-in-application",
"scope": "Node-package-UI-and-existing-model-update; first-X4-prepare-in-application",
"steps": [],
}
env = {
@@ -238,6 +300,8 @@ def main():
)
if installed != version + "\tinstall ok installed":
raise RuntimeError("Версия установленного Node не подтверждена.")
report["x4_bundle"] = update_installed_x4(run)
publish()
run(
"node-service",
["/usr/bin/systemctl", "is-active", "--quiet", "mission-core-node.service"],