diff --git a/AGENTS.md b/AGENTS.md index b50565e..a6b68fe 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,7 +34,7 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre - `scripts/rootfs-prune-packages.txt`: denylist of Wayland-only, Rust-based, and retired packages purged from existing rootfs trees by `bootstrap-rootfs-container.sh` and `rebuild-image.sh`. - `scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist and pins `install_if` packages with negative `!pkg` world constraints plus `apk fix`; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`. -- **Flip lid and cover daemon**: the compiled C `bananarchy-lid` (service `bananarchy-lid`) reads the current `EV_SW` switch mask from `/dev/input/event2`, follows hall edge events with an 80 ms stability window and reconciles raw gpio36/gpio92 debugfs levels every 200 ms even when switch evdev is present, because the 2720 can miss edges or leave `EVIOCGSW` stale. The main beatles panel uses 25 MHz SPI (other targets stay at 50 MHz) to prevent high-backlight PWM noise from corrupting the display at brightness levels above 10/14. It publishes `/run/bananarchy/lid-state` so a boot-open flip starts X unlocked, directly blanks/restores the main backlight and `white:kbd_backlight`, clears the lock flag and sends a trusted `CLOSE` to `locker.so` on open, and broadcasts `LID CLOSED|OPEN` to the cover IPC. The compiled C `bananarchy-cover-idle` replaces the CPU-spinning native `bananarchy-coverd` in the default runlevel: it is a 0%-CPU Unix SOCK_DGRAM server implementing the `bananarchy-coverctl` protocol and renders a 240x240 XRGB8888 clock or `TEST bars` to the 32-bpp `/dev/fb1` with `write()`/`fsync()`. The shipping beatles DTS keeps the known-good single internal panel and `spidev@1`; `cover-panel.dtsi` is again compile-checked but hardware-gated after live testing broke the main panel/keypad path. +- **Flip lid and cover daemon**: the compiled C `bananarchy-lid` (service `bananarchy-lid`) reads the current `EV_SW` switch mask from `/dev/input/event2`, follows hall edge events with an 80 ms stability window and reconciles raw gpio36/gpio92 debugfs levels every 200 ms even when switch evdev is present, because the 2720 can miss edges or leave `EVIOCGSW` stale. The main beatles panel uses 25 MHz SPI (other targets stay at 50 MHz) to prevent high-backlight PWM noise from corrupting the display at brightness levels above 10/14. It publishes `/run/bananarchy/lid-state` so a boot-open flip starts X unlocked, directly blanks/restores the main backlight and `white:kbd_backlight`, clears the lock flag and sends a trusted `CLOSE` to `locker.so` on open, and broadcasts `LID CLOSED|OPEN` to the cover IPC. The compiled C `bananarchy-cover-idle` replaces the CPU-spinning native `bananarchy-coverd` in the default runlevel: it is a 0%-CPU Unix SOCK_DGRAM server implementing the `bananarchy-coverctl` protocol and renders a 240x240 XRGB8888 clock or `TEST bars` to the 32-bpp `/dev/fb1` with `write()`/`fsync()`. It keeps the cover fully off while the flip is open, shows clock/battery/network indicators only after a trusted `BUTTON` from `bananarchy-volume-keys` while closed, and blanks again after the same `~/.config/sxmo/idle_blank_timeout` used by `dwm` (`blank_timeout = auto` in `/etc/bananarchy/cover-display.conf`). The shipping beatles DTS keeps the known-good single internal panel and `spidev@1`; `cover-panel.dtsi` is again compile-checked but hardware-gated after live testing broke the main panel/keypad path. - **Camera, volume keys and cover spi-mux**: `etc/modules-load.d/bananarchy-hardware.conf` plus `etc/local.d/10-bananarchy-hardware.start` load `msm8905-cam` (registers `/dev/video0`) and `spidev`. The demosaic sampler rotates frames 180 degrees only when `of_machine_is_compatible("nokia,beatles")`, correcting the Flip's raw V4L2 orientation without changing other targets or adding a frame copy. `scripts/busybox-sbin-applets.txt` restores the missing `/sbin` applets including `reboot`/`poweroff`. The compiled C `bananarchy-volume-keys` (OpenRC service `bananarchy-volume-keys`) handles `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` straight from evdev because the dwm passive X grab is unreliable; `sxmo_audio.sh` mirrors the logical volume into the first live PipeWire sink via `bananarchy_set_sink_volume()` and debounces double steps with `bananarchy_vol_debounce()`. The shipping beatles DTS keeps `spidev@1` and does not apply `cover-panel.dtsi`; the external panel remains hardware-gated. `dc_gpio = -1` remains in `/etc/bananarchy/cover-display.conf` for the retained native spidev fallback. - **BusyBox applet completeness**: `scripts/busybox-applets.txt` is the canonical `/bin` applet list and `apply-bananarchy-overlay.sh` recreates any missing symlinks. A rootfs snapshot without `/bin/ash` (the `user` login shell) or `/bin/grep` (used by `openrc-run.sh`) breaks sshd logins and prevents the sysinit `udev` service from starting; without udev, input nodes stay root-owned and untagged, elogind gives Xorg no devices and the keypad is dead. `overlay/rootfs/etc/udev/rules.d/99-bananarchy-input-seat.rules` forces `TAG+="seat"`, `GROUP="input"`, `MODE="0660"`; restart `tinydm` after starting udev. The lk2nd `paint_boot_banner()` in `bootloader/lk2nd/nokia-beatles.patch` draws the branded RGB565 boot splash, not the old striped test pattern. - **First-boot access (2720 Flip)**: `overlay/rootfs/etc/pam.d/sshd` supplies an explicit `pam_unix` stack and `overlay/rootfs/etc/ssh/sshd_config.d/90-bananarchy-access.conf` enables password/keyboard-interactive auth, because `50-postmarketos-ui-policy.conf` sets `UsePAM yes` while the plain `/usr/sbin/sshd` rejects that directive; `overlay/rootfs/etc/conf.d/sshd` pins `/usr/sbin/sshd.pam`. `overlay/rootfs/etc/ssh/sshd_config_debug` plus `etc/local.d/20-bananarchy-sshd-debug.start` keep a USB-only (172.16.42.1:2222) PAM-free fallback login; `keys/phone_id_ed25519.pub` is pre-authorized for `user` and `root`. The shipping `extlinux.conf` must contain `quiet splash` (the pmOS initramfs defaults to `nosplash=y`); `scripts/sync-beatles-bootfs.py` restores it and `scripts/check-beatles-bootimg.py` rejects debug cmdlines. `overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rules` and `usr/share/X11/xorg.conf.d/60-bananarchy-keypad.conf` force X to attach the GPIO matrix keypad; `usr/bin/bananarchy-keypad-diagnose.sh` collects live input state. The external 240x240 panel firmware lives in `devices/nokia-beatles/nokia,beatles-gc9305-ext-panel.bin/.txt`; `devices/nokia-beatles/cover-panel.dtsi` is a compile-checked but unapplied reference; `devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts` keeps the shipping single-panel layout, and `scripts/check-rebuild.sh` verifies DTB/DTS sync and rejects an accidentally applied cover overlay. The `mux-core`, `mux-gpio` and `spi-mux` modules are built and loaded. The recovered native `usr/bin/bananarchy-coverd` is retained only for diagnostics; `dc_gpio = -1` and the external node's missing `dc-gpios` property keep it from fighting `panel-mipi-dbi-spi` for gpio110. gpio13 selection and external reset polarity still require a physical cover-panel sign-off. @@ -57,7 +57,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - `./scripts/prune-rootfs-packages.sh 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-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`, `./scripts/test-idle-blank-lock.py`, `./scripts/test-bluetooth-scan.py`, `./scripts/test-battery-charge-event.py` and `./scripts/test-gps-time-sync.py` — host unit/integration tests for the Webarchy renderer profile, the idle-blank screenlock wiring, the Bluetooth discovery parser, the charger plug/unplug icon refresh and the GPS-only time source (all also run by `check-rebuild.sh`). +- `./scripts/test-webarchy-renderer.py`, `./scripts/test-idle-blank-lock.py`, `./scripts/test-bluetooth-scan.py`, `./scripts/test-battery-charge-event.py`, `./scripts/test-gps-time-sync.py` and `./scripts/test-cover-idle.py` — host unit/integration tests for the Webarchy renderer profile, the idle-blank screenlock wiring, the Bluetooth discovery parser, the charger plug/unplug icon refresh, the GPS-only time source and the cover display state machine (all 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/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`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 2186cab..cc91e00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ Release versions follow the `
` 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. +### 2720 Flip cover display behaviour + +- **External panel never showed anything useful**: `bananarchy-cover-idle` repainted a clock every 30 s regardless of lid state, ignored its `blank_timeout` setting, had no button input and drew no network indicators. It now implements the full behaviour contract: an **open flip** is fully off (black frame + backlight 0 and `BUTTON` ignored), a **closed flip** waits off until a trusted `BUTTON` datagram arrives, and that button shows the live clock, date, battery and a compact network line. The cover then blanks after exactly the main **Config -> Screen blank** timeout (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` follows it). While off the daemon blocks in `poll()` with no timer at all, so it stays at 0% CPU. +- `bananarchy-volume-keys` now reads `/run/bananarchy/lid-state` and turns external side keys (volume up/down and End/Power) into cover wake buttons while the flip is closed instead of changing the volume. `bananarchy-cover-status.sh` publishes `4G SIG75 WIFI`-style indicators and battery state to the daemon from the NetworkManager dispatcher, the cover service start, and `bananarchy-cover-event.sh network|button`. `bananarchy-coverctl STATUS` now reports `lid`, `visible`, `blank_ms` and `network`. +- `scripts/test-cover-idle.py` compiles the daemon on the host and drives its real socket protocol against a fake framebuffer/backlight, verifying open/closed gating, button wake, indicator republishing, the shared blank timeout (including `0` = never) and backlight state. `check-rebuild.sh` guards the rebuilt ARM daemons and the IPC wiring. The shipping beatles DTB intentionally still keeps the single internal panel: gpio13 mux selection and external reset polarity remain hardware-gated, but the compile-tested `cover-panel.dtsi` now uses the verified 25 MHz internal-panel clock so enabling it later cannot reintroduce high-brightness corruption. Physical `/dev/fb1` validation is still required before the overlay is applied. + ### GPS reception and GPS-only system time - **GPS never produced a fix**: `bananarchy-gps`, `gps.so` and the new helpers all used `mmcli -m any`, which is ambiguous on the dual-SIM QMI stack of the 2720 Flip and can resolve to a modem without a Location interface. `/usr/bin/bananarchy-gps-modem.sh` now lists the modems, prefers the one advertising `gps-nmea`, enables the modem plus `3gpp`, `gps-nmea`, `gps-raw` and a 2 s refresh rate, and falls back to `any` only when nothing is enumerated. `gps.so`, the CLI (`status|nmea|watch|enable|disable|modem`) and the time helper share this resolver, so `nokia-argon` keeps its single-modem behaviour. diff --git a/MANUAL.md b/MANUAL.md index f0755fb..e69b300 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -456,7 +456,7 @@ Three native X11 games (`/usr/bin/snake`, `/usr/bin/tetris`, and `/usr/bin/scoun - **X startup and keypad**: OpenRC starts independent services in parallel; `etc/init.d/local` replaces its stock `after *` dependency, which deadlocked with parallel startup on this image. `udev_settle_timeout=2` stops missing modem firmware from holding the display manager behind a long `udevadm settle`, and `bananarchy-sshd-debug` starts independently of `local.d`. A boot-open flip reads `/run/bananarchy/lid-state` and starts in `state=unlock` with no passcode screen, so the keypad is live as soon as `dwm` starts. If the keypad is dead, check `rc-service bananarchy-lid status`, `cat /run/bananarchy/lid-state`, `sxmo_state.sh get`, `/tmp/bananarchy_screen_locked`, `DISPLAY=:0 xwininfo -id 0xa00001` and `DISPLAY=:0 xinput list`. - **Display distortion above 71% brightness**: the internal panel uses 25 MHz SPI on `nokia-beatles`, rather than the 50 MHz timing used by the other targets. This keeps the link stable when the MPP2 backlight PWM duty rises above the level-10/14 operating point. The brightness range remains 1–14 with no artificial cap, and panel offsets/init registers are unchanged. The timing can be checked with `dtc -I dtb -O dts /boot/qcom-msm8905-nokia-beatles.dtb | grep -A8 'display@0'`. - **Closing the flip**: `bananarchy-lid` reads the current `EV_SW` switch mask from `/dev/input/event2`, follows hall edge events with an 80 ms stability window, and reconciles the raw gpio36/gpio92 debugfs levels every 200 ms even while evdev is present. This covers missed edges and stale `EVIOCGSW` state without a busy-polling loop. On close it blanks the main panel and keypad LED immediately, runs `sxmo_state.sh set screenoff` and tells the cover daemon `LID CLOSED`; on open it clears the lock flag, restores both backlights, sends a trusted `CLOSE` to `locker.so` and runs `sxmo_state.sh set unlock`. Check `rc-service bananarchy-lid status`, `sxmo_state.sh get` and `grep -E " gpio(36|92) " /sys/kernel/debug/gpio`. If the hall polarity is inverted on your unit, set `BANANARCHY_LID_GPIO_FILE` to a different debugfs GPIO file for the fallback path. -- **Cover display status**: `bananarchy-cover-idle` is the compiled 0%-CPU default daemon and answers `bananarchy-coverctl`; the native `bananarchy-coverd` is retained only for diagnostics. The shipping DTS keeps the known-good single internal panel; `cover-panel.dtsi` is compile-tested but not applied. The expected live state is no `/dev/fb1` and `bananarchy-coverctl STATUS` reporting `backend=none`. The renderer uses the 32-bpp fbdev `write()` path for future hardware (not `mmap()`, which raises `SIGBUS` on the DRM fbdev). gpio13 selection and external reset polarity still require physical sign-off before the overlay is re-enabled. +- **Cover display status and behaviour**: `bananarchy-cover-idle` is the compiled 0%-CPU default daemon and answers `bananarchy-coverctl` (`PING`, `STATUS`, `LID CLOSED|OPEN`, `BUTTON`, `NETWORK`, `BATTERY`, `NOTIFY`, `BLANK`/`UNBLANK`, `TEST`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip **open** the external panel is fully off (all-black frame plus backlight 0) and `BUTTON` is ignored. With the flip **closed** the panel stays off until an external side key is pressed: `bananarchy-volume-keys` reads `/run/bananarchy/lid-state` and sends the trusted `BUTTON` datagram instead of changing the volume, which shows the live clock, date, battery percentage and the compact main network indicators (`4G SIG75 WIFI`-style, published by `bananarchy-cover-status.sh` from the NetworkManager dispatcher and at service start). No further button blanks the cover after exactly the same **Config -> Screen blank** timeout that `dwm` uses (`~/.config/sxmo/idle_blank_timeout`, default 300 s, `0` = never; `blank_timeout = auto` in `/etc/bananarchy/cover-display.conf` selects it, a numeric value overrides it). The daemon blocks in `poll()` with no timer while off, so idle CPU stays at 0%. The renderer uses the 32-bpp fbdev `write()` path (not `mmap()`, which raises `SIGBUS` on the DRM fbdev). The shipping DTS keeps the known-good single internal panel; `cover-panel.dtsi` is compile-tested but not applied, so the expected live state is still no `/dev/fb1` and `bananarchy-coverctl STATUS` reporting `backend=none` until gpio13 selection and external reset polarity receive physical sign-off. The reference overlay now keeps the verified 25 MHz internal-panel clock so enabling it later cannot reintroduce high-brightness corruption. `scripts/test-cover-idle.py` verifies the full lid/button/timeout/indicator state machine on the host with a fake framebuffer. - **Camera app frozen / UI unresponsive**: check `top` for `bananarchy-volume-keys`. The daemon must be a single instance at 0% CPU; stale evdev fds are pruned by `prune_devices()`/`drop_device()` and guarded by `flock`. `rc-service bananarchy-volume-keys status` and `bananarchy-keypad-diagnose.sh` report its state. `xcamera` should return immediately and `bananarchy-photo ` should write a 600x800 JPEG. - **Camera**: `/dev/video0` is provided by the out-of-tree `msm8905-cam` module, loaded at boot by `/etc/modules-load.d/bananarchy-hardware.conf` and `etc/local.d/10-bananarchy-hardware.start`. Check with `v4l2-ctl --list-devices`; a missing node means the module did not load (previously caused by a missing `/bin/sed` breaking the `modules` service). - **Side volume keys**: the compiled evdev daemon `bananarchy-volume-keys` reads `KEY_VOLUMEUP`/`KEY_VOLUMEDOWN` directly and calls `sxmo_audio.sh vol up/down 5`; `sxmo_audio.sh` mirrors that percentage into the live PipeWire sink (the MSM8905 mainline kernel has no ALSA card yet). Press a side button and check `wpctl get-volume `; `bananarchy-keypad-diagnose.sh` reports the XKB mapping and both volume values. diff --git a/README.md b/README.md index 1d43366..0a213dd 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs - **Kopher SmallWeb browser (`xkopher` / `kopher` / `xsmallweb` / `smallweb.so`)**: multi-protocol SmallWeb client for **Gopher** (`gopher://`) with optional TLS (`gophers://`), **Gemini** (`gemini://`), **Spartan** (`spartan://`), and **Nex** (`nex://`), featuring WAP-style default keypad controls from [Kopher](https://code.luxferre.top/luxferre/kopher.git), user-adjustable keybindings (`~/.config/sxmo/smallweb_controls.tsv`), 10 bookmarks, custom homepage support, and link focus that always scrolls the viewport to the focused link in both wrapped and unwrapped modes. - **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `