Fix idle-blank wake race and PIN-locked SIM DSDS provisioning

Two issues reported after the recovery image booted:

1. Pressing the power key turned the screen on and immediately back off.
   Root cause: U1 used sxmo_idle.sh + xprintidle, but dwm consumes keypad
   events at the evdev level before X sees them, so the X idle counter never
   reliably reset and the blank/resume commands raced. Replaced it with a
   dwm-native idle timer (src/sxmo-dwm/dwm.c): last_input_ms is updated from
   evdev and X key events, poll() is armed with the SXMO_UNLOCK_IDLE_TIME
   deadline (default 60 s), bananarchy-idle-blank.sh off fires once, and
   wake_phone() clears idle_blanked and resets the timer on the next real key.
   sxmo.noidle still disables it; idle_locker was removed from
   sxmo_hook_unlock.sh. Added a defensive wake-grace guard to
   bananarchy-idle-blank.sh and a /tmp/bananarchy_last_wake timestamp in
   sxmo_wm.sh display on so an already-flashed device is fixed too.

2. A PIN on one SIM prevented the other SIM from registering. provision_slot()
   tried to bind the preferred slot to primary-gw-provisioning even when its
   app was pin1/puk1 or PIN1 state enabled-not-verified, so no session came up
   and neither subscription registered. It now detects a locked preferred slot
   and falls back to the other ready slot for the primary GW; verify-pin/xmodem
   re-run boot after unlock and provision both slots normally.

Verified on the connected phone: all three deployed scripts pass sh -n, all
5 embedded Python heredocs parse, SIM status still reports both slots
registered, and off -> on -> immediate off leaves the screen on (grace guard).
Rebuilt dwm/plugins and images/bananarchy-nokia-argon.img with --mkinitfs;
boot.img still contains the known-good zImage + DTB byte-for-byte.
check-rebuild.sh passes and artifact drift is 0.

Docs: CHANGELOG.md, MANUAL.md, BATTERY-OPTIMIZATION-ANALYSIS.md (section 12).
This commit is contained in:
Bantam committed 2026-11-07 17:56:55 +02:00
1 parent 0dbb37fba3
commit 22d629f59b
10 files changed
+138 -12

No files matched your search

+12
View File
@@ -405,3 +405,15 @@ a kernel with the original ABI and accepting that those config-level savings are
Kept because they do not depend on the kernel config: K2 (`clock-latency-ns` in the DTB),
K3/K4/K5 (patch 0006, rebuilt with the original config), K10 (IPv6 sysctl), and all U1-U14
userspace changes. Deep standby (U2) stays disabled and inert.
---
## 12. Post-flash fixes (after the recovery image booted)
- **U1 idle blank wake race**: replaced the `sxmo_idle.sh`/`xprintidle` job with
a dwm-native idle timer (`src/sxmo-dwm/dwm.c`), because dwm consumes evdev key
events before X sees them. `wake_phone()` now resets the timer, so pressing the
power key can no longer turn the screen on and immediately back off.
- **DSDS with a PIN-locked SIM**: `provision_slot()` now prefers the ready slot
for `primary-gw-provisioning` when the preferred slot is `pin1`/`puk1`, so the
unlocked SIM registers at boot. `verify-pin` re-runs `boot` after unlock.