diff --git a/AGENTS.md b/AGENTS.md index 7959ab8..be2f0d8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -72,9 +72,12 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, ` - The shipping 2720 Flip DTS/DTB is single-panel. The two-panel `/dev/fb1` layout is opt-in via `scripts/build-beatles-cover-panel.py`; rollback is `scripts/build-beatles-no-cover-dtb.py`. Do not make it default until gpio13 mux polarity and gpio21/gpio23 D/C/reset polarity are physically probed: a live test darkened both - screens. + screens. The shipping image drives the external GC9305 from userspace over `/dev/spidev0.1` while the flip is + **closed only** (`bananarchy-cover-idle`); never claim gpio13/21/23 or send SPI traffic while the flip is open, and + gate activation on the main panel being DPMS-off; always restore the mux to the internal panel on `LID OPEN`. - Keep the internal beatles panel at 25 MHz, `dc_gpio = -1` for the spidev fallback, external-panel firmware and - initramfs module lists, the Xorg `card0` pin, `bananarchy-cover-diagnose.sh`, and `scripts/test-cover-dt.py` guards. + initramfs module lists, the Xorg `card0` pin, `bananarchy-cover-diagnose.sh`, and the + `scripts/test-cover-dt.py` / `scripts/test-cover-spidev.py` guards. - Build the lk2nd display image from pinned `bootloader/lk2nd/nokia-beatles.patch`. Exact stock IDs, 512 MiB memory fallback, appended DTB, `quiet splash`, and the low-bit reboot cookie matter. `check-lk2nd-beatles.py`, `test-lk2nd-beatles-port.py`, `check-beatles-bootimg.py`, `sync-beatles-bootfs.py --check`, and `check-rebuild.sh` diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9d143..9c12b8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ 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. +### Closed-flip external panel on the shipping 2720 Flip image + +- **Problem**: both GC9305 panels share one BLSP1 QUP5 SPI bus through a gpio13 mux. The shipping image registers only the 240x320 internal panel, so `bananarchy-cover-idle` had no `/dev/fb1` and reported `backend=none`: the cover screen was never driven in the closed flip state. Registering both panels in the DT (`devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`) does produce `/dev/fb1`, but an earlier live test darkened the main panel, so that layout is deliberately opt-in. +- **Switch**: `src/bananarchy-daemons/bananarchy-cover-idle.c` now owns the external GC9305 from userspace while the flip is **closed only**. It claims gpio13 (mux), gpio21 (D/C) and gpio23 (reset) through the gpiochip v1 ABI, drives the mux to the cover panel, pulses reset, replays `/lib/firmware/nokia,beatles-gc9305-ext-panel.bin` over `/dev/spidev0.1` at the verified 25 MHz, and writes 240x240 RGB565 frames with proper D/C and CS framing. On `LID OPEN` it sends GC9305 display-off, restores the mux to the internal panel, releases the D/C and reset lines and stops all SPI traffic, so Xorg's `card0` cannot lose the bus. Activation additionally requires the main panel to be DPMS-off (`card0-SPI-1/dpms`), which is the real closed-flip condition and rejects the transient lid-state flap observed when `bananarchy-lid` restarts. While open the daemon holds no panel handles and issues no transfers; the mux line stays claimed for the daemon's lifetime so it is always explicitly driven back to the internal panel. `/dev/fb1` still takes precedence when the opt-in two-panel DT is installed (`backend = auto`), `backend = fb|spidev|none` forces a path, and `FBIOBLANK` blanking of the fbdev is unchanged. +- **Hardware measurements**: on the live `nokia-beatles` target over root SSH, `/sys/kernel/debug/gpio` showed gpio13 `out low` with the main panel active (low = internal, high = cover), gpio21/gpio23 free inputs, gpio25 (`reset`) and gpio110 (`dc`) claimed by `panel-mipi-dbi-spi`, and `l17`/`l6` panel rails enabled. gpio13 therefore stays an output-low mux select and the daemon never requests gpio110. Polarities were *not* confirmed with eyes on the cover panel, so they remain config keys and runtime `bananarchy-coverctl SET` knobs, with `SET backend none` as a one-command rollback. +- **Live verification**: the rebuilt ARM daemon, config, service and diagnostics were deployed to the phone. With the flip open, `STATUS` reports `backend=idle spi=1 mux=free` and gpio13 stays low. After `LID CLOSED` + `BUTTON` (lid broadcaster stopped, main panel DPMS-off to emulate a closed flip), `STATUS` reports `backend=spidev visible=1 mux=closed`, gpio13 goes high, the daemon holds `/dev/gpiochip0`, two `gpio-linehandle` fds and `/dev/spidev0.1`, and every init/frame ioctl succeeds. `BLANK` sends display-off; `LID OPEN` restores gpio13 low and `mux=open`. Xorg, dwm, `card0-SPI-1 dpms=On` and backlight 14 were restored afterwards, the lid service was restarted, and stopping the cover service leaves gpio13 output-low. Physical illumination of the cover still needs eyes-on sign-off. +- **Guards and docs**: `scripts/test-cover-spidev.py` compiles the daemon in SPI simulation mode and verifies the open-flip bus silence, the DPMS-On gate, mux-first ordering, firmware replay, RGB565 frame size, display-off on blank, handover on open, polarity knobs, `SET backend none` rollback and `/dev/fb1` precedence. `scripts/check-rebuild.sh` guards the new source/config tokens and both compiled ARM copies. `bananarchy-cover-diagnose.sh` reports the spidev node, TLMM lines and polarity config. README, MANUAL and `AGENTS.md` describe the closed-flip-only ownership; the shipping DTB stays single-panel and the two-panel DT stays opt-in. `prebuilt/bananarchy-daemons/usr/bin/bananarchy-cover-idle` and its overlay mirror were rebuilt with `scripts/build-bananarchy-daemons.sh`. +- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` with the closed-flip external-panel backend; the verified raw hash is `ccc8c44517a6a3b78e16e45e9dddbf89f6f04a35ee4c52246d38d89970bd13ac`, pinned by `scripts/check-rebuild.sh`. `debugfs` confirms the image rootfs carries the rebuilt `bananarchy-cover-idle` and the new config, service and diagnostics byte-for-byte; `e2fsck -fn` passed on both `pmOS_boot` and `pmOS_root`; `sync-beatles-bootfs.py --check`, `check-beatles-bootimg.py`, artifact sync and `check-rebuild.sh` pass. The standalone `boot-bananarchy-nokia-beatles.img` hash is unchanged. Eyes-on confirmation that the cover panel lights up is still pending, so this is an intermediate build. + ### Power menu label - Shortened the Power menu item **Reboot to bootloader** to **Reboot to loader** in `dmenu.so`, `sxmo_appmenu.sh` and the context-menu hook so the full label fits the 240x320 screen. Rebuilt `dmenu.so`, updated the prebuilt and overlay artifacts and guards, and kept the `sxmo_power.sh bootloader` action unchanged. @@ -23,7 +32,7 @@ Work since `a1108` has focused on reliable 2720 Flip hardware support and a repr - **Connection path**: `overlay/rootfs/etc/bluetooth/main.conf` now uses `ControllerMode = dual`, preserving classic A2DP/HSP/HFP profiles while allowing LE HOGP. `input.conf` keeps `UserspaceHID=true`, `LEAutoSecurity=true` and `ClassicBondedOnly=false`. `bananarchy-bt-obex` powers the adapter on, calls the narrow `bananarchy-bt-le-enable.sh` helper, sets `PreferredBearer = le` for devices exposing HID service `00001812-...`, and automatically pairs unbonded peripherals selected through **Connect Device**. - **Daemon lifecycle**: `bananarchy-bt-obex stop` no longer calls `pkill`, which is absent from the BusyBox-based target rootfs; it now terminates the PID-file daemon and scans `/proc` directly for stale daemon command lines. - **Guards and live verification**: `scripts/test-bluetooth-hid.py` and `check-rebuild.sh` guard the dual-mode config, HOGP settings, pair/connect preflight, LE bearer selection and auto-pair logic. On the live phone, `bluetoothd -d` showed `Loading hog plugin` with no `System does not support hog plugin` rejection after the change, and `btmgmt info` showed `le` in the controller's current settings immediately after `bluetoothctl power on`. -- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` after the Bluetooth HID and Power menu label fixes; the verified raw hash is `16cc68cbfa9908dd42a36e1e4dd18149f9d8e43f7c5af30839695a89a5e60783`, pinned by `check-rebuild.sh`. `debugfs` confirms the image rootfs has `ControllerMode = dual`, the corrected `0755` `bananarchy-bt-obex` helper, the explicit Bluetooth packages and a `dmenu.so` containing only the compact `Reboot to loader` label; `e2fsck -fn` passed. This supersedes the previous image hash `c5dc3e2b...`. +- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` after the Bluetooth HID and Power menu label fixes; the verified raw hash at that point was `16cc68cbfa9908dd42a36e1e4dd18149f9d8e43f7c5af30839695a89a5e60783` (superseded by the closed-flip cover rebuild below). `debugfs` confirms the image rootfs has `ControllerMode = dual`, the corrected `0755` `bananarchy-bt-obex` helper, the explicit Bluetooth packages and a `dmenu.so` containing only the compact `Reboot to loader` label; `e2fsck -fn` passed. This supersedes the previous image hash `c5dc3e2b...`. ### Live Bluetooth peripheral discovery diff --git a/MANUAL.md b/MANUAL.md index a835e93..4fb3090 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 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 deliberately keeps the verified single-panel layout, so `/dev/fb1` is normally absent. A live test produced a working 240x240 external framebuffer but made the main panel go dark, so the two-panel `spi-mux` wiring is opt-in in `devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`: build it with `scripts/build-beatles-cover-panel.py`, install the resulting DTB/boot.img into `pmOS_boot`, and verify the main panel before keeping it. `scripts/build-beatles-no-cover-dtb.py` builds the single-panel rollback DTB. The external firmware and `mux-core`/`mux-gpio`/`spi-mux` modules are already provisioned in the initramfs; `bananarchy-coverctl STATUS` reports `backend=fb` only when the opt-in DT is installed, otherwise `backend=none`. `scripts/test-cover-idle.py` verifies the state machine with a fake framebuffer, while `scripts/test-cover-dt.py` validates both the shipping single-panel DTB and the opt-in two-panel DT, the firmware lists and the Xorg pin. Physical sign-off of gpio13 mux polarity, the external gpio21 D/C and gpio23 reset polarity, and the lk2nd boot splash is still required on a live 2720 Flip; `devices/nokia-beatles/cover-panel.dtsi` remains a compile-checked reference for older DTBs. Run `bananarchy-cover-diagnose.sh` on the phone to check `/dev/fb1`, its geometry, the DRM cards, the loaded mux/panel modules, the firmware, the lid state and `bananarchy-coverctl STATUS` in one report. If the external panel disturbs the main display during sign-off, `scripts/build-beatles-no-cover-dtb.py --install` builds the verified single-panel DTB and patches the local boot image / `pmOS_boot`; `sync-beatles-bootfs.py` without overrides restores the shipping DTB. "Fully off" is a black frame plus `FBIOBLANK`/`FB_BLANK_POWERDOWN` on the fbdev (and the optional `backlight_path` sysfs node when present). +- **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`, `SET`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip **open** the external panel is fully off and the daemon does not touch the shared QUP5 SPI bus at all; activation also requires `card0-SPI-1/dpms = Off`, so a transient lid-state flap cannot steal the bus from a live main panel. With the flip **closed** the daemon claims gpio13 (SPI bus mux), gpio21 (external D/C) and gpio23 (external reset) via `/dev/gpiochip0`, drives the mux to the cover panel, resets the GC9305, replays `/lib/firmware/nokia,beatles-gc9305-ext-panel.bin` over `/dev/spidev0.1` at 25 MHz and writes 240x240 RGB565 frames. `STATUS` reports `backend=spidev` and `mux=closed` while the cover owns the bus, and `mux=open` after `LID OPEN`, which sends display-off, restores the mux to the internal panel and releases the D/C and reset lines before Xorg flushes another frame. This is why the shipping image can use the cover screen without registering a second panel in the DT: both GC9305s share one SPI bus and the main panel is DPMS-off whenever the flip is 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%. `backend = auto` prefers `/dev/fb1` when the opt-in two-panel DT is installed, using the 32-bpp fbdev `write()` path (not `mmap()`, which raises `SIGBUS`) and `FBIOBLANK`/`FB_BLANK_POWERDOWN` for "fully off". `backend = spidev` forces the userspace path, `backend = fb` forces the fbdev path and `backend = none` releases the bus; `SET backend none` is a live rollback. The external D/C, reset and mux polarities are config keys (`mux_closed_level`, `mux_open_level`, `dc_command_level`, `dc_data_level`, `reset_assert_level`, `reset_idle_level`) and runtime `SET` knobs, so physical sign-off needs no rebuild: close the flip (or hold `LID CLOSED` with the lid broadcaster stopped), run `bananarchy-coverctl TEST bars`, then try `SET mux_closed_level 0|1`, `SET reset_assert_level 0|1` and `SET dc_command_level 0|1` until the bars appear. The shipping DTS deliberately keeps the verified single-panel layout, so `/dev/fb1` is normally absent. A live test with two panels registered produced a working 240x240 external framebuffer but made the main panel go dark, so the two-panel `spi-mux` wiring is opt-in in `devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`: build it with `scripts/build-beatles-cover-panel.py`, install the resulting DTB/boot.img into `pmOS_boot`, and verify the main panel before keeping it. `scripts/build-beatles-no-cover-dtb.py` builds the single-panel rollback DTB. The external firmware and `mux-core`/`mux-gpio`/`spi-mux` modules are already provisioned in the initramfs; `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py` and `scripts/test-cover-dt.py` verify the state machine, the closed-flip bus handover and both DT layouts on the host. Physical sign-off of the external D/C and reset polarity and of the cover backlight is still required with eyes on a live 2720 Flip; `devices/nokia-beatles/cover-panel.dtsi` remains a compile-checked reference for older DTBs. Run `bananarchy-cover-diagnose.sh` on the phone to check `/dev/fb1`, `/dev/spidev0.1`, the GPIO lines, the mux/panel modules, the firmware, the lid state and `bananarchy-coverctl STATUS` in one report. If the external panel disturbs the main display during sign-off, `SET backend none` releases the bus immediately and `scripts/build-beatles-no-cover-dtb.py --install` rebuilds the verified single-panel DTB/boot image for `pmOS_boot`. - **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 0a76343..46b5013 100644 --- a/README.md +++ b/README.md @@ -50,7 +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 `