Trigger the screenlock daemon on idle screen blanking
This commit is contained in:
1 parent
77d95c715c
commit
5d859d7b11
11 files changed
+382
-12
No files matched your search
@@ -57,7 +57,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7`
|
|||||||
- `./scripts/prune-rootfs-packages.sh <rootfs-dir> world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container.
|
- `./scripts/prune-rootfs-packages.sh <rootfs-dir> world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container.
|
||||||
- `./scripts/build-bananarchy-daemons.sh` — cross-builds the three compiled ARM idle daemons (`bananarchy-lid`, `bananarchy-cover-idle`, `bananarchy-volume-keys`) from `src/bananarchy-daemons/`; `--check` validates the ARM ELF artifacts and overlay sync. No Python-based daemon runs in the idle system.
|
- `./scripts/build-bananarchy-daemons.sh` — cross-builds the three compiled ARM idle daemons (`bananarchy-lid`, `bananarchy-cover-idle`, `bananarchy-volume-keys`) from `src/bananarchy-daemons/`; `--check` validates the ARM ELF artifacts and overlay sync. No Python-based daemon runs in the idle system.
|
||||||
- `./scripts/build-lk2nd-beatles.sh` — cross-builds all three beatles lk2nd images (normal, diagnostic and display; the display image is the flasher default) from the pinned upstream lk2nd commit plus `bootloader/lk2nd/nokia-beatles.patch` in rootless Docker (`--check` validates all three shipped images, `--only normal|diagnostic|display` builds one, `--force-panel-init` forces the panel replay, `--with-display` enables SPI display during boot). Offline validators: `scripts/check-lk2nd-beatles.py` and `scripts/test-lk2nd-beatles-port.py`.
|
- `./scripts/build-lk2nd-beatles.sh` — cross-builds all three beatles lk2nd images (normal, diagnostic and display; the display image is the flasher default) from the pinned upstream lk2nd commit plus `bootloader/lk2nd/nokia-beatles.patch` in rootless Docker (`--check` validates all three shipped images, `--only normal|diagnostic|display` builds one, `--force-panel-init` forces the panel replay, `--with-display` enables SPI display during boot). Offline validators: `scripts/check-lk2nd-beatles.py` and `scripts/test-lk2nd-beatles-port.py`.
|
||||||
- `./scripts/test-webarchy-renderer.py` — host unit test for Webarchy's device-aware WebKit renderer profile (also run by `check-rebuild.sh`).
|
- `./scripts/test-webarchy-renderer.py` and `./scripts/test-idle-blank-lock.py` — host unit/integration tests for the Webarchy renderer profile and the idle-blank screenlock wiring (both also run by `check-rebuild.sh`).
|
||||||
- `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, SMS long-message rendering guard, ignored local agent config, Docker, version helper).
|
- `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, SMS long-message rendering guard, ignored local agent config, Docker, version helper).
|
||||||
- `./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift.
|
- `./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift.
|
||||||
- `./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`.
|
- `./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`.
|
||||||
@@ -73,7 +73,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7`
|
|||||||
- **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`.
|
- **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`.
|
||||||
- **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`.
|
- **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`.
|
||||||
- **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this.
|
- **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this.
|
||||||
- **Power management**: idle blanking is `dwm`'s native evdev timer (`src/sxmo-dwm/dwm.c`) plus `bananarchy-idle-blank.sh`; the timeout lives in `~/.config/sxmo/idle_blank_timeout` (default 300 s, `0` = off), is edited via **Config -> Screen blank** / `bananarchy-idle-timeout.sh`, and is reloaded on `SIGUSR1`. `~/.cache/sxmo/sxmo.noidle` and `SXMO_UNLOCK_IDLE_TIME` still override it. `bananarchy-screen-wake.sh` (called from the ring and notification hooks) wakes the panel for calls/SMS and resets the timer; locking or closing the lid blanks immediately. Runtime power policy: `/etc/bananarchy-power-policy.conf` +
|
- **Power management**: idle blanking is `dwm`'s native evdev timer (`src/sxmo-dwm/dwm.c`) plus `bananarchy-idle-blank.sh`; the timeout lives in `~/.config/sxmo/idle_blank_timeout` (default 300 s, `0` = off), is edited via **Config -> Screen blank** / `bananarchy-idle-timeout.sh`, and is reloaded on `SIGUSR1`. `~/.cache/sxmo/sxmo.noidle` and `SXMO_UNLOCK_IDLE_TIME` still override it. `bananarchy-screen-wake.sh` (called from the ring and notification hooks) wakes the panel for calls/SMS and resets the timer; locking or closing the lid blanks immediately. A blank also arms `bananarchy-idle-lock.sh`: after `~/.config/sxmo/idle_lock_delay` seconds of dark panel (default 30, `0` = immediate, `off` = disabled) it runs the trusted `sxmo_state.sh set screenoff` so `locker.so` receives `LOCK_BLANK`; every wake path cancels the pending lock. Runtime power policy: `/etc/bananarchy-power-policy.conf` +
|
||||||
`/usr/bin/bananarchy-power-policy.sh` (OpenRC default runlevel, `doas` rule)
|
`/usr/bin/bananarchy-power-policy.sh` (OpenRC default runlevel, `doas` rule)
|
||||||
drive `WIFI_LISTEN_INTERVAL` (wcn36xx module option), `MODEM_DRX_MODE`
|
drive `WIFI_LISTEN_INTERVAL` (wcn36xx module option), `MODEM_DRX_MODE`
|
||||||
(`AT$QCDRX`) and `DSDS_SECONDARY_MODE=eco` (QMI secondary GW provisioning
|
(`AT$QCDRX`) and `DSDS_SECONDARY_MODE=eco` (QMI secondary GW provisioning
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
|||||||
|
|
||||||
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
|
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
|
||||||
|
|
||||||
|
### Screenlock daemon on idle blank
|
||||||
|
|
||||||
|
- **Screenlock never triggered on blank**: dwm's native idle blanking called `bananarchy-idle-blank.sh off`, which only powered the panel down through `sxmo_wm.sh display off`. It never entered the Sxmo state machine, and the session no longer starts an `idle_locker` job, so `locker.so` received no `LOCK_BLANK` and the phone stayed unlocked after blanking. `bananarchy-idle-lock.sh` now arms a trusted `sxmo_state.sh set screenoff` transition after 30 seconds of dark panel (`xlocker screenoff` -> `LOCK_BLANK`), configurable with `bananarchy-idle-lock.sh get|label|set <seconds|off>` (`~/.config/sxmo/idle_lock_delay`; `0` locks immediately, `off` restores blank-without-passcode). `bananarchy-idle-blank.sh off/on`, `bananarchy-screen-wake.sh` and `sxmo_hook_unlock.sh` cancel the pending lock on every wake, and the transition is skipped if the panel is already back on, so a quick key press still returns to the unlocked desktop on `nokia-argon` as well as the 2720 Flip. `scripts/test-idle-blank-lock.py` exercises arming, cancellation and both wake paths against stubbed Sxmo commands, and `check-rebuild.sh` guards the wiring.
|
||||||
|
|
||||||
### Webarchy WebKit renderer
|
### Webarchy WebKit renderer
|
||||||
|
|
||||||
- **Unexpected WebKit error on the 2720 Flip**: `webarchy.so` used `setenv(..., "0")` for the WebKitGTK presence flags `WEBKIT_DISABLE_COMPOSITING_MODE`, `WEBKIT_DISABLE_DMABUF_RENDERER` and `WEBKIT_SKIA_ENABLE_CPU_RENDERING` while still requesting `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`. WebKitGTK treats the presence of those variables as "disable", so the WebProcess started with conflicting renderer state and died on every navigation, which WebKit reported as an "Unexpected WebKit error". `configureWebkitRenderer()` now unsets all three flags first, enables the CPU renderer only where required, and chooses `WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER` on `nokia,beatles` (and after the first WebProcess crash) while `nokia-argon` keeps `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL. Create `~/.config/sxmo/webarchy_software_renderer` to force the software profile on any target. Load failures now report the GError domain/code in the browser status line instead of an opaque message. `scripts/check-rebuild.sh` guards the profile and the rebuilt `webarchy.so`.
|
- **Unexpected WebKit error on the 2720 Flip**: `webarchy.so` used `setenv(..., "0")` for the WebKitGTK presence flags `WEBKIT_DISABLE_COMPOSITING_MODE`, `WEBKIT_DISABLE_DMABUF_RENDERER` and `WEBKIT_SKIA_ENABLE_CPU_RENDERING` while still requesting `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`. WebKitGTK treats the presence of those variables as "disable", so the WebProcess started with conflicting renderer state and died on every navigation, which WebKit reported as an "Unexpected WebKit error". `configureWebkitRenderer()` now unsets all three flags first, enables the CPU renderer only where required, and chooses `WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER` on `nokia,beatles` (and after the first WebProcess crash) while `nokia-argon` keeps `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL. Create `~/.config/sxmo/webarchy_software_renderer` to force the software profile on any target. Load failures now report the GError domain/code in the browser status line instead of an opaque message. `scripts/check-rebuild.sh` guards the profile and the rebuilt `webarchy.so`.
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ sudo dd if=./images/bananarchy-nokia-argon.img of=/dev/sdX bs=4M status=progress
|
|||||||
| **Slider close / open** | `SW_LID` (`lid:on` / `lid:off`) | **Close**: close open menu, turn off keypad backlight, and lock phone with passcode (`xlocker`); **Open**: restore screen and keypad backlight and show passcode lock screen |
|
| **Slider close / open** | `SW_LID` (`lid:on` / `lid:off`) | **Close**: close open menu, turn off keypad backlight, and lock phone with passcode (`xlocker`); **Open**: restore screen and keypad backlight and show passcode lock screen |
|
||||||
|
|
||||||
> **Screen blanking, idle blanking, deep standby, passcode locking (`xlocker`), waking, and brightness persistence**:
|
> **Screen blanking, idle blanking, deep standby, passcode locking (`xlocker`), waking, and brightness persistence**:
|
||||||
> While unlocked (and with the lid open), the display blanks automatically after the configured **Screen blank** timeout — **5 minutes by default** — via `dwm`'s own evdev input timer and `bananarchy-idle-blank.sh`. Change it in **Config -> Screen blank** (`Off`, 30 s, 1/5/10/30 min), which writes `~/.config/sxmo/idle_blank_timeout`; `bananarchy-idle-timeout.sh get|label|set <seconds>` does the same from the shell, and `SXMO_UNLOCK_IDLE_TIME` or `~/.cache/sxmo/sxmo.noidle` still override/disable it. Closing the slider/lid or locking from the **Power** menu blanks the panel **immediately** (both `Lock` and `Lock (Screen off)` now use `xlocker screenoff`), and an incoming call or SMS/notification turns it back on **immediately** via `bananarchy-screen-wake.sh`, which also resets `dwm`'s idle timer so it cannot blank again right away. Any keypad, lid or power key also restores the display without engaging the passcode locker. X11 screensaver timeouts stay at `0 0 0`; DPMS is driven by the backlight state. Optional **deep standby** is currently **unavailable**: the shipped kernel keeps the pmaports module ABI and has no sleep states in `/sys/power/state`. It stays disabled via `/etc/bananarchy-no-deep-standby`. Even a full custom kernel module tree would not help here: this firmware has no PSCI `SYSTEM_SUSPEND`, so only s2idle (`freeze`) would be possible, without DDR self-refresh, and the saving would be under 1 mA (see `BATTERY-OPTIMIZATION-ANALYSIS.md`). Active calls, SSH sessions and VPN/tether connections would block suspension. Locking the phone (`Power -> Lock`, `Power -> Lock (Screen off)`, `2x End / Power`, or closing the physical slider) activates the fullscreen `240x320` **Passcode Locker (`xlocker` / `locker.so`)**, which verifies your numeric system password (`147147` by default, checked against `/etc/shadow` via `/usr/bin/bananarchy-verify-passcode`). While locked, there is no keypad, softkey, slider, or power-button bypass (`dmenu`, `xdrawer`, terminal spawning, and desktop shortcuts are blocked, and only incoming calls can temporarily overlay `xcallscreen`). Screen and keypad brightness levels configured in **XDrawer** or **Config -> Brightness** are persisted in `~/.config/sxmo/brightness` and `/tmp/sxmo_saved_brightness` and restored on every wake.
|
> While unlocked (and with the lid open), the display blanks automatically after the configured **Screen blank** timeout — **5 minutes by default** — via `dwm`'s own evdev input timer and `bananarchy-idle-blank.sh`. Change it in **Config -> Screen blank** (`Off`, 30 s, 1/5/10/30 min), which writes `~/.config/sxmo/idle_blank_timeout`; `bananarchy-idle-timeout.sh get|label|set <seconds>` does the same from the shell, and `SXMO_UNLOCK_IDLE_TIME` or `~/.cache/sxmo/sxmo.noidle` still override/disable it. Closing the slider/lid or locking from the **Power** menu blanks the panel **immediately** (both `Lock` and `Lock (Screen off)` now use `xlocker screenoff`), and an incoming call or SMS/notification turns it back on **immediately** via `bananarchy-screen-wake.sh`, which also resets `dwm`'s idle timer so it cannot blank again right away. Any keypad, lid or power key also restores the display; if it arrives before the idle-lock delay elapses, the desktop stays unlocked. Blanking now arms the screenlock daemon: `bananarchy-idle-blank.sh` calls `bananarchy-idle-lock.sh arm`, which starts the trusted `sxmo_state.sh set screenoff` transition (`xlocker screenoff` -> `LOCK_BLANK` on `locker.so`) after **30 seconds** of dark panel by default. Set `~/.config/sxmo/idle_lock_delay` with `bananarchy-idle-lock.sh set 0` to lock immediately on blank, any other number of seconds to change the grace period, or `set off` to keep the old blank-without-passcode behaviour. `bananarchy-idle-lock.sh get|label|cancel` reports and cancels the pending lock; `bananarchy-screen-wake.sh`, `bananarchy-idle-blank.sh on` and `sxmo_hook_unlock.sh` cancel it on every wake, and the transition only fires while the panel is still dark. X11 screensaver timeouts stay at `0 0 0`; DPMS is driven by the backlight state. Optional **deep standby** is currently **unavailable**: the shipped kernel keeps the pmaports module ABI and has no sleep states in `/sys/power/state`. It stays disabled via `/etc/bananarchy-no-deep-standby`. Even a full custom kernel module tree would not help here: this firmware has no PSCI `SYSTEM_SUSPEND`, so only s2idle (`freeze`) would be possible, without DDR self-refresh, and the saving would be under 1 mA (see `BATTERY-OPTIMIZATION-ANALYSIS.md`). Active calls, SSH sessions and VPN/tether connections would block suspension. Locking the phone (`Power -> Lock`, `Power -> Lock (Screen off)`, `2x End / Power`, or closing the physical slider) activates the fullscreen `240x320` **Passcode Locker (`xlocker` / `locker.so`)**, which verifies your numeric system password (`147147` by default, checked against `/etc/shadow` via `/usr/bin/bananarchy-verify-passcode`). While locked, there is no keypad, softkey, slider, or power-button bypass (`dmenu`, `xdrawer`, terminal spawning, and desktop shortcuts are blocked, and only incoming calls can temporarily overlay `xcallscreen`). Screen and keypad brightness levels configured in **XDrawer** or **Config -> Brightness** are persisted in `~/.config/sxmo/brightness` and `/tmp/sxmo_saved_brightness` and restored on every wake.
|
||||||
|
|
||||||
|
|
||||||
> **Runtime power policy (`/etc/bananarchy-power-policy.conf`)**:
|
> **Runtime power policy (`/etc/bananarchy-power-policy.conf`)**:
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 26 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 26 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
||||||
- **System and context menus (`dmenu`)**: instant full-screen 10-line vertical menus with live T9 filtering, built-in submenus, and hardware toggles.
|
- **System and context menus (`dmenu`)**: instant full-screen 10-line vertical menus with live T9 filtering, built-in submenus, and hardware toggles.
|
||||||
- **Passcode-based fullscreen phone locker (`xlocker`), GUI passcode configurator (`xpasscode`), and Duress Mode**: zero-bypass `240x320` fullscreen numeric passcode lock screen verified against the current user's system shadow password (`/usr/bin/bananarchy-verify-passcode`), blocking all desktop, menu, drawer, terminal, and power actions while locked and automatically handing off the display only during incoming calls. Includes a NeoUI **Passcode Configurator (`xpasscode` / `passcode.so`)** in `Config -> Passcode` to change the real Linux user password (`user`, any numeric length `>= 4` digits) and configure a separate **Duress Passcode**. Entering the duress passcode on the lock screen switches the session into **Duress Mode** (`/tmp/duress_home` blank profile with no contacts, SMS, call logs, or personal files, microSD unmounted and disabled, `xfiles` clamped to the profile directory, Passcode/Privacy Center/Tox/IRC/SIP/`st` terminal hidden and blocked, `*#06#` displaying a session-persistent random Luhn-valid IMEI derived from the device's TAC, and theme/wallpaper locked to `NordFrost.xth` and `nordic-peaks.png` until poweroff or reboot).
|
- **Passcode-based fullscreen phone locker (`xlocker`), GUI passcode configurator (`xpasscode`), and Duress Mode**: zero-bypass `240x320` fullscreen numeric passcode lock screen verified against the current user's system shadow password (`/usr/bin/bananarchy-verify-passcode`), blocking all desktop, menu, drawer, terminal, and power actions while locked and automatically handing off the display only during incoming calls. Includes a NeoUI **Passcode Configurator (`xpasscode` / `passcode.so`)** in `Config -> Passcode` to change the real Linux user password (`user`, any numeric length `>= 4` digits) and configure a separate **Duress Passcode**. Entering the duress passcode on the lock screen switches the session into **Duress Mode** (`/tmp/duress_home` blank profile with no contacts, SMS, call logs, or personal files, microSD unmounted and disabled, `xfiles` clamped to the profile directory, Passcode/Privacy Center/Tox/IRC/SIP/`st` terminal hidden and blocked, `*#06#` displaying a session-persistent random Luhn-valid IMEI derived from the device's TAC, and theme/wallpaper locked to `NordFrost.xth` and `nordic-peaks.png` until poweroff or reboot).
|
||||||
|
- **Idle screen lock**: after the configurable **Screen blank** timeout, `bananarchy-idle-blank.sh` arms `bananarchy-idle-lock.sh`, which triggers `xlocker screenoff` after a 30 s dark-panel grace period (set `~/.config/sxmo/idle_lock_delay` to `0` for immediate locking or `off` to blank without a passcode). Waking the panel cancels the pending lock, so a quick key press returns to the unlocked desktop.
|
||||||
- **Privacy Center (`xprivacy` / `privacy` / `privacy.so`) and `/usr/bin/bananarchy-privacy-ctl`**: 5-tab NeoUI privacy and tunneling control center (`1:Tor`, `2:Warp`, `3:OVPN`, `4:GS`, `5:WG`, hidden and disabled in Duress Mode) with zero background CPU or battery consumption when services are turned off:
|
- **Privacy Center (`xprivacy` / `privacy` / `privacy.so`) and `/usr/bin/bananarchy-privacy-ctl`**: 5-tab NeoUI privacy and tunneling control center (`1:Tor`, `2:Warp`, `3:OVPN`, `4:GS`, `5:WG`, hidden and disabled in Duress Mode) with zero background CPU or battery consumption when services are turned off:
|
||||||
- **Tor (`1:Tor`)**: start/stop the Tor anonymity daemon (`SocksPort 9050`, `TransPort 9040`, `DNSPort 9053`) and transparently route all native phone traffic and/or Wi-Fi hotspot (`10.42.0.0/24`) and USB-tethered (`usb0`) traffic through Tor.
|
- **Tor (`1:Tor`)**: start/stop the Tor anonymity daemon (`SocksPort 9050`, `TransPort 9040`, `DNSPort 9053`) and transparently route all native phone traffic and/or Wi-Fi hotspot (`10.42.0.0/24`) and USB-tethered (`usb0`) traffic through Tor.
|
||||||
- **GS-Warp (`2:Warp`)**: start/stop the GSocket-tunneled OpenVPN client (`gs-warp` / `gs-warp-simple.sh` over `tun_gswarp`), configure a custom GSocket secret string (defaulting to the MD5 of the selected `.ovpn` profile), and route native and/or Wi-Fi/USB-tethered traffic through it.
|
- **GS-Warp (`2:Warp`)**: start/stop the GSocket-tunneled OpenVPN client (`gs-warp` / `gs-warp-simple.sh` over `tun_gswarp`), configure a custom GSocket secret string (defaulting to the MD5 of the selected `.ovpn` profile), and route native and/or Wi-Fi/USB-tethered traffic through it.
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Blank/restore the display without engaging the passcode locker (U1).
|
# Blank/restore the display and arm the screenlock daemon (U1).
|
||||||
# sxmo_wm.sh display off/on already handles brightness, bl_power, DPMS,
|
# sxmo_wm.sh display off/on handles brightness, bl_power, DPMS, the CPU
|
||||||
# the CPU governor and the keyboard backlight.
|
# governor and the keyboard backlight. bananarchy-idle-lock.sh then arms the
|
||||||
|
# trusted screenoff transition that starts xlocker screenoff (LOCK_BLANK on
|
||||||
|
# locker.so); without it the resident locker daemon never sees a blank event.
|
||||||
#
|
#
|
||||||
# A wake-grace guard makes this safe even on the legacy sxmo_idle.sh path:
|
# A wake-grace guard makes this safe even on the legacy sxmo_idle.sh path:
|
||||||
# xprintidle can report a stale large idle value right after a wake, which
|
# xprintidle can report a stale large idle value right after a wake, which
|
||||||
# used to fire the blank command again immediately.
|
# used to fire the blank command again immediately.
|
||||||
WAKE_TS=/tmp/bananarchy_last_wake
|
WAKE_TS="${BANANARCHY_WAKE_TS:-/tmp/bananarchy_last_wake}"
|
||||||
GRACE="${BANANARCHY_IDLE_BLANK_GRACE:-10}"
|
GRACE="${BANANARCHY_IDLE_BLANK_GRACE:-10}"
|
||||||
|
LOCK_HELPER="${BANANARCHY_IDLE_LOCK_HELPER:-/usr/bin/bananarchy-idle-lock.sh}"
|
||||||
|
WM_CMD="${BANANARCHY_WM_CMD:-/usr/bin/sxmo_wm.sh}"
|
||||||
|
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
off)
|
off)
|
||||||
@@ -18,14 +22,22 @@ case "${1:-}" in
|
|||||||
if [ $((now - last)) -lt "$GRACE" ]; then
|
if [ $((now - last)) -lt "$GRACE" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
exec /usr/bin/sxmo_wm.sh display off
|
"$WM_CMD" display off >/dev/null 2>&1 || true
|
||||||
|
"$LOCK_HELPER" arm >/dev/null 2>&1 || true
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
on)
|
on)
|
||||||
|
"$LOCK_HELPER" cancel >/dev/null 2>&1 || true
|
||||||
date +%s > "$WAKE_TS" 2>/dev/null || true
|
date +%s > "$WAKE_TS" 2>/dev/null || true
|
||||||
exec /usr/bin/sxmo_wm.sh display on
|
exec "$WM_CMD" display on
|
||||||
|
;;
|
||||||
|
cancel)
|
||||||
|
# Called by the wake paths before they power the panel back on.
|
||||||
|
"$LOCK_HELPER" cancel >/dev/null 2>&1 || true
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf 'Usage: %s [off|on]\n' "${0##*/}" >&2
|
printf 'Usage: %s [off|on|cancel]\n' "${0##*/}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
+119
@@ -0,0 +1,119 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Arm the screenlock daemon when dwm blanks the panel on idle.
|
||||||
|
#
|
||||||
|
# dwm's native idle blanking (bananarchy-idle-blank.sh off) only powers the
|
||||||
|
# panel down: it does not call sxmo_state.sh / sxmo_hook_screenoff.sh and no
|
||||||
|
# idle_locker job is started by the session any more. As a result locker.so
|
||||||
|
# never receives LOCK_BLANK on a blank event and the phone stays unlocked.
|
||||||
|
# This helper arms a trusted "sxmo_state.sh set screenoff" (which starts
|
||||||
|
# xlocker screenoff -> LOCK_BLANK) after a short dark-panel delay. Waking the
|
||||||
|
# panel before the deadline cancels the pending lock, so a quick key press
|
||||||
|
# still returns to the unlocked desktop on every target.
|
||||||
|
#
|
||||||
|
# Config: ~/.config/sxmo/idle_lock_delay (seconds, "off" disables, 0 locks
|
||||||
|
# immediately when the panel blanks). Default 30 s.
|
||||||
|
set -u
|
||||||
|
|
||||||
|
CFGDIR="${XDG_CONFIG_HOME:-${HOME:-/home/user}/.config}/sxmo"
|
||||||
|
CFG="$CFGDIR/idle_lock_delay"
|
||||||
|
PIDFILE="${BANANARCHY_IDLE_LOCK_PIDFILE:-/tmp/bananarchy_idle_lock.pid}"
|
||||||
|
DEFAULT=30
|
||||||
|
MAX_DELAY=3600
|
||||||
|
LOCK_FLAG="${BANANARCHY_LOCK_FLAG:-/tmp/bananarchy_screen_locked}"
|
||||||
|
STATE_CMD="${BANANARCHY_STATE_CMD:-/usr/bin/sxmo_state.sh}"
|
||||||
|
WM_CMD="${BANANARCHY_WM_CMD:-/usr/bin/sxmo_wm.sh}"
|
||||||
|
|
||||||
|
get_delay() {
|
||||||
|
v="$DEFAULT"
|
||||||
|
if [ -r "$CFG" ]; then
|
||||||
|
read -r v < "$CFG" 2>/dev/null || v="$DEFAULT"
|
||||||
|
fi
|
||||||
|
case "$v" in
|
||||||
|
off|OFF|no|NO|none|NONE) printf 'off\n'; return 0 ;;
|
||||||
|
esac
|
||||||
|
case "$v" in ''|*[!0-9]*) v="$DEFAULT" ;; esac
|
||||||
|
[ "$v" -le "$MAX_DELAY" ] || v="$MAX_DELAY"
|
||||||
|
printf '%s\n' "$v"
|
||||||
|
}
|
||||||
|
|
||||||
|
label() {
|
||||||
|
v="$(get_delay)"
|
||||||
|
case "$v" in
|
||||||
|
off) printf 'Off\n' ;;
|
||||||
|
0) printf 'Immediately\n' ;;
|
||||||
|
*) printf '%ss\n' "$v" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
panel_is_dark() {
|
||||||
|
st="$("$WM_CMD" display 2>/dev/null || true)"
|
||||||
|
[ "$st" = "off" ] && return 0
|
||||||
|
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||||
|
_bl=1
|
||||||
|
read -r _bl < /sys/class/backlight/backlight/brightness 2>/dev/null || _bl=1
|
||||||
|
[ "${_bl:-1}" -le 0 ] 2>/dev/null && return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
[ -r "$PIDFILE" ] || return 0
|
||||||
|
pid=""
|
||||||
|
read -r pid < "$PIDFILE" 2>/dev/null || pid=""
|
||||||
|
case "$pid" in
|
||||||
|
''|*[!0-9]*) ;;
|
||||||
|
*) kill "$pid" 2>/dev/null || true ;;
|
||||||
|
esac
|
||||||
|
rm -f "$PIDFILE" 2>/dev/null || true
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
lock_panel() {
|
||||||
|
[ -f "$LOCK_FLAG" ] && return 0
|
||||||
|
panel_is_dark || return 0
|
||||||
|
"$STATE_CMD" set screenoff >/dev/null 2>&1 || true
|
||||||
|
}
|
||||||
|
|
||||||
|
arm() {
|
||||||
|
cancel
|
||||||
|
d="$(get_delay)"
|
||||||
|
[ "$d" = "off" ] && return 0
|
||||||
|
if [ "$d" -eq 0 ]; then
|
||||||
|
lock_panel
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
(
|
||||||
|
sleep "$d" || exit 0
|
||||||
|
lock_panel
|
||||||
|
) >/dev/null 2>&1 &
|
||||||
|
printf '%s\n' "$!" > "$PIDFILE" 2>/dev/null || true
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1:-get}" in
|
||||||
|
get) get_delay ;;
|
||||||
|
label) label ;;
|
||||||
|
set)
|
||||||
|
v="${2:-}"
|
||||||
|
case "$v" in
|
||||||
|
off|OFF|no|NO|none|NONE) v=off ;;
|
||||||
|
''|*[!0-9]*)
|
||||||
|
printf 'Usage: %s [get|label|set <seconds|off>|arm|cancel]\n' "${0##*/}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case "$v" in off) ;; *)
|
||||||
|
[ "$v" -le "$MAX_DELAY" ] || v="$MAX_DELAY"
|
||||||
|
;; esac
|
||||||
|
mkdir -p "$CFGDIR" 2>/dev/null || exit 1
|
||||||
|
printf '%s\n' "$v" > "$CFG" || exit 1
|
||||||
|
printf '%s\n' "$v"
|
||||||
|
;;
|
||||||
|
arm) arm ;;
|
||||||
|
cancel) cancel ;;
|
||||||
|
*)
|
||||||
|
printf 'Usage: %s [get|label|set <seconds|off>|arm|cancel]\n' "${0##*/}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
@@ -2,7 +2,10 @@
|
|||||||
# Wake the screen for an external event (incoming call / SMS / notification)
|
# Wake the screen for an external event (incoming call / SMS / notification)
|
||||||
# and reset dwm's idle-blank timer so it cannot blank again immediately.
|
# and reset dwm's idle-blank timer so it cannot blank again immediately.
|
||||||
export DISPLAY="${DISPLAY:-:0}"
|
export DISPLAY="${DISPLAY:-:0}"
|
||||||
/usr/bin/sxmo_wm.sh display on >/dev/null 2>&1 || true
|
# Cancel a pending idle-blank lock before the panel is powered on, so a wake
|
||||||
|
# does not race with the screenoff transition started by the blank handler.
|
||||||
|
"${BANANARCHY_IDLE_LOCK_HELPER:-/usr/bin/bananarchy-idle-lock.sh}" cancel >/dev/null 2>&1 || true
|
||||||
|
"${BANANARCHY_WM_CMD:-/usr/bin/sxmo_wm.sh}" display on >/dev/null 2>&1 || true
|
||||||
date +%s > /tmp/bananarchy_last_wake 2>/dev/null || true
|
date +%s > /tmp/bananarchy_last_wake 2>/dev/null || true
|
||||||
p="$(pidof -s dwm 2>/dev/null || true)"
|
p="$(pidof -s dwm 2>/dev/null || true)"
|
||||||
[ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true
|
[ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true
|
||||||
|
|||||||
@@ -41,5 +41,8 @@ fi
|
|||||||
# evdev handling and turned the screen back off immediately after a wake.
|
# evdev handling and turned the screen back off immediately after a wake.
|
||||||
# Create ~/.cache/sxmo/sxmo.noidle to disable it entirely.
|
# Create ~/.cache/sxmo/sxmo.noidle to disable it entirely.
|
||||||
sxmo_jobs.sh stop idle_locker 2>/dev/null || true
|
sxmo_jobs.sh stop idle_locker 2>/dev/null || true
|
||||||
|
# The idle-blank path arms a delayed trusted screenoff transition; a real
|
||||||
|
# unlock must cancel it or locker.so would re-lock the freshly woken panel.
|
||||||
|
/usr/bin/bananarchy-idle-lock.sh cancel >/dev/null 2>&1 || true
|
||||||
|
|
||||||
wait
|
wait
|
||||||
@@ -171,7 +171,12 @@ chown 0:0 "$TARGET_ROOTFS/etc/chrony/chrony.conf" \
|
|||||||
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
"$TARGET_ROOTFS/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" \
|
||||||
2>/dev/null || true
|
2>/dev/null || true
|
||||||
chmod 0644 "$TARGET_ROOTFS/etc/chrony/chrony.conf" 2>/dev/null || true
|
chmod 0644 "$TARGET_ROOTFS/etc/chrony/chrony.conf" 2>/dev/null || true
|
||||||
chmod 0755 "$TARGET_ROOTFS/usr/bin/bananarchy-time-sync.sh" \
|
# The idle-blank lock helper is spawned directly by dwm's blank handler, so
|
||||||
|
# keep it executable even if the overlay was copied with restrictive modes.
|
||||||
|
chmod 0755 "$TARGET_ROOTFS/usr/bin/bananarchy-idle-blank.sh" \
|
||||||
|
"$TARGET_ROOTFS/usr/bin/bananarchy-idle-lock.sh" \
|
||||||
|
"$TARGET_ROOTFS/usr/bin/bananarchy-screen-wake.sh" \
|
||||||
|
"$TARGET_ROOTFS/usr/bin/bananarchy-time-sync.sh" \
|
||||||
"$TARGET_ROOTFS/usr/bin/bananarchy-sync-net-time.sh" \
|
"$TARGET_ROOTFS/usr/bin/bananarchy-sync-net-time.sh" \
|
||||||
"$TARGET_ROOTFS/usr/bin/bananarchy-network-event.sh" \
|
"$TARGET_ROOTFS/usr/bin/bananarchy-network-event.sh" \
|
||||||
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
"$TARGET_ROOTFS/etc/init.d/bananarchy-time-sync" \
|
||||||
|
|||||||
@@ -1126,6 +1126,38 @@ if command -v g++ >/dev/null 2>&1 && \
|
|||||||
fail "host webarchy renderer profile test failed"
|
fail "host webarchy renderer profile test failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[check] Idle blank screenlock wiring..."
|
||||||
|
IDLE_BLANK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-blank.sh"
|
||||||
|
IDLE_LOCK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-lock.sh"
|
||||||
|
SCREEN_WAKE="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-screen-wake.sh"
|
||||||
|
UNLOCK_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_unlock.sh"
|
||||||
|
for f in "$IDLE_BLANK" "$IDLE_LOCK" "$SCREEN_WAKE" "$UNLOCK_HOOK"; do
|
||||||
|
if [ ! -x "$f" ]; then
|
||||||
|
fail "${f#$BASE_DIR/} is missing or not executable"
|
||||||
|
fi
|
||||||
|
if ! sh -n "$f" 2>/dev/null; then
|
||||||
|
fail "shell syntax: ${f#$BASE_DIR/}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ! grep -q '"$LOCK_HELPER" arm' "$IDLE_BLANK" || \
|
||||||
|
! grep -q 'bananarchy-idle-lock.sh' "$IDLE_BLANK" || \
|
||||||
|
! grep -q 'set screenoff' "$IDLE_LOCK"; then
|
||||||
|
fail "idle blanking no longer arms the trusted screenoff lock"
|
||||||
|
fi
|
||||||
|
for f in "$SCREEN_WAKE" "$UNLOCK_HOOK"; do
|
||||||
|
if ! grep -q 'bananarchy-idle-lock.sh' "$f"; then
|
||||||
|
fail "${f#$BASE_DIR/} no longer cancels a pending idle lock on wake"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ! grep -q 'bananarchy-idle-lock.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then
|
||||||
|
fail "apply-bananarchy-overlay.sh no longer installs the idle lock helper"
|
||||||
|
fi
|
||||||
|
if [ -x "$BASE_DIR/scripts/test-idle-blank-lock.py" ] && \
|
||||||
|
command -v python3 >/dev/null 2>&1 && \
|
||||||
|
! "$BASE_DIR/scripts/test-idle-blank-lock.py" >/dev/null 2>&1; then
|
||||||
|
fail "host idle-blank screenlock integration test failed"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$FAILURES" -ne 0 ]; then
|
if [ "$FAILURES" -ne 0 ]; then
|
||||||
echo "[check] $FAILURES check(s) failed."
|
echo "[check] $FAILURES check(s) failed."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Executable
+191
@@ -0,0 +1,191 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Host integration test for idle-blank -> screenlock daemon wiring.
|
||||||
|
|
||||||
|
Runs the real shell helpers against stubbed sxmo_wm.sh / sxmo_state.sh and a
|
||||||
|
temporary home, so the lock arming, cancellation and wake paths are verified
|
||||||
|
without an X session or a phone.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import time
|
||||||
|
|
||||||
|
BASE = pathlib.Path(__file__).resolve().parent.parent
|
||||||
|
BIN = BASE / "overlay/rootfs/usr/bin"
|
||||||
|
LOCK = BIN / "bananarchy-idle-lock.sh"
|
||||||
|
BLANK = BIN / "bananarchy-idle-blank.sh"
|
||||||
|
WAKE = BIN / "bananarchy-screen-wake.sh"
|
||||||
|
UNLOCK_HOOK = BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_unlock.sh"
|
||||||
|
|
||||||
|
WM_STUB = '''#!/bin/sh
|
||||||
|
if [ "$1" = "display" ]; then
|
||||||
|
case "$2" in
|
||||||
|
off) printf 'off\\n' > "$FAKE_ROOT/display_state" ;;
|
||||||
|
on) printf 'on\\n' > "$FAKE_ROOT/display_state" ;;
|
||||||
|
"") cat "$FAKE_ROOT/display_state" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
'''
|
||||||
|
|
||||||
|
STATE_STUB = '''#!/bin/sh
|
||||||
|
printf '%s\\n' "$*" >> "$FAKE_ROOT/state.log"
|
||||||
|
exit 0
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
def failure(message):
|
||||||
|
sys.stderr.write("FAIL: %s\n" % message)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
for path in (LOCK, BLANK, WAKE, UNLOCK_HOOK):
|
||||||
|
if not path.is_file():
|
||||||
|
return failure("missing %s" % path)
|
||||||
|
if subprocess.run(["sh", "-n", str(LOCK)]).returncode or \
|
||||||
|
subprocess.run(["sh", "-n", str(BLANK)]).returncode or \
|
||||||
|
subprocess.run(["sh", "-n", str(WAKE)]).returncode:
|
||||||
|
return failure("shell syntax")
|
||||||
|
with tempfile.TemporaryDirectory(prefix="bananarchy-idle-lock-") as tmp:
|
||||||
|
root = pathlib.Path(tmp)
|
||||||
|
bindir = root / "bin"
|
||||||
|
home = root / "home"
|
||||||
|
(home / ".config/sxmo").mkdir(parents=True)
|
||||||
|
bindir.mkdir()
|
||||||
|
for name, body in (("sxmo_wm.sh", WM_STUB), ("sxmo_state.sh", STATE_STUB)):
|
||||||
|
target = bindir / name
|
||||||
|
target.write_text(body, encoding="utf-8")
|
||||||
|
target.chmod(0o755)
|
||||||
|
display = root / "display_state"
|
||||||
|
state_log = root / "state.log"
|
||||||
|
lock_flag = root / "locked"
|
||||||
|
cfg = home / ".config/sxmo/idle_lock_delay"
|
||||||
|
env = dict(os.environ)
|
||||||
|
env.update({
|
||||||
|
"HOME": str(home),
|
||||||
|
"XDG_CONFIG_HOME": str(home / ".config"),
|
||||||
|
"FAKE_ROOT": str(root),
|
||||||
|
"BANANARCHY_WM_CMD": str(bindir / "sxmo_wm.sh"),
|
||||||
|
"BANANARCHY_STATE_CMD": str(bindir / "sxmo_state.sh"),
|
||||||
|
"BANANARCHY_IDLE_LOCK_HELPER": str(LOCK),
|
||||||
|
"BANANARCHY_IDLE_LOCK_PIDFILE": str(root / "lock.pid"),
|
||||||
|
"BANANARCHY_LOCK_FLAG": str(lock_flag),
|
||||||
|
"BANANARCHY_WAKE_TS": str(root / "wake.ts"),
|
||||||
|
"BANANARCHY_IDLE_BLANK_GRACE": "0",
|
||||||
|
})
|
||||||
|
|
||||||
|
def run(script, *args):
|
||||||
|
cmd = ["sh", str(script), *args]
|
||||||
|
if os.environ.get("BANANARCHY_TEST_DEBUG"):
|
||||||
|
cmd.insert(1, "-x")
|
||||||
|
res = subprocess.run(cmd, env=env, capture_output=True, text=True)
|
||||||
|
if os.environ.get("BANANARCHY_TEST_DEBUG"):
|
||||||
|
sys.stderr.write("%s %s: %s\n" % (script.name, args, res.stderr[-1200:]))
|
||||||
|
return res
|
||||||
|
|
||||||
|
def log():
|
||||||
|
return state_log.read_text() if state_log.exists() else ""
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
if state_log.exists():
|
||||||
|
state_log.unlink()
|
||||||
|
if lock_flag.exists():
|
||||||
|
lock_flag.unlink()
|
||||||
|
|
||||||
|
def dark(value=True):
|
||||||
|
display.write_text("off\n" if value else "on\n", encoding="utf-8")
|
||||||
|
|
||||||
|
# Defaults and user configuration.
|
||||||
|
dark()
|
||||||
|
if run(LOCK, "get").stdout.strip() != "30":
|
||||||
|
return failure("default lock delay is not 30 s")
|
||||||
|
if run(LOCK, "label").stdout.strip() != "30s":
|
||||||
|
return failure("default lock delay label")
|
||||||
|
if run(LOCK, "set", "off").stdout.strip() != "off" or \
|
||||||
|
run(LOCK, "label").stdout.strip() != "Off":
|
||||||
|
return failure("lock delay cannot be disabled")
|
||||||
|
if run(LOCK, "set", "bogus").returncode == 0:
|
||||||
|
return failure("invalid lock delay accepted")
|
||||||
|
if run(LOCK, "set", "0").stdout.strip() != "0":
|
||||||
|
return failure("immediate lock delay cannot be configured")
|
||||||
|
print("[ok] config: default, off, immediate and invalid values")
|
||||||
|
|
||||||
|
# Immediate arm must call the trusted screenoff transition.
|
||||||
|
clear()
|
||||||
|
run(LOCK, "arm")
|
||||||
|
if "set screenoff" not in log():
|
||||||
|
return failure("immediate arm did not trigger the screenlock daemon")
|
||||||
|
print("[ok] arm: immediate screenoff transition")
|
||||||
|
|
||||||
|
# Delayed arm must fire while the panel is still dark.
|
||||||
|
clear()
|
||||||
|
cfg.write_text("1\n", encoding="utf-8")
|
||||||
|
run(LOCK, "arm")
|
||||||
|
if "set screenoff" in log():
|
||||||
|
return failure("delayed arm locked before the deadline")
|
||||||
|
time.sleep(1.4)
|
||||||
|
if "set screenoff" not in log():
|
||||||
|
return failure("delayed arm did not trigger the screenlock daemon")
|
||||||
|
print("[ok] arm: delayed screenoff transition")
|
||||||
|
|
||||||
|
# Cancel before the deadline must prevent the lock.
|
||||||
|
clear()
|
||||||
|
run(LOCK, "arm")
|
||||||
|
run(LOCK, "cancel")
|
||||||
|
time.sleep(1.4)
|
||||||
|
if log():
|
||||||
|
return failure("cancel did not stop the pending lock")
|
||||||
|
print("[ok] cancel: pending lock stopped")
|
||||||
|
|
||||||
|
# Waking the panel before the deadline must prevent the lock.
|
||||||
|
clear()
|
||||||
|
dark()
|
||||||
|
run(LOCK, "arm")
|
||||||
|
time.sleep(0.2)
|
||||||
|
dark(False)
|
||||||
|
time.sleep(1.3)
|
||||||
|
if log():
|
||||||
|
return failure("lock fired after the panel was already awake")
|
||||||
|
print("[ok] wake: no lock after the panel is on")
|
||||||
|
|
||||||
|
# The blank handler itself must arm (and its inverse must cancel) the lock.
|
||||||
|
clear()
|
||||||
|
cfg.write_text("0\n", encoding="utf-8")
|
||||||
|
dark(False)
|
||||||
|
run(BLANK, "off")
|
||||||
|
if display.read_text().strip() != "off" or "set screenoff" not in log():
|
||||||
|
return failure("bananarchy-idle-blank.sh off did not arm the lock: "
|
||||||
|
"display=%r log=%r" % (display.read_text().strip(), log()))
|
||||||
|
print("[ok] blank: off arms the screenlock daemon")
|
||||||
|
|
||||||
|
clear()
|
||||||
|
cfg.write_text("1\n", encoding="utf-8")
|
||||||
|
dark(False)
|
||||||
|
run(BLANK, "off")
|
||||||
|
run(BLANK, "on")
|
||||||
|
time.sleep(1.4)
|
||||||
|
if log():
|
||||||
|
return failure("bananarchy-idle-blank.sh on did not cancel the lock")
|
||||||
|
print("[ok] blank: on cancels the pending lock")
|
||||||
|
|
||||||
|
# An incoming call / SMS wake must cancel the pending lock too.
|
||||||
|
clear()
|
||||||
|
dark(False)
|
||||||
|
run(BLANK, "off")
|
||||||
|
run(WAKE)
|
||||||
|
time.sleep(1.4)
|
||||||
|
if log():
|
||||||
|
return failure("bananarchy-screen-wake.sh did not cancel the lock")
|
||||||
|
if "bananarchy-idle-lock.sh cancel" not in UNLOCK_HOOK.read_text():
|
||||||
|
return failure("sxmo_hook_unlock.sh does not cancel the pending lock")
|
||||||
|
print("[ok] wake: screen-wake and unlock hook cancel the pending lock")
|
||||||
|
run(LOCK, "cancel")
|
||||||
|
print("idle blank screenlock wiring: all checks passed")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
Reference in new issue
Block a user