#!/usr/bin/env python3 # SPDX-License-Identifier: MPL-2.0 """Cycle Gaia airplane mode and verify Nokia modem state, then restore settings. Requires an idle manual Nokia trial. Does not call, send messages or flash. """ import argparse import importlib.util import json from pathlib import Path import time spec=importlib.util.spec_from_file_location('wifi',Path(__file__).with_name('test-beatles-wifi.py')) bridge=importlib.util.module_from_spec(spec);spec.loader.exec_module(bridge) probe=lambda code:bridge.probe('system',code) def state(): return probe('''const s=await navigator.mozSettings.createLock().get('*'); const h=await VulpesCompat.call('platform.snapshot',{}); return {airplane:s['airplaneMode.enabled'],status:s['airplaneMode.status'],wifi:s['wifi.enabled'],nativeWifi:h.wifi.enabled,wifiState:h.wifi.state, radios:h.radio.map(r=>({slot:r.slot,state:r.radioState,registered:!!r.voice?.connected,type:r.voice?.type})), gaia:[...navigator.mozMobileConnections].map(c=>c.radioState)};''') def wait(predicate,seconds=45): deadline=time.monotonic()+seconds while time.monotonic()