From f18fa3d018e44770a3b92fdba8fd658b910b1898 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 18 Nov 2026 10:14:13 -0500 Subject: [PATCH 1/2] omamobile-shell: the power-key flash test no longer races its own stand-in The stand-in for omarchy-brightness-display turned the fake panel off and then wrote "panel-off" to the call log. omamobile-keys polls the panel files every 50 ms, so on a loaded machine it could see the panel off and log "brightnessctl ... set 2083" before the stand-in's own line landed, and the test failed with "the saved brightness goes back only after the panel is off" on a PR that touched nothing in this package (CI run 44324012922, 2026-11-18). The stand-in now writes its line just before it flips the files. With a 0.2 s pause put between the two steps the old order fails every time with that message and the new one passes. The three fixed sleeps after a press in this block (1.5 s, 1 s, 1 s) are now waits for the line the press ends with, up to 10 s, so a slow machine is waited for and a fast one loses no time. Test only: nothing the package installs changes, so no version bump. Co-Authored-By: Claude Fable 5.2 --- packages/omamobile-shell/test/keys.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/omamobile-shell/test/keys.sh b/packages/omamobile-shell/test/keys.sh index 8fc5d85de..fbc92c8b6 100755 --- a/packages/omamobile-shell/test/keys.sh +++ b/packages/omamobile-shell/test/keys.sh @@ -109,8 +109,14 @@ before "omarchy-system-lock" "omarchy-shell lock dark" && before "omarchy-shell # reads as off (bl_power 4 or the connector's dpms Off), or the lock screen shows # at full brightness for an instant. Here the stand-in flips hyprctl's dpmsStatus # when "omarchy-brightness-display off" is called and the panel 0.4 s later, -# writing "panel-off" to the log when it does; with a real device name, a saved +# writing "panel-off" to the log just before it does (before, not after: the +# key handler polls the panel files every 50 ms, and with the log line written +# last it could see the panel off and log its own lines first on a loaded +# machine, which failed CI on 2026-11-18); with a real device name, a saved # level of 2083, and a second case where the panel never goes off. +# logged LINE: wait up to 10 s for LINE in the log, so a slow machine is +# waited for and a fast one loses no time. +logged() { local _; for _ in $(seq 100); do grep -qxF -- "$1" "$log" && return 0; sleep 0.1; done; return 1; } mkdir -p "$t/orig"; cp "$t"/bin/omarchy-hw-display "$t"/bin/brightnessctl "$t"/bin/omarchy-brightness-display "$t/orig/" cat >"$t/bin/omarchy-hw-display" <"$t/bin/omarchy-brightness-display" <>"$log" if [[ \$1 == off && -f "$t/async-off" ]]; then echo false >"$t/dpms" - ( sleep 0.4; echo 4 >"$t/sys/class/backlight/panel/bl_power"; echo Off >"$t/sys/class/drm/card0-DSI-1/dpms"; echo "panel-off" >>"$log" ) >/dev/null 2>&1 & + ( sleep 0.4; echo "panel-off" >>"$log"; echo 4 >"$t/sys/class/backlight/panel/bl_power"; echo Off >"$t/sys/class/drm/card0-DSI-1/dpms" ) >/dev/null 2>&1 & fi STUB chmod +x "$t"/bin/* panel_on() { echo true >"$t/dpms"; mkdir -p "$t/sys/class/backlight/panel" "$t/sys/class/drm/card0-DSI-1"; echo 0 >"$t/sys/class/backlight/panel/bl_power"; echo On >"$t/sys/class/drm/card0-DSI-1/dpms"; echo connected >"$t/sys/class/drm/card0-DSI-1/status"; } echo false >"$t/locked"; panel_on; : >"$t/async-off" -reset; keys power-down; keys power-up; sleep 1.5 +reset; keys power-down; keys power-up; logged "omamobile-sleepd now" || fail "flash: the press ends by asking for sleep" before "brightnessctl -q -d panel set 0" "omarchy-system-lock" || fail "flash: the panel goes dark by the backlight before the lock is built" before "panel-off" "brightnessctl -q -d panel set 2083" || fail "flash: the saved brightness goes back only after the panel is off" before "panel-off" "omamobile-sleepd now" || fail "flash: sleep is asked for after the panel is off" @@ -153,12 +159,12 @@ grep -q "brightnessctl -q -d panel set 2083" "$log" || fail "flash: with a panel # No panel files at all (another machine): Hyprland's answer is all there is. rm -rf "$t/sys/class/drm/card0-DSI-1" "$t/sys/class/backlight/panel"; : >"$t/async-off" reset; start=$(date +%s%N); keys power-down; keys power-up -took=$(( ($(date +%s%N) - start) / 1000000 )); sleep 1 -grep -q "brightnessctl -q -d panel set 2083" "$log" || fail "flash: with no panel files the brightness goes back by Hyprland's word" +took=$(( ($(date +%s%N) - start) / 1000000 )) +logged "brightnessctl -q -d panel set 2083" || fail "flash: with no panel files the brightness goes back by Hyprland's word" (( took < 1500 )) || fail "flash: with no panel files Hyprland's word ends the wait at once, not at the bound ($took ms)" # A connector that is not connected (a second, unused one) says Off and must not end the wait. panel_on; mkdir -p "$t/sys/class/drm/card0-DSI-2"; echo Off >"$t/sys/class/drm/card0-DSI-2/dpms"; echo disconnected >"$t/sys/class/drm/card0-DSI-2/status"; : >"$t/async-off" -reset; keys power-down; keys power-up; sleep 1 +reset; keys power-down; keys power-up; logged "brightnessctl -q -d panel set 2083" || fail "flash: with an unconnected connector the brightness still goes back" before "panel-off" "brightnessctl -q -d panel set 2083" || fail "flash: an unconnected connector's Off does not end the wait" rm -rf "$t/sys/class/drm/card0-DSI-2"; panel_on cp "$t"/orig/omarchy-hw-display "$t"/orig/brightnessctl "$t"/orig/omarchy-brightness-display "$t/bin/" From 4007450ac1f5e5a15a46904cc3eb1036afffac1e Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 18 Nov 2026 10:37:23 -0500 Subject: [PATCH 2/2] omamobile-shell: keys test: the no-panel-files case waits out its stand-in again The previous commit turned this case's fixed 1 s sleep into a wait for the brightness line, which Hyprland's word produces at once. The stand-in's delayed half (0.4 s) was then still pending when the next case put the fake panel files back, and it turned that new panel off: with the power key as Android's, "locked and lit: a press turns the screen off" then saw a dark panel and woke it instead (CI run 44333336393). The sleep is back, before the check. Co-Authored-By: Claude Fable 5.2 --- packages/omamobile-shell/test/keys.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/omamobile-shell/test/keys.sh b/packages/omamobile-shell/test/keys.sh index fbc92c8b6..423812c37 100755 --- a/packages/omamobile-shell/test/keys.sh +++ b/packages/omamobile-shell/test/keys.sh @@ -160,6 +160,10 @@ grep -q "brightnessctl -q -d panel set 2083" "$log" || fail "flash: with a panel rm -rf "$t/sys/class/drm/card0-DSI-1" "$t/sys/class/backlight/panel"; : >"$t/async-off" reset; start=$(date +%s%N); keys power-down; keys power-up took=$(( ($(date +%s%N) - start) / 1000000 )) +# The stand-in's delayed half still runs here (its writes fail, the files are +# gone): give it its 0.4 s before the next case puts the panel files back, or +# it turns that new panel off behind the test's back. +sleep 1 logged "brightnessctl -q -d panel set 2083" || fail "flash: with no panel files the brightness goes back by Hyprland's word" (( took < 1500 )) || fail "flash: with no panel files Hyprland's word ends the wait at once, not at the bound ($took ms)" # A connector that is not connected (a second, unused one) says Off and must not end the wait.