From 7dda5d81e376307ce945a3b5e874ad0aa640d441 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:46:19 -0647 Subject: [PATCH 01/10] omamobile-shell 0.2.33: NFC polls only while the screen is lit A poll loop is the NFC radio searching for cards. On the Pixel 9a it costs about 60 mA with the screen off (252 mA against 315 mA, awake, 10-27), and stock Android polls only while the screen is on. omamobile-nfc-open now stops neard's poll loop once every display connector has been DPMS off for 4 s, and starts it again when the screen lights, unless the NFC switch is off. Tested on the 9a: no controller interrupts with the screen off, polling again within 2 s of it lighting. --- .../omamobile-shell/bin/omamobile-nfc-open | 65 +++++++++++++++++++ packages/omamobile-shell/test/all | 1 + packages/omamobile-shell/version | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-shell/bin/omamobile-nfc-open b/packages/omamobile-shell/bin/omamobile-nfc-open index 734ea024f..39d8eb2c0 100644 --- a/packages/omamobile-shell/bin/omamobile-nfc-open +++ b/packages/omamobile-shell/bin/omamobile-nfc-open @@ -15,6 +15,11 @@ told when the kernel blocks the radio, so on a block the adapter is powered off through neard (on a kernel that already did, neard's view stays stale), and on an unblock neard is restarted: it finds the adapter again, powers it (DefaultPowered), and a new poll loop starts. + +And it polls only while the screen is lit, as stock Android does: with every +display connector off (DPMS) for SCREEN_OFF_SECONDS, the poll loop stops, +and it starts again when the screen comes on. A poll loop is the radio +searching for cards, which costs the Pixel 9a about 60 mA. """ import glob import subprocess @@ -30,6 +35,7 @@ NEARD = "org.neard" RECORD = "org.neard.Record" ADAPTER = "org.neard.Adapter" REPEAT_SECONDS = 3.0 +SCREEN_OFF_SECONDS = 4 last = {"uri": None, "time": 0.0} @@ -141,6 +147,61 @@ def set_powered(bus, powered): rfkill = {"blocked": None} +screen = {"lit": True, "dark_for": 0} + + +def screen_lit(): + """True unless every connected display connector reports DPMS off.""" + states = [] + for path in glob.glob("/sys/class/drm/card*-*"): + try: + with open(f"{path}/status") as f: + if f.read().strip() != "connected": + continue + with open(f"{path}/dpms") as f: + states.append(f.read().strip()) + except OSError: + continue + return not states or any(state == "On" for state in states) + + +def stop_polling(bus): + try: + objects = bus.call_sync(NEARD, "/", "org.freedesktop.DBus.ObjectManager", + "GetManagedObjects", None, None, + Gio.DBusCallFlags.NONE, -1, None).unpack()[0] + except GLib.Error: + return + for path, interfaces in objects.items(): + adapter = interfaces.get(ADAPTER) + if adapter is None or not adapter.get("Polling"): + continue + try: + bus.call_sync(NEARD, path, ADAPTER, "StopPollLoop", None, None, + Gio.DBusCallFlags.NONE, -1, None) + log(f"screen off: polling stopped on {path}") + except GLib.Error as error: + log(f"could not stop polling on {path}: {error.message}") + + +def follow_screen(bus): + """Every 2 s: stop the poll loop once the screen has been off for a while, + start it again when the screen lights (unless NFC is switched off).""" + lit = screen_lit() + if lit: + screen["dark_for"] = 0 + if not screen["lit"]: + screen["lit"] = True + if not rfkill["blocked"]: + log("screen on: polling again") + start_polling(bus) + return True + screen["dark_for"] += 2 + if screen["lit"] and screen["dark_for"] >= SCREEN_OFF_SECONDS: + screen["lit"] = False + if not rfkill["blocked"]: + stop_polling(bus) + return True def follow_rfkill(bus): @@ -154,6 +215,9 @@ def follow_rfkill(bus): elif previous is not None: log("NFC switched on: restarting neard") restart_neard(bus) + if not screen["lit"]: + # neard powers the adapter and polls by itself: stop it again + GLib.timeout_add_seconds(4, lambda: stop_polling(bus) or False) return True @@ -172,6 +236,7 @@ def main(): # earlier run of it): start from a fresh neard. restart_neard(bus) GLib.timeout_add_seconds(2, follow_rfkill, bus) + GLib.timeout_add_seconds(2, follow_screen, bus) GLib.MainLoop().run() diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 37dc8b355..b202a8128 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -376,6 +376,7 @@ grep -c 'Quickshell.execDetached(HomeModel.urlLaunchArgv(text))' plugins/omamobi grep -c 'HomeModel.commandLaunchArgv(\["sh", "-c", tap\])' plugins/omamobile.home/CommandWidget.qml >/dev/null || fail "the text widget's tap goes through omamobile-launch" grep -c '"omamobile-launch", "url", uri' bin/omamobile-nfc-open >/dev/null || fail "NFC links open through omamobile-launch" grep -c 'GLib.timeout_add_seconds(2, follow_rfkill, bus)' bin/omamobile-nfc-open >/dev/null || fail "the NFC service follows the rfkill switch" +grep -c 'GLib.timeout_add_seconds(2, follow_screen, bus)' bin/omamobile-nfc-open >/dev/null || fail "the NFC service stops polling with the screen off" grep -c '"systemctl", "restart", "neard"' bin/omamobile-nfc-open >/dev/null || fail "an NFC unblock restarts neard" grep -c '^Requires=neard' systemd/omamobile-nfc-open.service >/dev/null && fail "omamobile-nfc-open restarts neard, so it must not Require= it (the restart would loop)" grep -c '"omamobile-launch", "empty"' bin/omamobile-widget >/dev/null || fail "the widget agent's terminal gets an empty workspace" diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index a8498651b..d9955e456 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.32 +0.2.33 From 24d50df330627046e8f239fd04d1c1983c94dae2 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 07:47:19 -0647 Subject: [PATCH 02/10] omamobile-shell 0.2.33: the screen-off stop holds while the screen stays dark The stop was a single shot on the lit-to-dark transition, so anything that started polling afterwards kept it on until the next screen cycle: the unblock path's start_polling retries, the 9a's sleep hook after a wake, or neard restarted by systemd. Now every 2 s check stops any poll loop once the screen has been dark for 4 s, and start_polling powers the adapter but leaves the loop off while it's dark. The one-shot stop after an unblock is gone. test/nfc-screen.py checks screen_lit() against temporary sysfs trees. --- .../omamobile-shell/bin/omamobile-nfc-open | 19 ++++++------ packages/omamobile-shell/test/all | 3 ++ packages/omamobile-shell/test/nfc-screen.py | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 packages/omamobile-shell/test/nfc-screen.py diff --git a/packages/omamobile-shell/bin/omamobile-nfc-open b/packages/omamobile-shell/bin/omamobile-nfc-open index 39d8eb2c0..193f9ee4a 100644 --- a/packages/omamobile-shell/bin/omamobile-nfc-open +++ b/packages/omamobile-shell/bin/omamobile-nfc-open @@ -102,7 +102,9 @@ def start_polling(bus): bus.call_sync(NEARD, path, "org.freedesktop.DBus.Properties", "Set", GLib.Variant("(ssv)", (ADAPTER, "Powered", GLib.Variant("b", True))), None, Gio.DBusCallFlags.NONE, -1, None) - if not adapter.get("Polling"): + if not adapter.get("Polling") and not screen["lit"]: + log(f"screen off: {path} powered, polling waits for the screen") + elif not adapter.get("Polling"): try: bus.call_sync(NEARD, path, ADAPTER, "StartPollLoop", GLib.Variant("(s)", ("Initiator",)), None, @@ -150,10 +152,10 @@ rfkill = {"blocked": None} screen = {"lit": True, "dark_for": 0} -def screen_lit(): +def screen_lit(drm="/sys/class/drm"): """True unless every connected display connector reports DPMS off.""" states = [] - for path in glob.glob("/sys/class/drm/card*-*"): + for path in glob.glob(f"{drm}/card*-*"): try: with open(f"{path}/status") as f: if f.read().strip() != "connected": @@ -185,8 +187,10 @@ def stop_polling(bus): def follow_screen(bus): - """Every 2 s: stop the poll loop once the screen has been off for a while, - start it again when the screen lights (unless NFC is switched off).""" + """Every 2 s: once the screen has been off for a while, stop any poll loop + (each time, so one that neard, a restart or the sleep hook started while + the screen was dark stops too); start it again when the screen lights + (unless NFC is switched off).""" lit = screen_lit() if lit: screen["dark_for"] = 0 @@ -197,7 +201,7 @@ def follow_screen(bus): start_polling(bus) return True screen["dark_for"] += 2 - if screen["lit"] and screen["dark_for"] >= SCREEN_OFF_SECONDS: + if screen["dark_for"] >= SCREEN_OFF_SECONDS: screen["lit"] = False if not rfkill["blocked"]: stop_polling(bus) @@ -215,9 +219,6 @@ def follow_rfkill(bus): elif previous is not None: log("NFC switched on: restarting neard") restart_neard(bus) - if not screen["lit"]: - # neard powers the adapter and polls by itself: stop it again - GLib.timeout_add_seconds(4, lambda: stop_polling(bus) or False) return True diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index b202a8128..64beb8250 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -377,6 +377,9 @@ grep -c 'HomeModel.commandLaunchArgv(\["sh", "-c", tap\])' plugins/omamobile.hom grep -c '"omamobile-launch", "url", uri' bin/omamobile-nfc-open >/dev/null || fail "NFC links open through omamobile-launch" grep -c 'GLib.timeout_add_seconds(2, follow_rfkill, bus)' bin/omamobile-nfc-open >/dev/null || fail "the NFC service follows the rfkill switch" grep -c 'GLib.timeout_add_seconds(2, follow_screen, bus)' bin/omamobile-nfc-open >/dev/null || fail "the NFC service stops polling with the screen off" +python3 -B test/nfc-screen.py >/dev/null || { python3 -B test/nfc-screen.py | grep -v '^ok'; fail "screen_lit reads the connectors"; } +grep -c 'polling waits for the screen' bin/omamobile-nfc-open >/dev/null || fail "start_polling leaves the loop off while the screen is dark" +grep -c 'timeout_add_seconds(4' bin/omamobile-nfc-open >/dev/null && fail "the one-shot stop is gone: the screen check stops polling every time" grep -c '"systemctl", "restart", "neard"' bin/omamobile-nfc-open >/dev/null || fail "an NFC unblock restarts neard" grep -c '^Requires=neard' systemd/omamobile-nfc-open.service >/dev/null && fail "omamobile-nfc-open restarts neard, so it must not Require= it (the restart would loop)" grep -c '"omamobile-launch", "empty"' bin/omamobile-widget >/dev/null || fail "the widget agent's terminal gets an empty workspace" diff --git a/packages/omamobile-shell/test/nfc-screen.py b/packages/omamobile-shell/test/nfc-screen.py new file mode 100644 index 000000000..0c0f63010 --- /dev/null +++ b/packages/omamobile-shell/test/nfc-screen.py @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: MIT +# omamobile-nfc-open's screen_lit() against temporary sysfs trees: connected +# and disconnected connectors, DPMS On and Off, and no connectors at all. +import importlib.machinery, importlib.util, os, sys, tempfile, types +sys.dont_write_bytecode = True # never a __pycache__ next to bin/omamobile-nfc-open + +gi = types.ModuleType("gi"); gi.require_version = lambda *a: None +repo = types.ModuleType("gi.repository"); repo.Gio = repo.GLib = types.SimpleNamespace() +sys.modules.update({"gi": gi, "gi.repository": repo}) +loader = importlib.machinery.SourceFileLoader("nfc_open", os.path.join(os.path.dirname(__file__), "..", "bin", "omamobile-nfc-open")) +nfc = importlib.util.module_from_spec(importlib.util.spec_from_loader("nfc_open", loader)); loader.exec_module(nfc) + +fails = 0 +def case(name, connectors, want): + global fails + with tempfile.TemporaryDirectory() as drm: + for conn, (status, dpms) in connectors.items(): + os.makedirs(f"{drm}/{conn}") + open(f"{drm}/{conn}/status", "w").write(status + "\n") + open(f"{drm}/{conn}/dpms", "w").write(dpms + "\n") + got = nfc.screen_lit(drm) + print(("ok" if got == want else "not ok") + f" - {name}") + fails += got != want + +case("panel on", {"card1-DSI-1": ("connected", "On")}, True) +case("panel off", {"card1-DSI-1": ("connected", "Off")}, False) +case("panel off, a disconnected output on", {"card1-DSI-1": ("connected", "Off"), "card1-DP-1": ("disconnected", "On")}, False) +case("two connected, one on", {"card1-DSI-1": ("connected", "Off"), "card1-HDMI-A-1": ("connected", "On")}, True) +case("only a disconnected output", {"card1-DP-1": ("disconnected", "Off")}, True) +case("no connectors at all", {}, True) +sys.exit(1 if fails else 0) From 891ecb977c70fff6d1d7778632b7636b616c539e Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 03:56:03 -0647 Subject: [PATCH 03/10] omamobile-shell 0.2.34: home widgets see the phone they run on The OWL host answered every device and system query as a Pixel 7 Pro (gs201, 1440x3120, codename cheetah), so a widget on the Pixel 9a or any other port showed the wrong phone. The model and the compatible list now come from the device tree; known boards add the panel's size, rate and density, and an unknown one reports its model and SoC with no display. --- .../plugins/omamobile.home/OwlPhoneHost.qml | 15 ++++++--- .../plugins/omamobile.home/owl/phone.js | 32 ++++++++++++++++--- packages/omamobile-shell/test/owl-core.js | 11 +++++++ packages/omamobile-shell/version | 2 +- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/packages/omamobile-shell/plugins/omamobile.home/OwlPhoneHost.qml b/packages/omamobile-shell/plugins/omamobile.home/OwlPhoneHost.qml index 1b241627b..cd283e662 100644 --- a/packages/omamobile-shell/plugins/omamobile.home/OwlPhoneHost.qml +++ b/packages/omamobile-shell/plugins/omamobile.home/OwlPhoneHost.qml @@ -151,16 +151,23 @@ QtObject { if (kind === "media") { fromCommand("playerctl metadata --format " + JSON.stringify(Phone.MEDIA_FORMAT) + " 2>/dev/null", Phone.mediaFrom); return } if (kind === "modes") { fromCommand("brightnessctl --device=white:torch get 2>/dev/null || echo; makoctl mode 2>/dev/null", Phone.modesFrom); return } if (kind === "system") { - fromCommand("cat /proc/meminfo; echo '@@'; cat /proc/uptime; echo '@@'; uname -r; echo '@@'; df -B1 --output=size,used / | tail -1", function(t) { - const parts = t.split("@@\n") - return Phone.systemFrom(parts[0], parts[1], parts[2], parts[3]) + fromCommand("cat /proc/meminfo; echo '@@'; cat /proc/uptime; echo '@@'; uname -r; echo '@@'; df -B1 --output=size,used / | tail -1; echo '@@@'; " + Phone.DEVICE_COMMAND, function(t) { + const halves = t.split("@@@\n") + const parts = halves[0].split("@@\n") + return Phone.systemFrom(parts[0], parts[1], parts[2], parts[3], Phone.boardFrom(halves[1])) }) return } if (kind === "battery") { fromCommand(Phone.BATTERY_COMMAND, Phone.batteryFrom); return } if (kind === "alarm") { done({ value: { set: false, time: null, app: null } }); return } if (kind === "notifications") { done({ value: { available: false, count: 0, items: [] } }); return } - if (kind === "device") { done({ value: { model: "Pixel 7 Pro", maker: "Google", android: null, sdk: null, soc: "gs201" } }); return } + if (kind === "device") { + fromCommand(Phone.DEVICE_COMMAND, function(t) { + const b = Phone.boardFrom(t) + return { model: b.model, maker: b.maker, android: null, sdk: null, soc: b.soc } + }) + return + } done({ value: null }) } diff --git a/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js b/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js index 50a334ff7..e2254a946 100644 --- a/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js +++ b/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js @@ -305,14 +305,35 @@ function batteryFrom(text) { temp: null, voltage: null, health: null, plugged: null, technology: null, cycles: null } } -// /proc/meminfo, /proc/uptime, uname and df -> android.system. -function systemFrom(meminfo, uptime, kernel, df) { +// The board from the device tree: "model" and the "compatible" list, read by +// DEVICE_COMMAND as "\n@@\n". +var DEVICE_COMMAND = "tr -d '\\0' < /proc/device-tree/model 2>/dev/null; echo; echo '@@'; tr '\\0' '\\n' < /proc/device-tree/compatible 2>/dev/null" +// What the device tree doesn't say, for the boards Omarchy Mobile runs on. +var BOARDS = { + cheetah: { model: "Pixel 7 Pro", soc: "gs201", display: { width: 1440, height: 3120, hz: 120, dpi: 512 } }, + tegu: { model: "Pixel 9a", soc: "zumapro", display: { width: 1080, height: 2424, hz: 120, dpi: 422 } } +} +// "google,gs201-cheetah" or "google,zumapro-tegu" -> codename and SoC. +function boardFrom(text) { + var parts = String(text || "").split("@@\n") + var model = String(parts[0] || "").trim() + var compat = String(parts[1] || "").split("\n").map(function(c) { return c.trim() }).filter(function(c) { return c }) + var m = /^[^,]+,([^-]+)-(.+)$/.exec(compat[0] || "") + var codename = m ? m[2] : null + var known = (codename && BOARDS[codename]) || {} + return { model: known.model || model.replace(/^Google\s+/, "") || null, maker: /^Google\b/.test(model) || /^google,/.test(compat[0] || "") ? "Google" : null, + codename: codename, soc: known.soc || (m ? m[1] : null), display: known.display || null } +} + +// /proc/meminfo, /proc/uptime, uname and df (and the board) -> android.system. +function systemFrom(meminfo, uptime, kernel, df, board) { + var b = board || {} var kb = function(name) { var m = new RegExp("^" + name + ":\\s+(\\d+)", "m").exec(meminfo || ""); return m ? parseInt(m[1], 10) * 1024 : null } var total = kb("MemTotal"), available = kb("MemAvailable") return { kernel: String(kernel || "").trim() || null, uptime: Math.floor(parseFloat(uptime) || 0), memory: { total: total, used: total !== null && available !== null ? total - available : null, available: available }, - storage: storageFrom(df), cpu: { soc: "gs201", maker: "Google", hardware: null, cores: 8, abi: "arm64-v8a", maxMhz: null }, - display: { width: 1440, height: 3120, hz: 120, dpi: 512 }, build: null, codename: "cheetah", patch: null, + storage: storageFrom(df), cpu: { soc: b.soc || null, maker: b.maker || null, hardware: null, cores: 8, abi: "arm64-v8a", maxMhz: null }, + display: b.display || null, build: null, codename: b.codename || null, patch: null, locale: null, timezone: null, launcher: "omamobile", theme: null, apps: 0 } } @@ -345,6 +366,7 @@ if (typeof module !== "undefined") { sourceLimits: sourceLimits, LIMITS: LIMITS, hostOf: hostOf, OWL_CELL_DP: OWL_CELL_DP, actionArgv: actionArgv, volumeFrom: volumeFrom, mediaFrom: mediaFrom, MEDIA_FORMAT: MEDIA_FORMAT, modesFrom: modesFrom, systemFrom: systemFrom, storageFrom: storageFrom, - batteryFrom: batteryFrom, BATTERY_COMMAND: BATTERY_COMMAND, panelOff: panelOff, DEVICE_ACTIONS: DEVICE_ACTIONS + batteryFrom: batteryFrom, BATTERY_COMMAND: BATTERY_COMMAND, + boardFrom: boardFrom, DEVICE_COMMAND: DEVICE_COMMAND, BOARDS: BOARDS, panelOff: panelOff, DEVICE_ACTIONS: DEVICE_ACTIONS } } diff --git a/packages/omamobile-shell/test/owl-core.js b/packages/omamobile-shell/test/owl-core.js index 56d320703..836014a70 100644 --- a/packages/omamobile-shell/test/owl-core.js +++ b/packages/omamobile-shell/test/owl-core.js @@ -341,6 +341,17 @@ test("phone actions and android.* answers, with mocks", () => { eq([sys.kernel, sys.uptime, sys.memory], ["7.3.0", 123, { total: 8192000, used: 5120000, available: 3072000 }]) eq(P.systemFrom("", "1", "7.3.0\n", " 116041613312 16160268288\n").storage, { total: 116041613312, used: 16160268288, available: 99881345024 }) eq([sys.storage, P.storageFrom("Size Used"), P.storageFrom("0 0")], [null, null, null]) + // the board comes from the device tree, not a fixed Pixel 7 Pro + const tegu = P.boardFrom("Google Pixel 9a\n@@\ngoogle,zumapro-tegu\ngoogle,zumapro\n") + eq([tegu.model, tegu.maker, tegu.codename, tegu.soc, tegu.display.width], ["Pixel 9a", "Google", "tegu", "zumapro", 1080]) + const cheetah = P.boardFrom("Google Pixel 7 Pro\n@@\ngoogle,gs201-cheetah\ngoogle,gs201\n") + eq([cheetah.model, cheetah.codename, cheetah.soc, cheetah.display.height], ["Pixel 7 Pro", "cheetah", "gs201", 3120]) + const other = P.boardFrom("OnePlus 13\n@@\noneplus,sm8750-dodge\nqcom,sm8750\n") + eq([other.model, other.maker, other.codename, other.soc, other.display], ["OnePlus 13", null, "dodge", "sm8750", null]) + eq([P.boardFrom("").model, P.boardFrom("").codename], [null, null]) + const s9 = P.systemFrom("", "1", "7.3.0\n", "", tegu) + eq([s9.codename, s9.cpu.soc, s9.display.dpi], ["tegu", "zumapro", 422]) + eq([P.systemFrom("", "1", "7.3.0\n").codename, P.systemFrom("", "1", "7.3.0\n").display], [null, null]) eq([P.batteryFrom("97\nCharging\n").level, P.batteryFrom("97\nCharging\n").charging, P.batteryFrom("97\nCharging\n").status], [97, true, "charging"]) eq([P.batteryFrom("").level, P.batteryFrom("").status], [null, null]) eq([P.panelOff("0\n"), P.panelOff("4\n"), P.panelOff("")], [false, true, false]) diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index d9955e456..69ca21255 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.33 +0.2.34 From 76a75ded80b903db3c2abd50da88ae1b6232c7df Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 22:51:09 -0647 Subject: [PATCH 04/10] omamobile-audio tests: the fake mixer and PipeWire write their state atomically The watchdog's jump test changes a control from a background job while the watchdog reads the fake mixer's state file, and CI once caught the read halfway through the write (JSONDecodeError, the test failed). Both fakes now write a temporary file and rename it over the state. --- packages/omamobile-audio/test/fake-amixer | 6 +++++- packages/omamobile-audio/test/fake-pw | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-audio/test/fake-amixer b/packages/omamobile-audio/test/fake-amixer index 79d6b8776..fd00ead52 100755 --- a/packages/omamobile-audio/test/fake-amixer +++ b/packages/omamobile-audio/test/fake-amixer @@ -76,8 +76,12 @@ def load(): def save(c): - with open(state_path, 'w') as f: + # write and rename, so a reader running at the same moment (the + # watchdog while a test changes a control) never sees half a file + tmp = f'{state_path}.{os.getpid()}' + with open(tmp, 'w') as f: json.dump(c, f) + os.replace(tmp, state_path) def show(name, ctl): diff --git a/packages/omamobile-audio/test/fake-pw b/packages/omamobile-audio/test/fake-pw index 2577c4e6c..7a23b7c54 100755 --- a/packages/omamobile-audio/test/fake-pw +++ b/packages/omamobile-audio/test/fake-pw @@ -62,8 +62,10 @@ if me == 'pw-cli': if k not in vals or os.environ.get('FAKE_PW_IGNORE') == '1': continue # the filter ignores unknown controls vals[k] = float(v) - with open(state, 'w') as f: + tmp = f'{state}.{os.getpid()}' + with open(tmp, 'w') as f: json.dump(vals, f) + os.replace(tmp, state) log(args[3]) sys.exit(0) if me == 'wpctl': From f61052e0b6a04e3b4f0dbf435ab3eb1bd4473109 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 00:34:35 -0647 Subject: [PATCH 05/10] omamobile-audio 0.5.5: the tests' control backend writes atomically too The flake had a second writer: JsonCtl, the json: control backend the tests run the speaker code against, rewrites the fake mixer's state on every heartbeat read, in place. The fake mixer reading at that moment saw an empty file. JsonCtl now writes a temporary file and renames it, as the fakes do. Nothing changes on the palmtop: JsonCtl is used only with OMAMOBILE_CTL_BACKEND=json:. --- packages/omamobile-audio/lib/speaker_dsp.py | 14 ++++++++++---- packages/omamobile-audio/version | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/omamobile-audio/lib/speaker_dsp.py b/packages/omamobile-audio/lib/speaker_dsp.py index 162bde627..6842cf3ee 100644 --- a/packages/omamobile-audio/lib/speaker_dsp.py +++ b/packages/omamobile-audio/lib/speaker_dsp.py @@ -221,6 +221,14 @@ def _load(self): except (OSError, ValueError): return {} + def _save(self, state): + # rename over the file, so the fake mixer reading it at the same + # moment never sees half of it + tmp = f'{self.path}.{os.getpid()}' + with open(tmp, 'w') as f: + json.dump(state, f) + os.replace(tmp, self.path) + def names(self): return list(self._load()) @@ -238,8 +246,7 @@ def read(self, name): if name.endswith('HALO_HEARTBEAT') and os.environ.get('FAKE_HB_STUCK') != '1' and not frozen: v += 1 # the firmware's heartbeat moves while it runs c['v'] = list(v.to_bytes(4, 'big')) - with open(self.path, 'w') as f: - json.dump(state, f) + self._save(state) return v if t == 'ENUMERATED': return c['items'][c['v']] @@ -274,8 +281,7 @@ def write_bytes(self, name, data): if log_path: with open(log_path, 'a') as f: f.write(name + '\n') - with open(self.path, 'w') as f: - json.dump(state, f) + self._save(state) return True diff --git a/packages/omamobile-audio/version b/packages/omamobile-audio/version index 7d8568351..d1d899fa3 100644 --- a/packages/omamobile-audio/version +++ b/packages/omamobile-audio/version @@ -1 +1 @@ -0.5.4 +0.5.5 From 7dce509daacceb405fe4796b481357a46d18dde3 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 00:55:29 -0647 Subject: [PATCH 06/10] omamobile-audio tests: the temperature jump comes after the watchdog's first reading The jump tests changed the estimate 0.4 s after starting the watchdog. On a slow CI runner the watchdog wasn't reading yet, took the raised value as its baseline, saw no jump and didn't mute. The jump now waits for the watchdog's start line and a few intervals, and the watchdog runs 60 iterations. --- packages/omamobile-audio/test/all | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/omamobile-audio/test/all b/packages/omamobile-audio/test/all index 4b17bed90..a694a0928 100755 --- a/packages/omamobile-audio/test/all +++ b/packages/omamobile-audio/test/all @@ -351,8 +351,12 @@ pass "watchdog: mutes on DSP errors, bypass, levels, runtime PM, a stuck heartbe # level drop, so a jump there must not mute; OMAMOBILE_SPK_TEMP_JUMP brings it back. jump() { # name [wprep...]: watchdog on a running stream; the bottom's estimate goes 25 -> 40 C a moment in local n=$1; shift; echo 'state: RUNNING' > "$r/asound/card0/pcm5p/sub0/status"; wprep=("$@") - ( sleep 0.4; amx cset "name=Bottom DSP1 Protection cd CSPL_TEMPERATURE" 0x00,0x0a,0x00,0x00 >/dev/null ) & - watchrun; wait + # the jump comes once the watchdog has its first reading (its start line, + # then a few intervals), not at a fixed time: a slow runner started it late + rm -f "$r/watch.out" + ( for _ in $(seq 1 100); do grep -c 'watchdog: watching' "$r/watch.out" >/dev/null 2>&1 && break; sleep 0.05; done + sleep 0.3; amx cset "name=Bottom DSP1 Protection cd CSPL_TEMPERATURE" 0x00,0x0a,0x00,0x00 >/dev/null ) & + WATCH_N=60 watchrun; wait } startok w-jump8; jump w-jump8 ((rc == 0)) && ! muted && grep -c 'jump rule off' "$r/watch.out" >/dev/null || { cat "$r/watch.out" >&2; fail "watchdog: at analog 10 or below a 15 C jump of the estimate does not mute (C9j)"; } From e1f3e73175dcd0c91a10fe2d019875625116d88e Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 07:52:58 -0647 Subject: [PATCH 07/10] omamobile-shell 0.2.34: say that the board table's hz is the panel's top rate As asked on the pull request: display.hz is what the panel can do, not the rate it runs at now (the 9a's published kernel still runs it at 60 Hz). --- packages/omamobile-shell/plugins/omamobile.home/owl/phone.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js b/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js index e2254a946..47ba624e3 100644 --- a/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js +++ b/packages/omamobile-shell/plugins/omamobile.home/owl/phone.js @@ -308,7 +308,9 @@ function batteryFrom(text) { // The board from the device tree: "model" and the "compatible" list, read by // DEVICE_COMMAND as "\n@@\n". var DEVICE_COMMAND = "tr -d '\\0' < /proc/device-tree/model 2>/dev/null; echo; echo '@@'; tr '\\0' '\\n' < /proc/device-tree/compatible 2>/dev/null" -// What the device tree doesn't say, for the boards Omarchy Mobile runs on. +// What the device tree doesn't say, for the boards Omarchy Mobile runs on: +// the panel's size, density and top refresh rate (what it can do, not the +// rate it runs at now). var BOARDS = { cheetah: { model: "Pixel 7 Pro", soc: "gs201", display: { width: 1440, height: 3120, hz: 120, dpi: 512 } }, tegu: { model: "Pixel 9a", soc: "zumapro", display: { width: 1080, height: 2424, hz: 120, dpi: 422 } } From d7d7220b82363eaff50a19ca1c3b1dd716a3d3ba Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 04:24:26 -0647 Subject: [PATCH 08/10] omamobile-shell 0.2.35: the Pixel 9a's display scale omamobile-setup-user seeded every phone's Hyprland scale at 3, the Pixel 7 Pro's (480x1040 logical). On the Pixel 9a's 1080x2424 panel that is 360 pixels wide, smaller than its owner chose on 2026-10-25: 8/3, 405x909. The 9a now gets 8 / 3 (monitors.lua is Lua, so the expression is its value); other phones keep 3. Seeded once, as before, so a user's own scale stays. --- packages/omamobile-shell/bin/omamobile-setup-user | 8 ++++++-- packages/omamobile-shell/test/all | 6 ++++++ packages/omamobile-shell/version | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 69043b972..516627d34 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -100,9 +100,13 @@ if omarchy-done ensure omamobile-credential-type; then fi fi -# Phone scale: 1440x3120 at 3 is 480x1040 logical, seeded once +# Phone scale, seeded once: the Pixel 7 Pro's 1440x3120 at 3 is 480x1040 +# logical; the Pixel 9a's 1080x2424 at 8/3 is 405x909, its owner's choice +# (device/tegu NOTES, 2026-10-25). monitors.lua is Lua, so 8 / 3 is a value. +scale=3 +tr -d '\0' < /proc/device-tree/compatible 2>/dev/null | grep -c 'google,zumapro-tegu' >/dev/null && scale='8 \/ 3' if omarchy-done ensure omamobile-monitor-scale; then - sed -i 's/^local omarchy_monitor_scale = .*/local omarchy_monitor_scale = 3/' ~/.config/hypr/monitors.lua + sed -i "s/^local omarchy_monitor_scale = .*/local omarchy_monitor_scale = $scale/" ~/.config/hypr/monitors.lua fi # ...and GDK_SCALE to match (TOUCH-PLAN 2.8): at Omarchy's 2, X11 GTK apps # (xwayland force_zero_scaling) drew at two thirds of the size of the rest. diff --git a/packages/omamobile-shell/test/all b/packages/omamobile-shell/test/all index 64beb8250..64af19092 100755 --- a/packages/omamobile-shell/test/all +++ b/packages/omamobile-shell/test/all @@ -71,6 +71,12 @@ b=plugins/omamobile.back/Back.qml python3 -c 'import json; assert {"id": "omamobile.back"} in json.load(open("profile/shell.json"))["plugins"]' \ || fail "the phone profile enables the back gesture" grep -c 'add_plugin omamobile.back' bin/omamobile-setup-user >/dev/null || fail "existing users get the back gesture" +grep -c "google,zumapro-tegu' >/dev/null && scale='8 \\\\/ 3'" bin/omamobile-setup-user >/dev/null || fail "the 9a's scale is 8/3" +# the seeded line stays valid Lua for both scales +for sc in 3 '8 \/ 3'; do + t=$(printf 'local omarchy_monitor_scale = 2\n' | sed "s/^local omarchy_monitor_scale = .*/local omarchy_monitor_scale = $sc/") + [[ $t == 'local omarchy_monitor_scale = 3' || $t == 'local omarchy_monitor_scale = 8 / 3' ]] || fail "the seeded scale line ($t)" +done grep -c 'Quickshell.execDetached(BackModel.ESCAPE_ARGV)' "$b" >/dev/null || fail "back sends Escape through BackModel" grep -c 'WlrLayershell.namespace: "omamobile-back"' "$b" >/dev/null || fail "back strips' namespace" grep -c 'mask: Region { item: strip }' "$b" >/dev/null || fail "only the edge strip takes touches" diff --git a/packages/omamobile-shell/version b/packages/omamobile-shell/version index 69ca21255..e7ccda1a3 100644 --- a/packages/omamobile-shell/version +++ b/packages/omamobile-shell/version @@ -1 +1 @@ -0.2.34 +0.2.35 From 02e8d5ed0120bdae813481b85c3388717c0d9dae Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 07:55:04 -0647 Subject: [PATCH 09/10] omamobile-shell 0.2.35: test the 9a's scale, and record the choice in tegu's NOTES setup-user reads the compatible through OMAMOBILE_DT, so its test no longer depends on the machine it runs on (it failed when the package was built on the 9a itself). The test now runs a 7 Pro and a 9a device tree and checks 8 / 3 and that GDK_SCALE is left alone on the 9a. tegu's NOTES gets the dated entry for the 8/3 choice and its display row says so. --- device/tegu/NOTES.md | 13 ++++++++++++- .../omamobile-shell/bin/omamobile-setup-user | 2 +- packages/omamobile-shell/test/setup-user.sh | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 31ad87f8e..78b2aa197 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -89,6 +89,17 @@ Kernel `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, tools at `7310 Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.16, mesa 1:26.2.4-1.4, omacam 0.1.9-1, omamobile-apps 0.2.0-1, omamobile-audio 0.4.1-1, omamobile-device-tegu 0.1.0-1, omamobile-fingerprint 0.1.8-1, omamobile-firstboot 0.1.0-1, omamobile-gnss 0.2.1-1, omamobile-keyring 20261013-1, omamobile-mirror 0.1.1-1, omamobile-modem 0.1.4-1, omamobile-omarchy 0.1.4-1, omamobile-owl-widgets 0.1.1-1, omamobile-sensors 0.2.0-1, omamobile-shell 0.2.17-1, omarchy 4.0.6-1, quickshell 0.3.2.r7.g2b4501a-1 +## 2026-10-25: display scale 8/3 + +On the reference 9a (`7.3.0-rc6` integration kernel, 1080x2424 panel at +60 Hz), the owner compared the bring-up's scale 2 (540x1212 logical) with +8/3 (405x909) on the running desktop, side by side with an iPhone, and kept +8/3: "about right", about a third larger than 2. Hyprland reported no config +errors, and running apps fit. 3 (360x808) is the Pixel 7 Pro's default and +too small here. omamobile-shell 0.2.35 makes 8/3 the scale a new 9a user +gets (`omamobile-setup-user`, seeded once), so it's the default for every +new 9a install, not only this one; a user's own scale is kept. + ## 2026-10-24: local curated candidate [V] A later candidate, `7.3.0-rc6-omamobile-tegu-g7e457a96fc45`, reaches @@ -305,7 +316,7 @@ stock-B Android boot is not claimed. | Root and CPUs | Arch on internal ext4 userdata, systemd/SDDM/UWSM/logind, CPU0-7 online. KVM disabled. | | Protection | Whole main-LUN node absent; only five B boot partitions and userdata writable; protected partitions read-only; per-boot guard and watchdog checks pass. | | USB | NCM, ACM and root SSH over the connected cable. | -| Display | Bootloader framebuffer through simpledrm, 1080x2424, scale 2. Reported 60 Hz is not an independently measured panel rate. | +| Display | Bootloader framebuffer through simpledrm, 1080x2424, then scale 2 (first light). Scale 8/3 since 2026-10-25, see that entry. Reported 60 Hz is not an independently measured panel rate. | | Touch | Synaptics S3908 TouchComm v1: taps, long press, launcher, quick settings and all four swipe directions physically exercised by the owner. | | GPU | Mali-G715 MC7: Panthor initialization, system Mesa GLES3.1 color readback, actual Hyprland/shell GPU rendering and automatic startup after local reboot. | diff --git a/packages/omamobile-shell/bin/omamobile-setup-user b/packages/omamobile-shell/bin/omamobile-setup-user index 516627d34..c40458173 100755 --- a/packages/omamobile-shell/bin/omamobile-setup-user +++ b/packages/omamobile-shell/bin/omamobile-setup-user @@ -104,7 +104,7 @@ fi # logical; the Pixel 9a's 1080x2424 at 8/3 is 405x909, its owner's choice # (device/tegu NOTES, 2026-10-25). monitors.lua is Lua, so 8 / 3 is a value. scale=3 -tr -d '\0' < /proc/device-tree/compatible 2>/dev/null | grep -c 'google,zumapro-tegu' >/dev/null && scale='8 \/ 3' +tr -d '\0' < "${OMAMOBILE_DT:-/proc/device-tree}/compatible" 2>/dev/null | grep -c 'google,zumapro-tegu' >/dev/null && scale='8 \/ 3' if omarchy-done ensure omamobile-monitor-scale; then sed -i "s/^local omarchy_monitor_scale = .*/local omarchy_monitor_scale = $scale/" ~/.config/hypr/monitors.lua fi diff --git a/packages/omamobile-shell/test/setup-user.sh b/packages/omamobile-shell/test/setup-user.sh index eb412b7f5..72231beaf 100644 --- a/packages/omamobile-shell/test/setup-user.sh +++ b/packages/omamobile-shell/test/setup-user.sh @@ -40,8 +40,14 @@ done printf '[Desktop Entry]\nType=Application\nName=Disks\nNoDisplay=false\nExec=gnome-disks\n' >"$A/org.gnome.DiskUtility.desktop" printf '[Desktop Entry]\nType=Application\nName=Papers\nExec=papers\n' >"$A/org.gnome.Papers.desktop" +# The board, from a fake device tree so the host's own doesn't matter: the +# Pixel 7 Pro by default, the Pixel 9a where a test asks for it +for b in gs201-cheetah:gs201 zumapro-tegu:zumapro; do + mkdir -p "$t/dt-${b%%:*}"; printf 'google,%s\0google,%s\0' "${b%%:*}" "${b#*:}" >"$t/dt-${b%%:*}/compatible" +done run() { env -i HOME="${RUN_HOME:-$H}" PATH="$F:/usr/bin:/bin" XDG_RUNTIME_DIR="$t" OMAMOBILE_SHELL_SHARE="$pkg" OMAMOBILE_SYSTEM_APPLICATIONS="$A" \ + OMAMOBILE_DT="${RUN_DT:-$t/dt-gs201-cheetah}" \ bash bin/omamobile-setup-user >"$t/out" 2>&1 || { cat "$t/out"; fail "omamobile-setup-user runs"; } } run @@ -146,3 +152,13 @@ cmp -s "$h/.config/foot/foot.ini" "$t/custom-foot.ini" || fail "a user's own foo [[ $(grep -cx -- --enable-wayland-ime "$h/.config/chromium-flags.conf") == 1 ]] || fail "a flag the user has isn't added twice" grep -cx -- --wayland-text-input-version=3 "$h/.config/chromium-flags.conf" >/dev/null || fail "the missing flag is added" pass "GDK scale, foot and Chromium's input method, once each, and a user's own values are kept" + +# The Pixel 9a: a new user gets 8 / 3 (405x909 logical), and GDK_SCALE stays +# Omarchy's 2 (its step only follows a monitor scale of exactly 3) +h9=$t/tegu; mkdir -p "$h9/.config/hypr" "$h9/.config/omarchy/extensions" +cp "$H"/.config/hypr/{looknfeel,autostart}.lua "$h9/.config/hypr/" +printf 'local omarchy_gdk_scale = 2\nlocal omarchy_monitor_scale = "auto"\n' >"$h9/.config/hypr/monitors.lua" +RUN_HOME=$h9 RUN_DT=$t/dt-zumapro-tegu run +grep -cx 'local omarchy_monitor_scale = 8 / 3' "$h9/.config/hypr/monitors.lua" >/dev/null || fail "the 9a's monitor scale is 8 / 3" +grep -cx 'local omarchy_gdk_scale = 2' "$h9/.config/hypr/monitors.lua" >/dev/null || fail "the 9a's GDK_SCALE step is skipped" +pass "the Pixel 9a's scale: 8 / 3, GDK_SCALE left at 2" From df271d605b9eafb032ebf0f7f7624f7db5e52330 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 13:58:29 -0647 Subject: [PATCH 10/10] device/tegu: the scale note gives the full kernel release --- device/tegu/NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 78b2aa197..af4568cf5 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -91,7 +91,7 @@ Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.16, mesa 1:26.2.4-1.4, omacam 0 ## 2026-10-25: display scale 8/3 -On the reference 9a (`7.3.0-rc6` integration kernel, 1080x2424 panel at +On the reference 9a (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, 1080x2424 panel at 60 Hz), the owner compared the bring-up's scale 2 (540x1212 logical) with 8/3 (405x909) on the running desktop, side by side with an iPhone, and kept 8/3: "about right", about a third larger than 2. Hyprland reported no config