Add voice buttons, Wi-Fi netconfig, and demo STT server
This commit is contained in:
@@ -56,6 +56,9 @@ import json, os, subprocess, sys
|
||||
cfg_path, script = sys.argv[1], sys.argv[2]
|
||||
with open(cfg_path, encoding="utf-8") as f:
|
||||
cfg = json.load(f)
|
||||
if cfg.get("disabled"):
|
||||
print("bt-netconfig-boot: saved config marked disabled, skip", flush=True)
|
||||
sys.exit(0)
|
||||
iface = (cfg.get("iface") or "").strip()
|
||||
mode = (cfg.get("mode") or "").strip()
|
||||
if not iface or mode not in ("dhcp", "static"):
|
||||
@@ -68,6 +71,12 @@ if mode == "static":
|
||||
cfg.get("gateway", ""),
|
||||
cfg.get("dns", ""),
|
||||
]
|
||||
net_type = (cfg.get("type") or "ethernet").strip().lower()
|
||||
if net_type == "wifi":
|
||||
ssid = (cfg.get("ssid") or "").strip()
|
||||
if not ssid:
|
||||
sys.exit(0)
|
||||
args += ["wifi", ssid, cfg.get("password") or ""]
|
||||
env = os.environ.copy()
|
||||
env.setdefault("BUTTONTASK_NET_BOOT", "1")
|
||||
raise SystemExit(subprocess.run(args, env=env).returncode)
|
||||
|
||||
Reference in New Issue
Block a user