wake-alarm/scripts/vmbox/guest_cases_monitors.sh
Krzysztof kuhy Rudnicki cf0d243ffd Count a paused alarm as a bypass
The launcher "Wstrzymaj aplikację" paused WakeAlarm mid-ring on 11-20 and
11-22. WakeAlarm is now a device admin, and a pause, admin removal,
revoked notifications or full-screen intent, or a killed ring on a live
morning is a bypass: a miss on any weekday, the phone rings again, and
the PC rings at once until a newer dismiss or 30 min.

The PC rings also go to every connected monitor, since the speakers are
off at the knob overnight; a one-shot silent probe checks them at A-5.

DOCS-bypass.md has the layers, causes and measurements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:49:44 +01:00

49 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# wake_alarm vmbox harness — the monitors ring too (2026-11-22). Two fake
# monitors on snd-dummy's extra PCM devices (WAKE_ALARM_MONITORS stands in
# for the ELD names `aplay -l` reads on the PC): each must log its own
# `ring_sink ... result=ok`, a dead one must log an error without stopping
# the others, and --probe must pass on silence. Sourced by guest_cases_v2.sh.
# ============================================================================
# snd-dummy with three PCM devices: 0 = speakers, 1 and 2 = the monitors.
monitors_card() {
sudo modprobe -r snd-dummy >/dev/null 2>&1 || true
sudo modprobe snd-dummy pcm_devs=3
sudo udevadm settle
}
case_ring_monitor_sinks() {
local name="ring-alsa-monitor-sinks" out
monitors_card
out="$(sudo WAKE_ALARM_CARD=Dummy WAKE_ALARM_USER="$USER" \
WAKE_ALARM_MONITORS="Dummy:1:MonA:0 Dummy:2:MonB:1 Nope:0:Dead:2" \
timeout 5 "$RING_SCRIPT" "$RING_WAV_DIR/ring.wav" "$RING_WAV_DIR/ring_loop.wav" 2>&1)" || true
if grep -q "ring_sink sink=MonA device=Dummy,1 result=ok" <<<"$out" &&
grep -q "ring_sink sink=MonB device=Dummy,2 result=ok" <<<"$out" &&
grep -q "ring_sink sink=Dead device=Nope,0 result=error" <<<"$out"; then
pass "$name"
else
fail "$name" "ring_sink lines: $(grep ring_sink <<<"$out" | tr '\n' '|')"
fi
}
case_ring_monitor_probe() {
local name="ring-alsa-monitor-probe" out rc=0
monitors_card
out="$(sudo WAKE_ALARM_MONITORS="Dummy:1:MonA:0 Dummy:2:MonB:1" \
"$RING_SCRIPT" --probe 2>&1)" || rc=$?
if [[ $rc -eq 0 ]] && [[ "$(grep -c 'ring_probe .*result=ok' <<<"$out")" -eq 2 ]]; then
pass "$name"
else
fail "$name" "rc=$rc: $(tr '\n' '|' <<<"$out")"
fi
}
run_monitor_cases() {
case_ring_monitor_sinks
case_ring_monitor_probe
}