Release a1111 (lennon): isolate nokia-argon slider from 2720 Flip cover stack

- Write /usr/share/bananarchy/lid-profile per target in apply-bananarchy-overlay.sh (slider on nokia-argon, flip on nokia-beatles, none elsewhere), disable flip runlevel services, cover udev/config, and mux module loads on non-flip builds, and exit 0 immediately in flip daemons/init scripts when lid-profile != flip
- Guard startup Escape grab cleanup when locked and gate lid-state checks in display-power-sync, locker.so, and callscreen.so on lid-profile == flip so nokia-argon keeps pure a1108 sliding-lid behaviour
- Ship active-high shared cover backlight (kernel_backlight_invert = 0), active-black internal panel isolation (kernel_internal_sleep = 0), pixel-centered 240x240 cover UI, SW_LID hall sync, and shared Screen blank timeout on nokia-beatles
- Pin verified a1111 (lennon) image hashes for both nokia-argon and nokia-beatles and synchronize docs and host tests
This commit is contained in:
Luxferre committed 2026-11-11 14:20:42 +02:00
1 parent 7a2b965ce3
commit 83c8db10f1
38 files changed
+1351 -276

No files matched your search

+25 -16
View File
@@ -10,7 +10,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
- The stack is X11-only: Xlibre, patched `sxmo-de-dwm`, preloaded C/C++ DWM plugins, NeoUI, `fcitx5-t9`, and Adreno 304 - The stack is X11-only: Xlibre, patched `sxmo-de-dwm`, preloaded C/C++ DWM plugins, NeoUI, `fcitx5-t9`, and Adreno 304
Glamor/DRI3/GLX over `panel-mipi-dbi`. No Wayland compositor, backend, or viewer is shipped. Glamor/DRI3/GLX over `panel-mipi-dbi`. No Wayland compositor, backend, or viewer is shipped.
- Design targets are keypad-first 240x320 UI, <2 ms wake latency, and <95 MB idle RAM on 512 MB devices. The pinned - Design targets are keypad-first 240x320 UI, <2 ms wake latency, and <95 MB idle RAM on 512 MB devices. The pinned
release is `a1108` / `dejavu`; `scripts/version.sh` and `scripts/check-rebuild.sh` are authoritative. release is `a1111` / `lennon`; `scripts/version.sh` and `scripts/check-rebuild.sh` are authoritative.
## Source of truth and workflow ## Source of truth and workflow
@@ -30,7 +30,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
`scripts/compile-gsettings-schemas.sh`, `rebuild-image.sh`, `scripts/sync-beatles-bootfs.py --check`, `scripts/compile-gsettings-schemas.sh`, `rebuild-image.sh`, `scripts/sync-beatles-bootfs.py --check`,
`prepare-release.sh`, and `flash-edl.sh`. `prepare-release.sh`, and `flash-edl.sh`.
- Rebuild the verified 2720 image with - Rebuild the verified 2720 image with
`BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu ./rebuild-image.sh nokia-beatles`. After a verified rebuild, `BANANARCHY_VERSION=a1111 BANANARCHY_CODENAME=lennon ./rebuild-image.sh nokia-beatles`. After a verified rebuild,
update the raw hash in `scripts/check-rebuild.sh` and `CHANGELOG.md`; verify with `e2fsck -fn`, `debugfs`, bootfs update the raw hash in `scripts/check-rebuild.sh` and `CHANGELOG.md`; verify with `e2fsck -fn`, `debugfs`, bootfs
sync, artifact sync, and `check-rebuild.sh`. sync, artifact sync, and `check-rebuild.sh`.
- Do not push to `origin` unless explicitly requested. Do not update pinned hashes or release claims without actual - Do not push to `origin` unless explicitly requested. Do not update pinned hashes or release claims without actual
@@ -76,28 +76,37 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
The shipping image drives the external GC9305 through the kernel `panel-mipi-dbi-spi` driver while the flip is The shipping image drives the external GC9305 through the kernel `panel-mipi-dbi-spi` driver while the flip is
**closed only** (`bananarchy-cover-idle`); never claim gpio13/23 or send cover SPI traffic while the flip is open, **closed only** (`bananarchy-cover-idle`); never claim gpio13/23 or send cover SPI traffic while the flip is open,
gate initial activation on the main panel being DPMS-off, and always restore the mux on `LID OPEN`. gate initial activation on the main panel being DPMS-off, and always restore the mux on `LID OPEN`.
- The KaiOS 3.10 DTS gives both panels shared CS0, gpio110 D/C and one PWM backlight; gpio21 is TE and gpio23 is the - The KaiOS 3.10 DTS and kernel driver give both panels shared CS0, gpio110 D/C and one active-high PMIC MPP2 PWM
external reset. The shared PWM is active-low for the cover and active-high for the main panel: duty 0 lights the backlight (`kernel_backlight_invert = 0`, `kernel_backlight_level = 14`); gpio21 is TE and gpio23 is the external
cover, duty 14 lights the internal panel. Keep the exact vendor external init firmware, the debugfs command replay, reset. Because the internal 240x320 TN panel is normally-white while the external 240x240 panel is normally-black,
the gpio23 reset pulse, `/run/bananarchy/cover-backlight` (`1` = cover lit, `0` = cover dark), `cover_kernel_draw` wakes DRM with gpio13 low, paints the internal panel solid black via an X11 `override_redirect`
`kernel_power_sync_helper` and the `/run/bananarchy/cover-bl-force` nested-udev guard. Plain udev events must stay cover window plus `/dev/fb0`, and leaves the internal GC9305 scanning black GRAM (`kernel_internal_sleep = 0`)
idempotent; only the daemon's `force` mode may do the two-step PWM update, and every `xset dpms force` call must be behind gpio13 high so it blocks the shared backlight while the cover is lit. Keep the exact vendor external init
bounded with `timeout 1` or a hung X client will flicker the active panel. On open, restore gpio13 low, duty 14, firmware, the debugfs command replay, the gpio23 reset pulse, `/run/bananarchy/cover-backlight` (`0` = GRAM prep
`bl_power=0`, DPMS On and re-init the internal panel. The legacy 8-bit/9-bit userspace paths, `PROBE` and `bananarchy-cover-probe.sh` remain dark, `1` = cover lit, absent = dark/DPMS Off), `kernel_power_sync_helper` and `/run/bananarchy/cover-bl-force`.
rollback/sign-off tooling. `SET mux_closed_level 0` selects the internal panel, not the cover; use Plain udev events must stay idempotent; only the daemon's `force` mode may do the two-step PWM update, and every
`SET kernel_backlight_invert 0|1` only if a unit's backlight polarity differs. `xset dpms force` call must be bounded with `timeout 1` or a hung X client will flicker the active panel. On open,
restore gpio13 low, duty 14, `bl_power=0`, DPMS On and re-init the internal panel. The legacy 8-bit/9-bit userspace
paths, `PROBE` and `bananarchy-cover-probe.sh` remain rollback/sign-off tooling. `SET mux_closed_level 0` selects the
internal panel, not the cover; `SET kernel_backlight_invert 0|1` and `SET kernel_internal_sleep 0|1` remain runtime
knobs.
- Keep the internal beatles panel at 25 MHz, `dc_gpio = -1` for the spidev fallback, external-panel firmware and - 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 the initramfs module lists, the Xorg `card0` pin, `bananarchy-cover-diagnose.sh`, and the
`scripts/test-cover-dt.py` / `scripts/test-cover-spidev.py` guards. `scripts/test-cover-dt.py` / `scripts/test-cover-spidev.py` guards.
- The shipping cover backend is `backend = kernel`: keep `bananarchy-cover-dpms.sh reinit`, the gpio13 mux claim, - The shipping cover backend is `backend = kernel`: keep `bananarchy-cover-dpms.sh reinit`, the gpio13 mux claim,
the 240x240 `/dev/fb0` damage rect, the 1 s repaint against Xorg, `kernel_backlight_invert = 1`, the centered 240x240 X11/`/dev/fb0` cover frame, the 1 s repaint against Xorg, `kernel_backlight_invert = 0`,
`kernel_backlight_level = 14`, `scripts/test-cover-kernel.py`, and the `spidev`/`fb`/`none` rollback backends. `kernel_internal_sleep = 0`, `kernel_backlight_level = 14`, shared **Config -> Screen blank** timeout reload,
`scripts/test-cover-kernel.py`, and the `spidev`/`fb`/`none` rollback backends.
The daemon must restore the internal panel on `LID OPEN` even after a stale high gpio13 survives a restart. The daemon must restore the internal panel on `LID OPEN` even after a stale high gpio13 survives a restart.
- Keep the 2720 Flip lid handling event-driven and instant: sticky hall state, immediate hall re-read on `EV_SW` - Keep the 2720 Flip lid handling event-driven and instant: sticky hall state, immediate hall re-read on `EV_SW`
edges, 20 ms debounce, and synchronous lid-state/lock/backlight/DPMS writes in `bananarchy-lid.c`. Closing locks edges, 20 ms debounce, `SW_LID` mirroring (`sync_sw_lid`) so `dwm` tracks the hall sensor, and synchronous
lid-state/lock/backlight/DPMS writes in `bananarchy-lid.c`. Closing locks
the desktop; opening must keep the lock flag and wake to the passcode lockscreen, never auto-unlock. Every the desktop; opening must keep the lock flag and wake to the passcode lockscreen, never auto-unlock. Every
main-panel wake path must call `bananarchy-lid-gate.sh`; a closed flip may only light the cover. main-panel wake path must call `bananarchy-lid-gate.sh`; a closed flip may only light the cover.
`sxmo_state.sh set unlock` is gated too because `dwm` calls it directly. Guard `scripts/test-lid-gate.py`. `sxmo_state.sh set unlock` is gated too because `dwm` calls it directly. `apply-bananarchy-overlay.sh` writes
`/usr/share/bananarchy/lid-profile` per target (`slider` on `nokia-argon`, `flip` on `nokia-beatles`, `none`
elsewhere) and disables `bananarchy-{lid,cover-display,volume-keys}`, cover udev/config, and mux modprobes on
non-flip builds so `nokia-argon` keeps pure sliding-lid behaviour. Guard `scripts/test-lid-gate.py`.
- Build the lk2nd display image from pinned `bootloader/lk2nd/nokia-beatles.patch`. Exact stock IDs, 512 MiB memory - 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`, 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` `test-lk2nd-beatles-port.py`, `check-beatles-bootimg.py`, `sync-beatles-bootfs.py --check`, and `check-rebuild.sh`
+4 -4
View File
@@ -1,12 +1,12 @@
# Bananarchy battery-usage optimization analysis (measurement-corrected) # Bananarchy battery-usage optimization analysis (measurement-corrected)
**Status:** analysis plus implemented changes (sections 15-18). **Status:** analysis plus implemented changes (sections 15-18).
**Project:** `/home/lux/proj/bananarchy`, current release `a1108` / `dejavu`. **Project:** `/home/lux/proj/bananarchy`, current release `a1111` / `lennon`.
**Device:** Nokia 8110 4G (`nokia-argon`, MSM8905), connected over USB RNDIS at `172.16.42.1`, **Device:** Nokia 8110 4G (`nokia-argon`, MSM8905), connected over USB RNDIS at `172.16.42.1`,
`Linux nokia-argon 6.12.1-msm8916 #6 SMP PREEMPT Sat May 30 08:38:37 UTC 2026 armv7l`, `Linux nokia-argon 6.12.1-msm8916 #6 SMP PREEMPT Sat May 30 08:38:37 UTC 2026 armv7l`,
`Bananarchy Linux a1108` (codename `dejavu`, `msm8909`). Historical sections `Bananarchy Linux a1108` (codename `dejavu`, `msm8909`). Historical sections
below retain the build labels from their original measurement sessions; the below retain the build labels from their original measurement sessions; the
current shipped build is `a1108` / `dejavu`. current shipped build is `a1111` / `lennon`.
**Measurement session:** 2026-11-07 16:07–16:12 EET, uptime ~43 h at first snapshot. **Measurement session:** 2026-11-07 16:07–16:12 EET, uptime ~43 h at first snapshot.
Read-only SSH commands plus two 60-second delta windows. Temporary `/tmp/bantam-*` files on Read-only SSH commands plus two 60-second delta windows. Temporary `/tmp/bantam-*` files on
the phone were removed; `NO_RESIDUE` confirmed. the phone were removed; `NO_RESIDUE` confirmed.
@@ -193,7 +193,7 @@ rfkill rmtfs sshd tinydm udev-postmount wpa_supplicant` (no `bluetooth`, no `zra
`10-power-save.start`, `bananarchy-display-power-sync`, `sxmo_wm.sh`, `10-power-save.start`, `bananarchy-display-power-sync`, `sxmo_wm.sh`,
`sxmo_hook_statusbar.sh`, `sxmo_hook_battery.sh`, `msm-modem-uim-selection`, `sxmo_hook_statusbar.sh`, `sxmo_hook_battery.sh`, `msm-modem-uim-selection`,
`sxmo_modemmonitor.sh`, `xorg.conf.d/10-bananarchy-msm8909.conf` all match the repo copies. `sxmo_modemmonitor.sh`, `xorg.conf.d/10-bananarchy-msm8909.conf` all match the repo copies.
The deployed image at the time was `a1105`; the power-relevant code is identical to HEAD `2ea2db4`. The current build is `a1108` / `dejavu`. The deployed image at the time was `a1105`; the power-relevant code is identical to HEAD `2ea2db4`. The current build is `a1111` / `lennon`.
--- ---
@@ -446,7 +446,7 @@ worth doing to unlock them.
### 14.1 Session, limits, and state ### 14.1 Session, limits, and state
- Host clock 2026-11-07 18:03-18:46 EET; phone `Bananarchy Linux a1107` - Host clock 2026-11-07 18:03-18:46 EET; phone `Bananarchy Linux a1107`
(historical measurement; current build `a1108` / `dejavu`), (historical measurement; current build `a1111` / `lennon`),
`Linux nokia-argon 6.12.1-msm8916 #1 SMP PREEMPT`, freshly rebooted (uptime `Linux nokia-argon 6.12.1-msm8916 #1 SMP PREEMPT`, freshly rebooted (uptime
12-22 min during the windows), reachable at `172.16.42.1` over USB RNDIS. 12-22 min during the windows), reachable at `172.16.42.1` over USB RNDIS.
- **Charging throughout**: `pm8916-lbc-chgr/online=1`, - **Charging throughout**: `pm8916-lbc-chgr/online=1`,
+18 -4
View File
@@ -4,14 +4,28 @@ This file tracks public release builds of **Bananarchy Linux**.
Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`, followed by the two-digit month and day). Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`, followed by the two-digit month and day).
**Current device builds (`a1108` — codename `dejavu`)**: **Current device builds (`a1111` — codename `lennon`)**:
- **Nokia 8110 4G (`nokia-argon`)**: https://bananarchy.top/builds/bananarchy-nokia-argon-a1108-dejavu.zip - **Nokia 8110 4G (`nokia-argon`)**: https://bananarchy.top/builds/bananarchy-nokia-argon-a1111-lennon.zip
- **Nokia 2720 Flip (`nokia-beatles`)**: https://bananarchy.top/builds/bananarchy-nokia-beatles-a1111-lennon.zip
--- ---
## Unreleased ## Build `a1111` — codename `lennon` (2026-11-11)
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. This build contains all previously unreleased 2720 Flip (`nokia-beatles`) changes since `a1108`, strict per-device `lid-profile` isolation keeping `nokia-argon` on its pure `a1108` sliding-lid path, and fresh `a1111` / `lennon` images for both `nokia-argon` and `nokia-beatles`. The image and release metadata are generated by `scripts/version.sh` as `a1111` / `lennon`.
### Per-target `lid-profile` isolation for `nokia-argon` (`slider`) vs `nokia-beatles` (`flip`)
- **Audit findings**: auditing every change since `a1108` (`8448b6465f7f`) showed that `dwm` already isolates flip vs slider behaviour through `/usr/share/bananarchy/lid-profile` (`is_flip_profile()`), keeping exposed top-row keypad input, 60 ms `SW_LID` close locking (`HANGUP_CLOSE` + `locker screenoff`), and `SW_LID=0` / `SW_KEYPAD_SLIDE=1` wake-to-lockscreen identical to `a1108` when `lid-profile` is `slider`. However, `overlay/rootfs/usr/share/bananarchy/lid-profile` was hardcoded to `flip`, `etc/runlevels/default/bananarchy-{lid,cover-display,volume-keys}` and mux `modules-load.d` entries were left enabled on non-flip builds, `bananarchy-x11-session.sh` sent `Escape` 3 s after boot even when `/tmp/bananarchy_screen_locked` was set (which blanks an active `xlocker` on `nokia-argon`), and `bananarchy-display-power-sync`, `locker.so`, and `callscreen.so` checked `/run/bananarchy/lid-state` without checking `lid-profile`.
- **Switch**: `scripts/apply-bananarchy-overlay.sh` now writes `/usr/share/bananarchy/lid-profile` per target (`slider` on `nokia-argon`, `flip` on `nokia-beatles`, `none` on `nokia-tough`/`nokia-sparkler`/`nokia-leo`), removes stale top-level `/boot/qcom-*.dtb` files when switching targets, and strips `etc/runlevels/default/bananarchy-{lid,cover-display,volume-keys}`, `72-nokia-beatles-cover.rules`, `cover-display.conf`, and `spidev`/`mux-*`/`spi-mux` module loads on non-flip targets. `10-bananarchy-hardware.start`, the `bananarchy-lid` / `bananarchy-volume-keys` / `bananarchy-cover-display` init scripts, and the compiled `bananarchy-lid`, `bananarchy-volume-keys`, and `bananarchy-cover-idle` C daemons (`is_non_flip_profile()`) exit `0` immediately on `slider`/`none` profiles. `bananarchy-x11-session.sh` skips its 3 s stale-grab `Escape` cleanup while `/tmp/bananarchy_screen_locked` exists, `bananarchy-display-power-sync` fast-paths non-flip devices to pure single-panel DPMS + `schedutil` sync, and `locker.so` / `callscreen.so` gate `/run/bananarchy/lid-state` checks on `lid-profile == "flip"`.
- **Image persistence**: rebuilt both `images/bananarchy-nokia-argon.img` (SHA-256 `a93f0dc5a87d30b9084fcc8df97c78e7496ca1564e4855efe12e4696387a7d4d`) and `images/bananarchy-nokia-beatles.img` (SHA-256 `7e1a24270e25beedcbc92b3fc8b7f2b314e3c7a9bf7a8e2dbffae1754d1b74c7`, with standalone `images/boot-bananarchy-nokia-beatles.img` SHA-256 `4b190404e8e9b53955a87ff211e0f706e51d08e4df11689cfa5586422e65763d` and unchanged display lk2nd `b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d`) at `a1111` / `lennon` with `--mkinitfs`, pinned in `scripts/check-rebuild.sh`. `e2fsck -fn` and `debugfs` verified both partitions of both images (`lid-profile = slider` with zero flip services/rules/configs on `nokia-argon`; `lid-profile = flip` with full cover/lid stack on `nokia-beatles`).
### Active-high shared cover backlight, active-black internal isolation and shared blank timeout
- **Root cause**: disassembling the stock KaiOS 3.10 `nokia-beatles` kernel (`mdss_spi_panel_pwm_cfg`, `mdss_spi_panel_bl_ctrl_update`) and `mpp@a100` DT node confirmed that both GC9305 controllers share one active-high PMIC `MPP2` PWM channel (`qcom,invert = <0>`). Setting `kernel_backlight_invert = 1` held `brightness = 0` (`duty = 0 ns`) when `visible = 1`, keeping the cover dark once `dwm` stopped pulsing brightness on side-button wakes. Meanwhile, because the internal `240x320` TN panel is normally-white (`0V` pixel drive = transmissive white) while the external `240x240` panel is normally-black, resetting the internal controller behind `gpio13 = 1` or sending `DISPOFF`/`SLPIN` (`0x28`/`0x10`) stopped `int_te` scanning and made the internal screen glow white whenever the shared backlight turned on. In addition, Xorg/Glamor (`framebuffer[40]`) could overwrite raw `/dev/fb0` cover pixels, `dwm` lacked `SW_LID` synchronization with the hall sensor, `sxmo_state.sh` leaked `flock` FD `3` into background children, and `render_frame()` used fixed X offsets instead of true pixel centering on `240x240`.
- **Switch**: `cover-display.conf` and `bananarchy-cover-idle` now ship `kernel_backlight_invert = 0` and `kernel_internal_sleep = 0`. On a closed-flip `BUTTON`/`WAKE`, `bananarchy-cover-idle` publishes `/run/bananarchy/cover-backlight` = `0` (holding `DPMS On` with `brightness = 0, bl_power = 4` in `bananarchy-display-power-sync` so udev never flashes the backlight during GRAM prep), maps a `240x320` `override_redirect` black X11 window (`cover_win`) with a keyboard grab, clears `/dev/fb0` while `gpio13 = 0` so the internal GC9305 stays in `DISPON` actively scanning opaque `0x0000` black from its SRAM, switches `gpio13 = 1`, resets and initializes the external GC9305, presents pixel-centered `240x240` header/clock/date text (`frame_text_centered`), and writes `marker = 1` with `brightness = 14, bl_power = 0`. When `BLANK` fires after the dynamically reloaded **Config -> Screen blank** timeout (`~/.config/sxmo/idle_blank_timeout` and `sxmo.noidle`, shared with `dwm` via `bananarchy-idle-timeout.sh`), both panels receive `0x28` + `120 ms` + `0x10`, `marker` is removed, `gpio13` parks low, and `DPMS Off` disables `l17`/`l6`. `bananarchy-lid` mirrors the hall state onto `SW_LID` (`sync_sw_lid`) and self-heals closed dark state (`enforce_closed_dark`); `bananarchy-cover-idle` cross-checks `/run/bananarchy/lid-state` (`authoritative_lid_closed`), filters spurious `WAKE` within `450 ms` of close, and writes `/run/bananarchy/cover-runtime.conf` for runtime `SET` overrides; `locker.so`, `callscreen.so`, `sxmo_wm.sh`, `sxmo_state.sh` (closing FD `3` via `3<&-`), and `sxmo_hook_inputhandler.sh` respect closed-lid cover ownership.
- **Live verification**: dual-TE probing on `172.16.42.1` confirmed concurrent self-refresh (`ext_te` and `int_te` both active while `gpio13 = high, br = 14, bl_power = 0, dpms = On, duty = 100000 ns`) across `LID CLOSED` rebroadcasts and 1 s Xorg repaints, returning cleanly to `br = 0, bl_power = 4, dpms = Off, ext_te = 0, int_te = 0` on `BLANK`. Physical eyes-on testing on the Nokia 2720 Flip confirmed closed dark idle, outer side-button wake with centered `240x240` UI and a completely dark internal panel, shared **Config -> Screen blank** timeout, and clean open/close transitions to the passcode lockscreen.
- **Image persistence**: initially verified in `images/bananarchy-nokia-beatles.img` (`f713fa4c79f18b0a7414222c4fc47acbacff1f84b94957c14eec43a52264d1d7`), superseded by the dual-target `a1111` / `lennon` rebuild above.
### Bounded DPMS helper and final flicker fix ### Bounded DPMS helper and final flicker fix
+3 -3
View File
@@ -2,7 +2,7 @@
![Bananarchy Banner](artwork/banner-800x240.png) ![Bananarchy Banner](artwork/banner-800x240.png)
This manual covers flashing, operating, and customizing **Bananarchy Linux** (`240x320` native edition) on **Qualcomm MSM8905 and MSM8909** Nokia feature phones. Current release: `a1108` (codename `dejavu`); see the [changelog](./CHANGELOG.md) for release notes. This manual covers flashing, operating, and customizing **Bananarchy Linux** (`240x320` native edition) on **Qualcomm MSM8905 and MSM8909** Nokia feature phones. Current release: `a1111` (codename `lennon`); see the [changelog](./CHANGELOG.md) for release notes.
- **Nokia 8110 4G (`nokia-argon`)** - **Nokia 8110 4G (`nokia-argon`)**
- **Nokia 2720 Flip (`nokia-beatles`)** - **Nokia 2720 Flip (`nokia-beatles`)**
- **Nokia 800 Tough (`nokia-tough` / `nokia-coconut`)** - **Nokia 800 Tough (`nokia-tough` / `nokia-coconut`)**
@@ -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`. - **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'`. - **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` keeps a sticky hall reading, re-reads gpio36/gpio92 immediately on every `EV_SW` edge, and uses a 20 ms debounce/loop. On close it writes `/run/bananarchy/lid-state`, `/tmp/bananarchy_screen_locked`, `sxmo.state`, both backlights and DPMS synchronously before spawning any hook, then runs `sxmo_state.sh set screenoff` through a generation-guarded wrapper. On open it releases the cover's shared SPI bus, restores the main panel and **keeps the desktop locked**: it writes state `lock`, sends `LOCK` to `locker.so` and runs `sxmo_state.sh set lock`, so the passcode lockscreen appears instead of an auto-unlocked desktop. A close is ~45-90 ms and an open ~10-130 ms. `bananarchy-lid-state.sh` drops stale hook spawns by lid state and generation. Check `rc-service bananarchy-lid status`, `sxmo_state.sh get`, `/tmp/bananarchy_screen_locked` and `grep -E " gpio(36|92) " /sys/kernel/debug/gpio`. If the hall polarity is inverted, set `BANANARCHY_LID_GPIO_FILE` to a different debugfs GPIO file. - **Closing the flip**: `bananarchy-lid` keeps a sticky hall reading, re-reads gpio36/gpio92 immediately on every `EV_SW` edge, and uses a 20 ms debounce/loop. On close it writes `/run/bananarchy/lid-state`, `/tmp/bananarchy_screen_locked`, `sxmo.state`, both backlights and DPMS synchronously before spawning any hook, then runs `sxmo_state.sh set screenoff` through a generation-guarded wrapper. On open it releases the cover's shared SPI bus, restores the main panel and **keeps the desktop locked**: it writes state `lock`, sends `LOCK` to `locker.so` and runs `sxmo_state.sh set lock`, so the passcode lockscreen appears instead of an auto-unlocked desktop. A close is ~45-90 ms and an open ~10-130 ms. `bananarchy-lid-state.sh` drops stale hook spawns by lid state and generation. Check `rc-service bananarchy-lid status`, `sxmo_state.sh get`, `/tmp/bananarchy_screen_locked` and `grep -E " gpio(36|92) " /sys/kernel/debug/gpio`. If the hall polarity is inverted, set `BANANARCHY_LID_GPIO_FILE` to a different debugfs GPIO file.
- **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`, `PROBE`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip open the daemon does not touch the shared QUP5 SPI bus; initial closed-flip activation still requires `card0-SPI-1/dpms = Off`. The shipping single-panel DTB uses `backend = kernel`: the KaiOS 3.10 DTS shows that the two GC9305s share CS0, gpio110 D/C and one PWM backlight, while gpio13 selects the panel, gpio23 is the external reset and gpio21 is TE. A live TE scan proved gpio13 high = cover and low = internal. On a closed-flip button event the daemon claims gpio13/gpio23, pulses reset, replays the exact vendor 240x240 init through `/sys/kernel/debug/dri/0/command`, and flushes a 240x240 `/dev/fb0` damage rect once per second. The shared PWM is active-low for the cover and active-high for the main panel: duty 0 lights the cover, duty 14 lights the internal panel. `/run/bananarchy/cover-backlight` contains `1` while the cover is lit and `0` while the cover owns the bus but is dark; `bananarchy-display-power-sync` holds the matching brightness, `bl_power` and DPMS state. `STATUS` reports `backend=kernel`, `mux=cover`; `BLANK` sends display-off and returns the external backlight to its OFF duty; `LID OPEN` restores gpio13 low, duty 14, `bl_power=0`, DPMS On and re-initialises the internal panel. The outer panel stays off until a trusted side-key `BUTTON` / `WAKE` arrives; it blanks after the same **Config -> Screen blank** timeout (`blank_timeout = auto`). The legacy `spidev`, 8/9-bit, `PROBE`, `SET mux_closed_level 0|1`, `SET kernel_backlight_invert 0|1` and `SET backend none` paths remain for rollback. `bananarchy-cover-diagnose.sh` reports the debugfs hook, backlight marker, GPIO lines, DPMS, firmware and daemon state. `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py`, `scripts/test-cover-kernel.py`, `scripts/test-cover-dt.py` and `scripts/test-lid-gate.py` guard the state machine, both backends, DT layouts and lid gate on the host. The opt-in two-panel `spi-mux` DT remains experimental because its separate gpio21 D/C wiring contradicts the vendor DTS and a live test darkened the main panel; `scripts/build-beatles-no-cover-dtb.py` builds the shipping rollback DTB. - **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`, `PROBE`); the native `bananarchy-coverd` is retained only for diagnostics. With the flip open the daemon does not touch the shared QUP5 SPI bus; initial closed-flip activation requires `card0-SPI-1/dpms = Off`. The shipping single-panel DTB uses `backend = kernel`: the KaiOS 3.10 DTS and kernel driver show that the two GC9305s share CS0, gpio110 D/C and one active-high PMIC MPP2 PWM backlight (`kernel_backlight_invert = 0`, `kernel_backlight_level = 14`), while gpio13 selects the panel (high = cover, low = internal), gpio23 is the external reset and gpio21 is TE. Because the internal 240x320 TN panel is normally-white while the external 240x240 panel is normally-black, a closed-flip button event wakes DRM with gpio13 low, paints an X11 `override_redirect` cover window and `/dev/fb0` solid black while leaving the internal GC9305 scanning black GRAM (`kernel_internal_sleep = 0`) so it blocks the shared backlight, switches gpio13 high, pulses gpio23, replays the exact vendor 240x240 init through `/sys/kernel/debug/dri/0/command`, and presents a centered 240x240 clock/date/status frame once per second. `/run/bananarchy/cover-backlight` contains `0` during dark GRAM preparation, `1` while the cover is lit, and is unlinked when dark; `bananarchy-display-power-sync` holds the matching brightness, `bl_power` and DPMS state (honouring `/run/bananarchy/cover-runtime.conf` for runtime `SET` overrides). `STATUS` reports `backend=kernel`, `mux=cover`; `BLANK` turns the shared backlight off, sleeps both controllers, parks gpio13 low and forces DPMS Off; `LID OPEN` sleeps the external panel, restores gpio13 low, brightness 14, `bl_power=0`, DPMS On and re-initialises the internal panel to the passcode lockscreen. The outer panel stays off until a trusted side-key `BUTTON` / `WAKE` arrives, and blanks dynamically after the same **Config -> Screen blank** timeout (`blank_timeout = auto`, reading `~/.config/sxmo/idle_blank_timeout` and `sxmo.noidle`). The legacy `spidev`, 8/9-bit, `PROBE`, `SET mux_closed_level 0|1`, `SET kernel_backlight_invert 0|1`, `SET kernel_internal_sleep 0|1` and `SET backend none` paths remain for rollback. `bananarchy-cover-diagnose.sh` reports the debugfs hook, backlight marker, GPIO lines, DPMS, firmware and daemon state. `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py`, `scripts/test-cover-kernel.py`, `scripts/test-cover-dt.py` and `scripts/test-lid-gate.py` guard the state machine, both backends, DT layouts and lid gate on the host. The opt-in two-panel `spi-mux` DT remains experimental because its separate gpio21 D/C wiring contradicts the vendor DTS and a live test darkened the main panel; `scripts/build-beatles-no-cover-dtb.py` builds the shipping rollback DTB.
- **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 <file>` should write a 600x800 JPEG. - **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 <file>` 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). - **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).
@@ -674,4 +674,4 @@ The bootstrap is idempotent: an up-to-date rootfs is left untouched. `prebuilt/`
## Verified 2720 Flip image set ## Verified 2720 Flip image set
For the `a1108` / `dejavu` release, use the verified `nokia-beatles` raw image, standalone boot image, and display-enabled lk2nd image generated in `images/`. These files are local build outputs and are not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present. `scripts/set-bananarchy-hostname.sh` gives every image its target codename as the default hostname, and the display lk2nd image now requires the low-bit reboot cookie so **Reboot to loader** reaches the visible Fastboot menu. The default `147147` unlock passcode remains provisioned with the locker path unchanged. The X session performs a one-shot startup cleanup of stale `dmenu` and xlocker keyboard grabs, while `dwm` keeps the known-good 350 ms wake guard. `prepare-release.sh` rebuilds missing images from source and packages them; use `BA_REBUILD=1` for a forced source rebuild. For the `a1111` / `lennon` release, use the verified `nokia-argon` and `nokia-beatles` raw images, plus the standalone boot image and display-enabled lk2nd image generated in `images/`. These files are local build outputs and are not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present. `scripts/set-bananarchy-hostname.sh` gives every image its target codename as the default hostname, `scripts/apply-bananarchy-overlay.sh` writes `/usr/share/bananarchy/lid-profile` per target (`slider` on `nokia-argon`, `flip` on `nokia-beatles`, `none` on candybar targets) so flip-only daemons stay disabled on non-flip devices, and the display lk2nd image requires the low-bit reboot cookie so **Reboot to loader** reaches the visible Fastboot menu. The default `147147` unlock passcode remains provisioned with the locker path unchanged. The X session performs a one-shot startup cleanup of stale `dmenu` and xlocker keyboard grabs when unlocked, while `dwm` keeps the known-good 350 ms wake guard. `prepare-release.sh` rebuilds missing images from source and packages them; use `BA_REBUILD=1` for a forced source rebuild.
+6 -5
View File
@@ -4,9 +4,10 @@
**Bananarchy** is a keypad-first Linux distribution hardforked from postmarketOS (`v26.06` / Alpine `edge` `armv7`), built for **Qualcomm MSM8905 (Snapdragon 205)** and **Qualcomm MSM8909 (Snapdragon 210)** smart feature phones with **240x320 QVGA non-touch displays** and **physical 12-key T9 keypads**. **Bananarchy** is a keypad-first Linux distribution hardforked from postmarketOS (`v26.06` / Alpine `edge` `armv7`), built for **Qualcomm MSM8905 (Snapdragon 205)** and **Qualcomm MSM8909 (Snapdragon 210)** smart feature phones with **240x320 QVGA non-touch displays** and **physical 12-key T9 keypads**.
- **Current public release**: `a1108` (codename `dejavu`) — see the [changelog](./CHANGELOG.md) for release notes. - **Current public release**: `a1111` (codename `lennon`) — see the [changelog](./CHANGELOG.md) for release notes.
- **Device builds (`a1108` — codename `dejavu`)**: - **Device builds (`a1111` — codename `lennon`)**:
- **Nokia 8110 4G (`nokia-argon`)**: https://bananarchy.top/builds/bananarchy-nokia-argon-a1108-dejavu.zip - **Nokia 8110 4G (`nokia-argon`)**: https://bananarchy.top/builds/bananarchy-nokia-argon-a1111-lennon.zip
- **Nokia 2720 Flip (`nokia-beatles`)**: https://bananarchy.top/builds/bananarchy-nokia-beatles-a1111-lennon.zip
- **Project philosophy**: read [The Bananarchy Manifesto](./MANIFESTO.md) for the background and goals behind the distribution. - **Project philosophy**: read [The Bananarchy Manifesto](./MANIFESTO.md) for the background and goals behind the distribution.
- **User and flashing guide**: see the [user manual](./MANUAL.md) for installation, keypad navigation, and hardware details. - **User and flashing guide**: see the [user manual](./MANUAL.md) for installation, keypad navigation, and hardware details.
- **UI and networking SDK reference**: see the [NeoUI and NeoNet SDK guide](./SDK.md) for building native C, C++, and Yabasic `240x320` GUI and networked applications. - **UI and networking SDK reference**: see the [NeoUI and NeoNet SDK guide](./SDK.md) for building native C, C++, and Yabasic `240x320` GUI and networked applications.
@@ -50,7 +51,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. - **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 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode), and a device-aware renderer profile: the 2720 Flip uses the WebKit CPU renderer (with automatic software fallback after a WebProcess crash) while the 8110 4G keeps Adreno 304 acceleration; `~/.config/sxmo/webarchy_software_renderer` forces the CPU profile on any target. The image build also compiles the installed GSettings schema XML into `usr/share/glib-2.0/schemas/gschemas.compiled`; without that database WebKit's network process aborts with an internal error before any renderer policy can help. - **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 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode), and a device-aware renderer profile: the 2720 Flip uses the WebKit CPU renderer (with automatic software fallback after a WebProcess crash) while the 8110 4G keeps Adreno 304 acceleration; `~/.config/sxmo/webarchy_software_renderer` forces the CPU profile on any target. The image build also compiles the installed GSettings schema XML into `usr/share/glib-2.0/schemas/gschemas.compiled`; without that database WebKit's network process aborts with an internal error before any renderer policy can help.
- **GPS-only system time**: **Config -> Time source** switches from NTP to GNSS only (stopping `chronyd` and disabling every network-up NTP burst) and **Config -> Sync GPS time** steps the clock from a ModemManager GPS UTC value or a valid RMC fix, writes the RTC and refreshes the status bar. All GPS queries now resolve the GNSS-capable modem through `bananarchy-gps-modem.sh` instead of the ambiguous `mmcli -m any`, which fixes empty GPS data on the dual-SIM 2720 Flip. See `MANUAL.md` sections 5.6 and 5.8. - **GPS-only system time**: **Config -> Time source** switches from NTP to GNSS only (stopping `chronyd` and disabling every network-up NTP burst) and **Config -> Sync GPS time** steps the clock from a ModemManager GPS UTC value or a valid RMC fix, writes the RTC and refreshes the status bar. All GPS queries now resolve the GNSS-capable modem through `bananarchy-gps-modem.sh` instead of the ambiguous `mmcli -m any`, which fixes empty GPS data on the dual-SIM 2720 Flip. See `MANUAL.md` sections 5.6 and 5.8.
- **2720 Flip cover display behaviour**: the compiled `bananarchy-cover-idle` renderer keeps the external panel fully off while the flip is open, waits for a side-button `BUTTON` event when closed, then shows the clock, battery and compact network indicators until the same **Config -> Screen blank** timeout expires. `bananarchy-volume-keys` turns all three outer keys into trusted cover wake events; `bananarchy-cover-status.sh` publishes modem/Wi-Fi indicators; and the daemon blocks in `poll()` with no timer while off. The shipping single-panel DTB drives the cover through the **kernel** `panel-mipi-dbi-spi` driver (`backend = kernel`). The KaiOS 3.10 DTS shows that both GC9305s share CS0, gpio110 D/C and one PWM backlight: gpio13 selects the panel, gpio23 is the external reset and gpio21 is TE. A live TE scan proved gpio13 high = cover and low = internal. While closed, the daemon claims gpio13/gpio23, pulses reset, replays the exact stock 240x240 init through the driver's `/sys/kernel/debug/dri/0/command` hook, and flushes a 240x240 `/dev/fb0` damage rect once per second so Xorg repaints cannot erase it. The shared PWM is **active-low for the cover and active-high for the main panel**: duty 0 lights the cover, duty 14 lights the internal panel. `/run/bananarchy/cover-backlight` contains `1` while the cover is lit and `0` while the cover owns the bus but is dark; `bananarchy-display-power-sync` uses it to hold the correct duty and DPMS state instead of forcing brightness 0. The keypad stays dark. Opening the flip restores gpio13 low, duty 14, `bl_power=0`, DPMS On and the internal panel. `bananarchy-lid-gate.sh` still blocks every main-panel wake while closed and forwards it as a cover `WAKE`. The legacy `spidev`, 8/9-bit, `PROBE` and `SET backend none` rollback paths remain; `SET kernel_backlight_invert 0|1` switches the active-low assumption if a unit differs. `bananarchy-cover-diagnose.sh` reports the debugfs hook, backlight marker, GPIO lines and daemon state; `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py`, `scripts/test-cover-kernel.py`, `scripts/test-cover-dt.py` and `scripts/test-lid-gate.py` validate the renderer, both backends, DT layouts and lid gate on the host. The opt-in two-panel `spi-mux` DT remains experimental because its separate gpio21 D/C wiring contradicts the vendor DTS and a live test darkened the main panel. - **2720 Flip cover display behaviour**: the compiled `bananarchy-cover-idle` renderer keeps the external panel fully off while the flip is open, waits for a side-button `BUTTON` event when closed, then shows the centered `240x240` clock, date, battery and compact network indicators until the same **Config -> Screen blank** timeout (`~/.config/sxmo/idle_blank_timeout` and `sxmo.noidle`, reloaded live) expires. `bananarchy-volume-keys` turns the outer keys into trusted cover wake events; `bananarchy-lid` mirrors the hall sensor onto `SW_LID` so `dwm` tracks the closed state accurately; `bananarchy-cover-status.sh` publishes modem/Wi-Fi indicators; and the daemon blocks in `poll()` with no timer while off. The shipping single-panel DTB drives the cover through the **kernel** `panel-mipi-dbi-spi` driver (`backend = kernel`). The KaiOS 3.10 DTS and kernel driver show that both GC9305s share CS0, gpio110 D/C and one active-high PMIC MPP2 PWM backlight (`kernel_backlight_invert = 0`, `kernel_backlight_level = 14`), while gpio13 selects the panel (high = cover, low = internal), gpio23 is the external reset and gpio21 is TE. Because the internal `240x320` TN panel is normally-white while the external `240x240` panel is normally-black, waking the cover first paints Xorg's `override_redirect` cover window and `/dev/fb0` solid black while gpio13 is low and leaves the internal GC9305 scanning black GRAM (`kernel_internal_sleep = 0`) so it stays completely dark when the shared backlight turns on; the daemon then switches gpio13 high, pulses gpio23, replays the stock 240x240 init through `/sys/kernel/debug/dri/0/command`, and presents the centered `240x240` UI once per second. `/run/bananarchy/cover-backlight` contains `0` during dark GRAM preparation, `1` while the cover is lit, and is removed when blanked so DPMS Off powers down the panel rails; `bananarchy-display-power-sync` keeps brightness, `bl_power` and DPMS synchronized while the keypad stays dark. Opening the flip sleeps the external panel, restores gpio13 low, brightness 14, `bl_power=0`, DPMS On and wakes to the passcode lockscreen. `bananarchy-lid-gate.sh` blocks every main-panel wake while closed and forwards it as a cover `WAKE`. The legacy `spidev`, 8/9-bit, `PROBE` and `SET backend none` rollback paths remain, along with `SET kernel_backlight_invert 0|1` and `SET kernel_internal_sleep 0|1`. `bananarchy-cover-diagnose.sh` reports the debugfs hook, backlight marker, GPIO lines and daemon state; `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py`, `scripts/test-cover-kernel.py`, `scripts/test-cover-dt.py` and `scripts/test-lid-gate.py` validate the renderer, both backends, DT layouts and lid gate on the host. The opt-in two-panel `spi-mux` DT remains experimental because its separate gpio21 D/C wiring contradicts the vendor DTS and a live test darkened the main panel.
- **GPS reception test utility (`bananarchy-gps`) and OpenStreetMap navigator (`xgps` / `xmaps` / `xnav` / `gps.so`)**: CLI GNSS/GPS diagnostic tool (`bananarchy-gps status|enable|disable|nmea|watch`) and 3-tab NeoUI GPS navigator (`1:GPS Status`, `2:OSM Map`, `3:Nav/Search`) with live NMEA/QMI PDS satellite and 3GPP cell telemetry, interactive `240x212` OpenStreetMap slippy-map tile viewer with offline PNG tile cache (`~/.cache/sxmo/osm_tiles/`), Nominatim place search, saved waypoints, and OSRM turn-by-turn route geometry and step navigation. - **GPS reception test utility (`bananarchy-gps`) and OpenStreetMap navigator (`xgps` / `xmaps` / `xnav` / `gps.so`)**: CLI GNSS/GPS diagnostic tool (`bananarchy-gps status|enable|disable|nmea|watch`) and 3-tab NeoUI GPS navigator (`1:GPS Status`, `2:OSM Map`, `3:Nav/Search`) with live NMEA/QMI PDS satellite and 3GPP cell telemetry, interactive `240x212` OpenStreetMap slippy-map tile viewer with offline PNG tile cache (`~/.cache/sxmo/osm_tiles/`), Nominatim place search, saved waypoints, and OSRM turn-by-turn route geometry and step navigation.
- **Themes (`xthemes`), wallpapers (`xwallpapers`), and ringtones (`xringtones`)**: installable `.Xresources` color and font themes (`~/.xthemes/*.xth`, 21 preinstalled schemes including `LynxLair.xth`) with live zero-restart reload across the entire UI, `dunst` notification popups (`bananarchy-sync-dunst-theme`), and terminal, alongside dedicated managers for desktop wallpapers and 3-tab call ringtones & notification/SMS alerts (`1:Ringtone`, `2:Notif/SMS`, `3:Settings`, supporting standard audio, tracker modules, and Nokia RTTTL `.nrt`/`.rtttl`/`.rtx`, Ericsson eMelody `.emy`, and IrDA iMelody `.imy` monophonic ringtones via `/usr/bin/bananarchy-melody`, wired into `sxmo_notifs.sh` and `sxmo_hook_notification.sh`) with 3-level vibration control. - **Themes (`xthemes`), wallpapers (`xwallpapers`), and ringtones (`xringtones`)**: installable `.Xresources` color and font themes (`~/.xthemes/*.xth`, 21 preinstalled schemes including `LynxLair.xth`) with live zero-restart reload across the entire UI, `dunst` notification popups (`bananarchy-sync-dunst-theme`), and terminal, alongside dedicated managers for desktop wallpapers and 3-tab call ringtones & notification/SMS alerts (`1:Ringtone`, `2:Notif/SMS`, `3:Settings`, supporting standard audio, tracker modules, and Nokia RTTTL `.nrt`/`.rtttl`/`.rtx`, Ericsson eMelody `.emy`, and IrDA iMelody `.imy` monophonic ringtones via `/usr/bin/bananarchy-melody`, wired into `sxmo_notifs.sh` and `sxmo_hook_notification.sh`) with 3-level vibration control.
@@ -215,4 +216,4 @@ Alpine Linux, postmarketOS/Nura, and other third-party components are guided by
## Verified 2720 Flip release images ## Verified 2720 Flip release images
The `a1108` / `dejavu` release packages the verified 2720 Flip image set: the raw `userdata` image, standalone mainline `boot.img`, and display-enabled lk2nd image. These are local build outputs, not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present, and `prepare-release.sh` rebuilds missing artifacts from source. The default hostname is the target codename, the Power menu's **Reboot to loader** uses the cookie-enabled lk2nd image, and the default `147147` unlock passcode remains provisioned with the locker path unchanged. `dwm` uses the known-good 350 ms wake guard, the X session releases stale startup keyboard grabs once, and `BA_REBUILD=1` forces an explicit rebuild. The `a1111` / `lennon` release packages the verified 2720 Flip image set: the raw `userdata` image, standalone mainline `boot.img`, and display-enabled lk2nd image. These are local build outputs, not tracked in git; `scripts/check-rebuild.sh` pins their hashes when present, and `prepare-release.sh` rebuilds missing artifacts from source. The default hostname is the target codename, the Power menu's **Reboot to loader** uses the cookie-enabled lk2nd image, and the default `147147` unlock passcode remains provisioned with the locker path unchanged. `dwm` uses the known-good 350 ms wake guard, the X session releases stale startup keyboard grabs once, and `BA_REBUILD=1` forces an explicit rebuild.
@@ -3,18 +3,18 @@
# /home/user/.config/bananarchy/cover-display.conf and are applied by # /home/user/.config/bananarchy/cover-display.conf and are applied by
# the xcover DWM plugin at session start. # the xcover DWM plugin at session start.
# kernel = the default shipping path. The KaiOS 3.10 DTS shows that both # kernel = the default shipping path. The KaiOS 3.10 DTS and kernel driver show
# GC9305s share CS0, gpio110 D/C and one PMIC PWM backlight; gpio13 selects # that both GC9305s share CS0, gpio110 D/C and one active-high PMIC MPP2 PWM
# the panel, gpio23 is the external reset, and gpio21 is TE. While the flip is # backlight; gpio13 selects the panel, gpio23 is the external reset, and gpio21
# closed the daemon claims gpio13/gpio23, pulses reset, replays the stock # is TE. While the flip is closed and lit, the daemon wakes DRM with gpio13 low,
# 240x240 init through the kernel driver's debugfs command hook, and flushes a # clears the normally-white internal 240x320 panel to solid black in DISPON so
# 240x240 /dev/fb0 damage rect. Live probing showed the shared PWM is # it blocks the shared backlight, switches gpio13 high, pulses gpio23, replays
# active-low for the cover and active-high for the main panel: duty 0 lights # the stock 240x240 init through the kernel driver's debugfs command hook, and
# the cover, duty 14 lights the internal panel. The marker tells # flushes a 240x240 /dev/fb0 damage rect. While dark, both panels sleep and
# bananarchy-display-power-sync which side owns the bus. Opening the flip # DPMS Off powers down the panel regulators. Opening the flip restores gpio13
# restores the mux, normal brightness and the internal panel. auto = /dev/fb1 # low, normal brightness and the internal panel. auto = /dev/fb1 with the
# with the opt-in two-panel DT, otherwise spidev; fb/spidev force those legacy # opt-in two-panel DT, otherwise spidev; fb/spidev force those legacy paths;
# paths; none keeps the bus untouched. # none keeps the bus untouched.
backend = kernel backend = kernel
main_fb_device = /dev/fb0 main_fb_device = /dev/fb0
kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh
@@ -23,10 +23,12 @@ kernel_command_path = /sys/kernel/debug/dri/0/command
kernel_backlight_path = /sys/class/backlight/backlight/brightness kernel_backlight_path = /sys/class/backlight/backlight/brightness
kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power
kernel_backlight_marker = /run/bananarchy/cover-backlight kernel_backlight_marker = /run/bananarchy/cover-backlight
# 14 is the normal internal-panel level and also the external-panel OFF duty. # 14 is the normal active-high PWM brightness for whichever panel is lit.
kernel_backlight_level = 14 kernel_backlight_level = 14
# 1 = external backlight active-low (duty 0 ON), 0 = active-high. # 0 = shared PMIC MPP2 backlight active-high (stock 2720 Flip), 1 = active-low.
kernel_backlight_invert = 1 kernel_backlight_invert = 0
# 0 = keep internal normally-white GC9305 scanning black GRAM while cover is lit.
kernel_internal_sleep = 0
fb_device = /dev/fb1 fb_device = /dev/fb1
spidev_device = /dev/spidev0.1 spidev_device = /dev/spidev0.1
gpiochip_device = /dev/gpiochip0 gpiochip_device = /dev/gpiochip0
@@ -25,8 +25,10 @@ start_pre() {
mkdir -p /run/bananarchy mkdir -p /run/bananarchy
chmod 0755 /run/bananarchy chmod 0755 /run/bananarchy
# /run is tmpfs: clear stale transition guards after every reboot. # /run is tmpfs: clear stale transition guards after every reboot.
rm -f /run/bananarchy/cover-bl-force \ rm -f /run/bananarchy/cover-backlight \
/run/bananarchy/cover-power-state 2>/dev/null || true /run/bananarchy/cover-bl-force \
/run/bananarchy/cover-power-state \
/run/bananarchy/cover-runtime.conf 2>/dev/null || true
} }
start() { start() {
+9
View File
@@ -12,3 +12,12 @@ depend() {
after udev-settle after udev-settle
before bananarchy-cover-display tinydm before bananarchy-cover-display tinydm
} }
start() {
if [ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" != "flip" ]; then
ebegin "Skipping flip lid handler (not a flip device)"
eend 0
return 0
fi
default_start
}
@@ -11,3 +11,12 @@ depend() {
need udev need udev
after udev-settle after udev-settle
} }
start() {
if [ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" != "flip" ]; then
ebegin "Skipping side volume keys (not a flip device)"
eend 0
return 0
fi
default_start
}
@@ -3,7 +3,11 @@
# the spi-mux modules are loaded even when the boot-runlevel "modules" service # the spi-mux modules are loaded even when the boot-runlevel "modules" service
# could not process /etc/modules (it needs /bin/sed, which was missing on some # could not process /etc/modules (it needs /bin/sed, which was missing on some
# rootfs builds). # rootfs builds).
for mod in msm8905-cam spidev mux-core mux-gpio spi-mux; do HW_MODS="msm8905-cam"
if [ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" = "flip" ]; then
HW_MODS="$HW_MODS spidev mux-core mux-gpio spi-mux"
fi
for mod in $HW_MODS; do
i=0 i=0
while [ "$i" -lt 5 ]; do while [ "$i" -lt 5 ]; do
/sbin/modprobe -q "$mod" && break /sbin/modprobe -q "$mod" && break
@@ -9,6 +9,13 @@
ACTION="$1" ACTION="$1"
# A closed flip has no reachable keypad: external keys, wake gestures and
# power-button events must only light the outer cover panel, never unlock the
# session or relight the main panel / keypad backlight.
if ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}" wake; then
exit 0
fi
# include common definitions # include common definitions
# shellcheck source=scripts/core/sxmo_common.sh # shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh . sxmo_common.sh
Binary file not shown.
@@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
# Keep DRM DPMS and the schedutil rate limit in sync with the backlight state. # Keep DRM DPMS and the schedutil rate limit in sync with the backlight state.
# Invoked by the backlight udev rule (as root) and by sxmo_wm.sh display on # Invoked by the backlight udev rule (as root) and by sxmo_wm.sh display on
# (via doas). The 2720 Flip shares one PWM backlight between both panels: # (via doas). The 2720 Flip shares one active-high PMIC MPP2 PWM backlight
# it is active-low for the cover and active-high for the main panel. # between both panels; /run/bananarchy/cover-backlight marks cover ownership
# ("0" = preparing GRAM with backlight dark, "1" = cover lit).
# #
# The daemon calls this helper with "force" only on a real cover-state # The daemon calls this helper with "force" only on a real cover-state
# transition. Plain udev events are idempotent and must never toggle bl_power, # transition. Plain udev events are idempotent and must never toggle bl_power,
@@ -16,10 +17,12 @@ RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
COVER_MARKER=/run/bananarchy/cover-backlight COVER_MARKER=/run/bananarchy/cover-backlight
FORCE_MARKER=/run/bananarchy/cover-bl-force FORCE_MARKER=/run/bananarchy/cover-bl-force
STATE_CACHE=/run/bananarchy/cover-power-state STATE_CACHE=/run/bananarchy/cover-power-state
LID_PROFILE="${BANANARCHY_LID_PROFILE:-/usr/share/bananarchy/lid-profile}"
LID_STATE=/run/bananarchy/lid-state LID_STATE=/run/bananarchy/lid-state
CONF=/etc/bananarchy/cover-display.conf CONF=/etc/bananarchy/cover-display.conf
RUNTIME_CONF=/run/bananarchy/cover-runtime.conf
COVER_BL_LEVEL=14 COVER_BL_LEVEL=14
COVER_BL_INVERT=1 COVER_BL_INVERT=0
FORCE=0 FORCE=0
[ "${1:-}" = "force" ] && FORCE=1 [ "${1:-}" = "force" ] && FORCE=1
@@ -29,12 +32,14 @@ if [ "$FORCE" -eq 0 ] && [ -f "$FORCE_MARKER" ]; then
exit 0 exit 0
fi fi
if [ -r "$CONF" ]; then for _cfg in "$CONF" "$RUNTIME_CONF"; do
_level=$(awk -F= '/^[[:space:]]*kernel_backlight_level[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$CONF" 2>/dev/null) if [ -r "$_cfg" ]; then
case "${_level:-}" in ''|*[!0-9]*) ;; *) COVER_BL_LEVEL="$_level" ;; esac _level=$(awk -F= '/^[[:space:]]*kernel_backlight_level[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$_cfg" 2>/dev/null)
_invert=$(awk -F= '/^[[:space:]]*kernel_backlight_invert[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$CONF" 2>/dev/null) case "${_level:-}" in ''|*[!0-9]*) ;; *) COVER_BL_LEVEL="$_level" ;; esac
case "${_invert:-}" in 0|1) COVER_BL_INVERT="$_invert" ;; esac _invert=$(awk -F= '/^[[:space:]]*kernel_backlight_invert[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$_cfg" 2>/dev/null)
fi case "${_invert:-}" in 0|1) COVER_BL_INVERT="$_invert" ;; esac
fi
done
DPMS_PATH= DPMS_PATH=
for _dpms in /sys/class/drm/card*-*/dpms; do for _dpms in /sys/class/drm/card*-*/dpms; do
@@ -44,7 +49,9 @@ done
read_value() { read_value() {
_path="$1" _path="$1"
_value="" _value=""
[ -r "$_path" ] && { read -r _value < "$_path" 2>/dev/null || _value=""; } if [ -r "$_path" ]; then
IFS= read -r _value < "$_path" 2>/dev/null || [ -n "$_value" ] || _value=""
fi
printf '%s' "$_value" printf '%s' "$_value"
} }
@@ -69,20 +76,37 @@ force_dpms() {
br="$(read_value "$BR_PATH")" br="$(read_value "$BR_PATH")"
case "$br" in ''|*[!0-9]*) br=1 ;; esac case "$br" in ''|*[!0-9]*) br=1 ;; esac
# Non-flip devices (e.g. nokia-argon slider) have a single panel with no cover
# display or shared backlight: sync DRM DPMS and schedutil directly.
if [ "$(read_value "$LID_PROFILE")" != "flip" ]; then
if [ "$br" -eq 0 ]; then
force_dpms "Off"
else
force_dpms "On"
if [ -w "$RL_PATH" ]; then
printf '40000\n' > "$RL_PATH" 2>/dev/null || true
fi
fi
exit 0
fi
blp="$(read_value "$BL_POWER_PATH")" blp="$(read_value "$BL_POWER_PATH")"
lid="$(read_value "$LID_STATE")" lid="$(read_value "$LID_STATE")"
HAD_MARKER=0
marker="" marker=""
[ -r "$COVER_MARKER" ] && marker="$(read_value "$COVER_MARKER")" if [ -e "$COVER_MARKER" ]; then
HAD_MARKER=1
[ -r "$COVER_MARKER" ] && marker="$(read_value "$COVER_MARKER")"
fi
if [ "$COVER_BL_INVERT" -eq 1 ]; then if [ "$COVER_BL_INVERT" -eq 1 ]; then
LIT_BR=0 LIT_BR=0
DARK_BR="$COVER_BL_LEVEL"
DARK_BLP=0
else else
LIT_BR="$COVER_BL_LEVEL" LIT_BR="$COVER_BL_LEVEL"
DARK_BR=0
DARK_BLP=4
fi fi
DARK_BR=0
DARK_BLP=4
DESIRED_BR="$br" DESIRED_BR="$br"
DESIRED_BLP="$blp" DESIRED_BLP="$blp"
@@ -91,27 +115,46 @@ DESIRED_KBD=""
DESIRED_KEY="normal" DESIRED_KEY="normal"
if [ "$lid" = "open" ]; then if [ "$lid" = "open" ]; then
DESIRED_KEY="open:$COVER_BL_LEVEL:0:On:absent:$COVER_BL_INVERT" rm -f "$COVER_MARKER" 2>/dev/null || true
DESIRED_BR="$COVER_BL_LEVEL" if [ "$FORCE" -eq 1 ] || [ "$HAD_MARKER" -eq 1 ]; then
OPEN_BR="$br"
[ "$OPEN_BR" -gt 0 ] 2>/dev/null || OPEN_BR="$COVER_BL_LEVEL"
DESIRED_KEY="open:$OPEN_BR:0:On:absent:$COVER_BL_INVERT"
DESIRED_BR="$OPEN_BR"
DESIRED_BLP="0"
DESIRED_DPMS="On"
elif [ "$br" -eq 0 ]; then
DESIRED_BR="0"
DESIRED_BLP="4"
DESIRED_DPMS="Off"
DESIRED_KEY="open:0:4:Off:absent:$COVER_BL_INVERT"
else
DESIRED_BLP="0"
DESIRED_DPMS="On"
DESIRED_KEY="open:$br:0:On:absent:$COVER_BL_INVERT"
fi
elif [ "$marker" = "1" ]; then
DESIRED_KEY="lit:$LIT_BR:0:On:1:$COVER_BL_INVERT"
DESIRED_BR="$LIT_BR"
DESIRED_BLP="0" DESIRED_BLP="0"
DESIRED_DPMS="On" DESIRED_DPMS="On"
rm -f "$COVER_MARKER" 2>/dev/null || true
elif [ -f "$COVER_MARKER" ]; then
DESIRED_KBD="0" DESIRED_KBD="0"
elif [ "$marker" = "0" ]; then
DESIRED_KEY="prep:$DARK_BR:$DARK_BLP:On:0:$COVER_BL_INVERT"
DESIRED_BR="$DARK_BR"
DESIRED_BLP="$DARK_BLP"
DESIRED_DPMS="On" DESIRED_DPMS="On"
if [ "$marker" = "1" ]; then DESIRED_KBD="0"
DESIRED_KEY="lit:$LIT_BR:0:On:1:$COVER_BL_INVERT" elif [ "$lid" = "closed" ]; then
DESIRED_BR="$LIT_BR" DESIRED_KEY="dark:$DARK_BR:$DARK_BLP:Off:absent:$COVER_BL_INVERT"
DESIRED_BLP="0" DESIRED_BR="$DARK_BR"
else DESIRED_BLP="$DARK_BLP"
DESIRED_KEY="dark:$DARK_BR:$DARK_BLP:On:0:$COVER_BL_INVERT" DESIRED_DPMS="Off"
DESIRED_BR="$DARK_BR" DESIRED_KBD="0"
DESIRED_BLP="$DARK_BLP"
fi
elif ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then elif ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then
DESIRED_KEY="closed:0:4:Off:absent:$COVER_BL_INVERT" DESIRED_KEY="closed:$DARK_BR:$DARK_BLP:Off:absent:$COVER_BL_INVERT"
DESIRED_BR="0" DESIRED_BR="$DARK_BR"
DESIRED_BLP="4" DESIRED_BLP="$DARK_BLP"
DESIRED_DPMS="Off" DESIRED_DPMS="Off"
DESIRED_KBD="0" DESIRED_KBD="0"
else else
@@ -124,9 +167,9 @@ if [ "$FORCE" -eq 1 ]; then
printf '1\n' > "$FORCE_MARKER" 2>/dev/null || true printf '1\n' > "$FORCE_MARKER" 2>/dev/null || true
trap cleanup_force EXIT INT TERM HUP trap cleanup_force EXIT INT TERM HUP
set_if_changed "$BL_POWER_PATH" "4" set_if_changed "$BL_POWER_PATH" "4"
set_if_changed "$BR_PATH" "$DESIRED_BR" printf '%s\n' "$DESIRED_BR" > "$BR_PATH" 2>/dev/null || true
set_if_changed "$BL_POWER_PATH" "$DESIRED_BLP" set_if_changed "$BL_POWER_PATH" "$DESIRED_BLP"
set_if_changed "$BR_PATH" "$DESIRED_BR" printf '%s\n' "$DESIRED_BR" > "$BR_PATH" 2>/dev/null || true
else else
set_if_changed "$BL_POWER_PATH" "$DESIRED_BLP" set_if_changed "$BL_POWER_PATH" "$DESIRED_BLP"
set_if_changed "$BR_PATH" "$DESIRED_BR" set_if_changed "$BR_PATH" "$DESIRED_BR"
@@ -2,7 +2,11 @@
# Get or set the unlocked idle screen-blank timeout (seconds). # Get or set the unlocked idle screen-blank timeout (seconds).
# Config menu -> "Screen blank" writes ~/.config/sxmo/idle_blank_timeout. # Config menu -> "Screen blank" writes ~/.config/sxmo/idle_blank_timeout.
# 0 disables blanking; dwm reloads the file on SIGUSR1. # 0 disables blanking; dwm reloads the file on SIGUSR1.
CFGDIR="${XDG_CONFIG_HOME:-${HOME:-/home/user}/.config}/sxmo" USER_HOME="${HOME:-/home/user}"
if [ "$(id -u)" -eq 0 ] && [ "$USER_HOME" = "/root" ] && [ -d /home/user ]; then
USER_HOME="/home/user"
fi
CFGDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}/sxmo"
CFG="$CFGDIR/idle_blank_timeout" CFG="$CFGDIR/idle_blank_timeout"
DEFAULT=300 DEFAULT=300
@@ -33,6 +37,11 @@ notify_dwm() {
[ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true [ -n "$p" ] && kill -USR1 "$p" 2>/dev/null || true
} }
notify_cover() {
[ -x /usr/bin/bananarchy-coverctl ] && \
/usr/bin/bananarchy-coverctl REFRESH >/dev/null 2>&1 || true
}
case "${1:-get}" in case "${1:-get}" in
get) get)
get_secs get_secs
@@ -50,7 +59,11 @@ case "${1:-get}" in
[ "$v" -le 86400 ] || v=86400 [ "$v" -le 86400 ] || v=86400
mkdir -p "$CFGDIR" 2>/dev/null || true mkdir -p "$CFGDIR" 2>/dev/null || true
printf '%s\n' "$v" > "$CFG" || exit 1 printf '%s\n' "$v" > "$CFG" || exit 1
if [ "$(id -u)" -eq 0 ] && [ "$USER_HOME" = "/home/user" ]; then
chown user:user "$CFGDIR" "$CFG" 2>/dev/null || true
fi
notify_dwm notify_dwm
notify_cover
printf '%s\n' "$v" printf '%s\n' "$v"
;; ;;
*) *)
Binary file not shown.
Binary file not shown.
@@ -189,14 +189,16 @@ fi
# A cold boot can leave the resident dmenu or xlocker plugin holding an X # A cold boot can leave the resident dmenu or xlocker plugin holding an X
# keyboard grab before the user sees the desktop. Release both once after # keyboard grab before the user sees the desktop. Release both once after
# dwm has started; do not keep a background poller alive. # dwm has started when booting unlocked; do not keep a background poller alive.
( (
sleep 3 sleep 3
/usr/bin/dwm-plugin dmenu close >/dev/null 2>&1 || true if [ ! -f /tmp/bananarchy_screen_locked ]; then
if [ -p /tmp/dwm_plugin_locker.fifo ]; then /usr/bin/dwm-plugin dmenu close >/dev/null 2>&1 || true
printf "CLOSE\n" > /tmp/dwm_plugin_locker.fifo 2>/dev/null || true if [ -p /tmp/dwm_plugin_locker.fifo ]; then
printf "CLOSE\n" > /tmp/dwm_plugin_locker.fifo 2>/dev/null || true
fi
xdotool key --clearmodifiers Escape >/dev/null 2>&1 || true
fi fi
xdotool key --clearmodifiers Escape >/dev/null 2>&1 || true
) & ) &
first_iter=1 first_iter=1
+4 -4
View File
@@ -27,16 +27,16 @@ transition() {
if [ "$state" = "unlock" ] && [ -f /tmp/bananarchy_screen_locked ]; then if [ "$state" = "unlock" ] && [ -f /tmp/bananarchy_screen_locked ]; then
state="lock" state="lock"
printf '%s\n' "$state" > "$SXMO_STATE" printf '%s\n' "$state" > "$SXMO_STATE"
sxmo_wm.sh display on >/dev/null 2>&1 & sxmo_wm.sh display on 3<&- >/dev/null 2>&1 &
xlocker wake >/dev/null 2>&1 & xlocker wake 3<&- >/dev/null 2>&1 &
return 0 return 0
fi fi
if [ "$state" = "lock" ]; then if [ "$state" = "lock" ]; then
printf '1\n' > /tmp/bananarchy_screen_locked printf '1\n' > /tmp/bananarchy_screen_locked
xlocker >/dev/null 2>&1 & xlocker 3<&- >/dev/null 2>&1 &
elif [ "$state" = "screenoff" ]; then elif [ "$state" = "screenoff" ]; then
printf '1\n' > /tmp/bananarchy_screen_locked printf '1\n' > /tmp/bananarchy_screen_locked
xlocker screenoff >/dev/null 2>&1 & xlocker screenoff 3<&- >/dev/null 2>&1 &
fi fi
sxmo_log "transitioning to stage $state" sxmo_log "transitioning to stage $state"
+15 -3
View File
@@ -31,6 +31,21 @@ swi3msg() {
xorgdisplay() { xorgdisplay() {
case "$1" in case "$1" in
off) off)
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
fi
_cover_lit=""
if [ -r /run/bananarchy/cover-backlight ]; then
read -r _cover_lit < /run/bananarchy/cover-backlight 2>/dev/null || _cover_lit=""
fi
if { [ "$_cover_lit" = "1" ] || [ "$_cover_lit" = "0" ]; } && \
! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
fi
/usr/bin/bananarchy-power-policy.sh screenoff >/dev/null 2>&1 &
return 0
fi
if [ -r /sys/class/backlight/backlight/brightness ]; then if [ -r /sys/class/backlight/backlight/brightness ]; then
_cur_bl=0 _cur_bl=0
read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || true read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || true
@@ -40,9 +55,6 @@ xorgdisplay() {
printf '%s\n' "$_cur_bl" > "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true printf '%s\n' "$_cur_bl" > "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true
fi fi
fi fi
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
fi
if [ -w /sys/class/backlight/backlight/brightness ]; then if [ -w /sys/class/backlight/backlight/brightness ]; then
printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true
fi fi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
View File
@@ -17,30 +17,35 @@ case "$DEVICE" in
DEVICE_DIR="nokia-argon" DEVICE_DIR="nokia-argon"
DEVICEINFO_FILE="deviceinfo" DEVICEINFO_FILE="deviceinfo"
DTB_FILE="qcom-msm8905-nokia-argon.dtb" DTB_FILE="qcom-msm8905-nokia-argon.dtb"
LID_PROFILE="slider"
;; ;;
nokia-beatles|beatles) nokia-beatles|beatles)
DEVICE="nokia-beatles" DEVICE="nokia-beatles"
DEVICE_DIR="nokia-beatles" DEVICE_DIR="nokia-beatles"
DEVICEINFO_FILE="deviceinfo" DEVICEINFO_FILE="deviceinfo"
DTB_FILE="qcom-msm8905-nokia-beatles.dtb" DTB_FILE="qcom-msm8905-nokia-beatles.dtb"
LID_PROFILE="flip"
;; ;;
nokia-tough|nokia-coconut|tough|coconut) nokia-tough|nokia-coconut|tough|coconut)
DEVICE="nokia-tough" DEVICE="nokia-tough"
DEVICE_DIR="nokia-tough" DEVICE_DIR="nokia-tough"
DEVICEINFO_FILE="deviceinfo" DEVICEINFO_FILE="deviceinfo"
DTB_FILE="qcom-msm8905-nokia-coconut.dtb" DTB_FILE="qcom-msm8905-nokia-coconut.dtb"
LID_PROFILE="none"
;; ;;
nokia-sparkler|sparkler) nokia-sparkler|sparkler)
DEVICE="nokia-sparkler" DEVICE="nokia-sparkler"
DEVICE_DIR="nokia-sparkler" DEVICE_DIR="nokia-sparkler"
DEVICEINFO_FILE="deviceinfo" DEVICEINFO_FILE="deviceinfo"
DTB_FILE="qcom-msm8909-nokia-sparkler.dtb" DTB_FILE="qcom-msm8909-nokia-sparkler.dtb"
LID_PROFILE="none"
;; ;;
nokia-leo|leo) nokia-leo|leo)
DEVICE="nokia-leo" DEVICE="nokia-leo"
DEVICE_DIR="nokia-sparkler" DEVICE_DIR="nokia-sparkler"
DEVICEINFO_FILE="deviceinfo.nokia-leo" DEVICEINFO_FILE="deviceinfo.nokia-leo"
DTB_FILE="qcom-msm8909-nokia-leo.dtb" DTB_FILE="qcom-msm8909-nokia-leo.dtb"
LID_PROFILE="none"
;; ;;
*) *)
echo "Error: Unsupported device '$DEVICE'." >&2 echo "Error: Unsupported device '$DEVICE'." >&2
@@ -288,6 +293,7 @@ if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/codecs" ] && \
fi fi
mkdir -p "$TARGET_ROOTFS/boot/dtbs" mkdir -p "$TARGET_ROOTFS/boot/dtbs"
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/"*.dtb "$TARGET_ROOTFS/boot/dtbs/" cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/"*.dtb "$TARGET_ROOTFS/boot/dtbs/"
rm -f "$TARGET_ROOTFS/boot"/qcom-*.dtb
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/$DTB_FILE" "$TARGET_ROOTFS/boot/$DTB_FILE" cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/$DTB_FILE" "$TARGET_ROOTFS/boot/$DTB_FILE"
echo "[3/4] Installing prebuilt Xlibre, Sxmo X11 (dwm/dmenu/st), fcitx5-t9, and Bantam AI agent..." echo "[3/4] Installing prebuilt Xlibre, Sxmo X11 (dwm/dmenu/st), fcitx5-t9, and Bantam AI agent..."
@@ -408,6 +414,23 @@ ln -sf /etc/init.d/kill-plymouth "$TARGET_ROOTFS/etc/runlevels/default/kill-plym
ln -sf /etc/init.d/bananarchy-power-policy "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-power-policy" ln -sf /etc/init.d/bananarchy-power-policy "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-power-policy"
ln -sf /etc/init.d/bananarchy-time-sync "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-time-sync" ln -sf /etc/init.d/bananarchy-time-sync "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-time-sync"
ln -sf /etc/init.d/bananarchy-sshd-debug "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-sshd-debug" ln -sf /etc/init.d/bananarchy-sshd-debug "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-sshd-debug"
mkdir -p "$TARGET_ROOTFS/usr/share/bananarchy"
printf '%s\n' "$LID_PROFILE" > "$TARGET_ROOTFS/usr/share/bananarchy/lid-profile"
chmod 0644 "$TARGET_ROOTFS/usr/share/bananarchy/lid-profile"
if [ "$LID_PROFILE" = "flip" ]; then
ln -sf /etc/init.d/bananarchy-lid "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-lid"
ln -sf /etc/init.d/bananarchy-cover-display "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-cover-display"
ln -sf /etc/init.d/bananarchy-volume-keys "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-volume-keys"
else
rm -f "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-lid" \
"$TARGET_ROOTFS/etc/runlevels/default/bananarchy-cover-display" \
"$TARGET_ROOTFS/etc/runlevels/default/bananarchy-volume-keys" \
"$TARGET_ROOTFS/etc/udev/rules.d/72-nokia-beatles-cover.rules" \
"$TARGET_ROOTFS/etc/bananarchy/cover-display.conf"
printf '# Bananarchy hardware drivers that are not probed from a DT node.\n# msm8905-cam registers /dev/video0 (GC2395/GC2385 rear camera).\nmsm8905-cam\n' \
> "$TARGET_ROOTFS/etc/modules-load.d/bananarchy-hardware.conf"
chmod 0644 "$TARGET_ROOTFS/etc/modules-load.d/bananarchy-hardware.conf"
fi
mkdir -p "$TARGET_ROOTFS/var/lib/tinydm" mkdir -p "$TARGET_ROOTFS/var/lib/tinydm"
ln -sf /usr/share/xsessions/sxmo.desktop "$TARGET_ROOTFS/var/lib/tinydm/default-session.desktop" ln -sf /usr/share/xsessions/sxmo.desktop "$TARGET_ROOTFS/var/lib/tinydm/default-session.desktop"
+23 -13
View File
@@ -372,9 +372,9 @@ fi
echo "[check] Known-good flashable image set..." echo "[check] Known-good flashable image set..."
for pair in \ for pair in \
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \ "a93f0dc5a87d30b9084fcc8df97c78e7496ca1564e4855efe12e4696387a7d4d images/bananarchy-nokia-argon.img" \
"f3f7ab1be04622a9554f0614080b7323689338710d711bfa3de0ee3bcbbbd6f1 images/bananarchy-nokia-beatles.img" \ "7e1a24270e25beedcbc92b3fc8b7f2b314e3c7a9bf7a8e2dbffae1754d1b74c7 images/bananarchy-nokia-beatles.img" \
"2b5c61aba307dbbda61f3b19a2ad5770f9854f41cba4e2c97e24efb7e20879f3 images/boot-bananarchy-nokia-beatles.img" \ "4b190404e8e9b53955a87ff211e0f706e51d08e4df11689cfa5586422e65763d images/boot-bananarchy-nokia-beatles.img" \
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do "b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
set -- $pair set -- $pair
want=$1 want=$1
@@ -612,8 +612,16 @@ if ! cmp -s "$BASE_DIR/prebuilt/bananarchy-coverd/usr/bin/bananarchy-coverd" \
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-coverd"; then "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-coverd"; then
fail "the cover daemon binary drifted from prebuilt/" fail "the cover daemon binary drifted from prebuilt/"
fi fi
if ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-cover-display"; then if ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-cover-display" || \
fail "the flip-device cover service lost its lid-profile gate" ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-lid" || \
! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-volume-keys"; then
fail "the flip-device services lost their lid-profile gate"
fi
if ! grep -qF 'LID_PROFILE="slider"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
! grep -qF 'LID_PROFILE="flip"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \
! grep -qF '$TARGET_ROOTFS/usr/share/bananarchy/lid-profile' \
"$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then
fail "apply-bananarchy-overlay.sh no longer isolates flip vs slider lid profiles"
fi fi
COVER_SCRATCH="/tmp/bantam/9064bb701d9e9f7c6412f0ea6846d88a" COVER_SCRATCH="/tmp/bantam/9064bb701d9e9f7c6412f0ea6846d88a"
COVER_DTBO="$COVER_SCRATCH/cover-panel-check.dtbo" COVER_DTBO="$COVER_SCRATCH/cover-panel-check.dtbo"
@@ -931,9 +939,10 @@ if ! grep -qF 'COVER_MARKER=/run/bananarchy/cover-backlight' "$DPMS_SYNC" || \
! grep -qF 'kernel_backlight_invert' "$DPMS_SYNC" || \ ! grep -qF 'kernel_backlight_invert' "$DPMS_SYNC" || \
! grep -qF 'FORCE=0' "$DPMS_SYNC" || \ ! grep -qF 'FORCE=0' "$DPMS_SYNC" || \
! grep -qF 'STATE_CACHE' "$DPMS_SYNC" || \ ! grep -qF 'STATE_CACHE' "$DPMS_SYNC" || \
! grep -qF 'LIT_BR="$COVER_BL_LEVEL"' "$DPMS_SYNC" || \
! grep -qF 'LIT_BR=0' "$DPMS_SYNC" || \ ! grep -qF 'LIT_BR=0' "$DPMS_SYNC" || \
! grep -qF 'exit 0' "$DPMS_SYNC"; then ! grep -qF 'exit 0' "$DPMS_SYNC"; then
fail "display-power-sync no longer handles the active-low cover backlight" fail "display-power-sync no longer handles the shared cover backlight"
fi fi
for f in overlay/rootfs/usr/bin/sxmo_wm.sh \ for f in overlay/rootfs/usr/bin/sxmo_wm.sh \
overlay/rootfs/usr/bin/sxmo_state.sh \ overlay/rootfs/usr/bin/sxmo_state.sh \
@@ -1183,15 +1192,15 @@ fi
echo "[check] Version helper..." echo "[check] Version helper..."
# Pin the release under test so the check does not break when the wall clock # Pin the release under test so the check does not break when the wall clock
# rolls past the release date (version.sh otherwise derives it from today). # rolls past the release date (version.sh otherwise derives it from today).
VERSION="$(BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu \ VERSION="$(BANANARCHY_VERSION=a1111 \
"$BASE_DIR/scripts/version.sh" --print 2>/dev/null || true)" "$BASE_DIR/scripts/version.sh" --print 2>/dev/null || true)"
CODENAME="$(BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu \ CODENAME="$(BANANARCHY_VERSION=a1111 \
"$BASE_DIR/scripts/version.sh" --print-codename 2>/dev/null || true)" "$BASE_DIR/scripts/version.sh" --print-codename 2>/dev/null || true)"
if [ "$VERSION" != "a1108" ]; then if [ "$VERSION" != "a1111" ]; then
fail "scripts/version.sh --print must return a1108" fail "scripts/version.sh --print must return a1111"
fi fi
if [ "$CODENAME" != "dejavu" ]; then if [ "$CODENAME" != "lennon" ]; then
fail "scripts/version.sh --print-codename must return dejavu" fail "scripts/version.sh --print-codename must return lennon"
fi fi
for f in overlay/rootfs/etc/os-release overlay/rootfs/usr/lib/os-release overlay/rootfs/etc/issue overlay/rootfs/etc/motd; do for f in overlay/rootfs/etc/os-release overlay/rootfs/usr/lib/os-release overlay/rootfs/etc/issue overlay/rootfs/etc/motd; do
if [ ! -f "$BASE_DIR/$f" ]; then if [ ! -f "$BASE_DIR/$f" ]; then
@@ -1531,7 +1540,8 @@ for token in 'backend = kernel' 'main_fb_device = /dev/fb0' \
'kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power' \ 'kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power' \
'kernel_backlight_marker = /run/bananarchy/cover-backlight' \ 'kernel_backlight_marker = /run/bananarchy/cover-backlight' \
'kernel_backlight_level = 14' \ 'kernel_backlight_level = 14' \
'kernel_backlight_invert = 1' \ 'kernel_backlight_invert = 0' \
'kernel_internal_sleep = 0' \
'spi_device = /dev/spidev0.1' \ 'spi_device = /dev/spidev0.1' \
'spi_mux_gpio = 13' 'spi_dc_gpio = 21' 'spi_reset_gpio = 23' \ 'spi_mux_gpio = 13' 'spi_dc_gpio = 21' 'spi_reset_gpio = 23' \
'mux_closed_level = 1' 'mux_open_level = 0' \ 'mux_closed_level = 1' 'mux_open_level = 0' \
+109 -3
View File
@@ -12,6 +12,7 @@ import hashlib
import os import os
import pathlib import pathlib
import socket import socket
import struct
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
@@ -20,12 +21,13 @@ import time
BASE = pathlib.Path(__file__).resolve().parent.parent BASE = pathlib.Path(__file__).resolve().parent.parent
SRC = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c" SRC = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c"
VOL_SRC = BASE / "src/bananarchy-daemons/bananarchy-volume-keys.c" VOL_SRC = BASE / "src/bananarchy-daemons/bananarchy-volume-keys.c"
COMMON_H = BASE / "src/bananarchy-daemons/common.h"
FB_WIDTH, FB_HEIGHT, FB_BPP = 240, 240, 32 FB_WIDTH, FB_HEIGHT, FB_BPP = 240, 240, 32
FRAME_SIZE = FB_WIDTH * FB_HEIGHT * (FB_BPP // 8) FRAME_SIZE = FB_WIDTH * FB_HEIGHT * (FB_BPP // 8)
class Cover: class Cover:
def __init__(self, root, exe, config, main_cfg): def __init__(self, root, exe, config, main_cfg, lid_state=None):
self.root = root self.root = root
self.sock_path = root / "cover.sock" self.sock_path = root / "cover.sock"
self.fb = root / "fb1" self.fb = root / "fb1"
@@ -37,7 +39,10 @@ class Cover:
"BANANARCHY_COVER_LOCK": str(root / "daemon.lock"), "BANANARCHY_COVER_LOCK": str(root / "daemon.lock"),
"BANANARCHY_COVER_FB_GEOM": "%d,%d,%d" % (FB_WIDTH, FB_HEIGHT, FB_BPP), "BANANARCHY_COVER_FB_GEOM": "%d,%d,%d" % (FB_WIDTH, FB_HEIGHT, FB_BPP),
"BANANARCHY_COVER_MAIN_BLANK_CFG": str(main_cfg), "BANANARCHY_COVER_MAIN_BLANK_CFG": str(main_cfg),
"BANANARCHY_COVER_NOIDLE_PATH": str(root / "sxmo.noidle"),
}) })
if lid_state is not None:
self.env["BANANARCHY_COVER_LID_STATE"] = str(lid_state)
self.proc = subprocess.Popen([str(exe), "--config", str(config)], self.proc = subprocess.Popen([str(exe), "--config", str(config)],
env=self.env, stdout=subprocess.DEVNULL, env=self.env, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL) stderr=subprocess.DEVNULL)
@@ -116,6 +121,13 @@ def main():
if token not in source: if token not in source:
sys.stderr.write("FAIL: cover daemon lost %s\n" % token) sys.stderr.write("FAIL: cover daemon lost %s\n" % token)
return 1 return 1
common_src = COMMON_H.read_text(encoding="utf-8")
if "struct timeval time;" in common_src or \
"unsigned long tv_sec;" not in common_src or \
"ba_input_event_abi" not in common_src:
sys.stderr.write(
"FAIL: struct input_event in common.h regressed to time64 timeval\n")
return 1
print("[ok] host build of the compiled cover and volume-key daemons") print("[ok] host build of the compiled cover and volume-key daemons")
main_cfg = root / "idle_blank_timeout" main_cfg = root / "idle_blank_timeout"
@@ -160,7 +172,24 @@ def main():
if before == with_clock: if before == with_clock:
sys.stderr.write("FAIL: no frame was drawn on BUTTON\n") sys.stderr.write("FAIL: no frame was drawn on BUTTON\n")
return 1 return 1
print("[ok] external button: clock, battery and backlight on") raw_fb = daemon.fb.read_bytes()
bg = struct.pack("<I", (8 << 16) | (12 << 8) | 26)
for band_name, y0, y1 in (("header", 20, 40),
("clock", 85, 130),
("date", 135, 160)):
xs = [x for y in range(y0, y1) for x in range(FB_WIDTH)
if raw_fb[(y * FB_WIDTH + x) * 4:(y * FB_WIDTH + x + 1) * 4] != bg]
if not xs:
sys.stderr.write("FAIL: missing %s ink on 240x240 frame\n" % band_name)
return 1
left_margin = min(xs)
right_margin = FB_WIDTH - 1 - max(xs)
if abs(left_margin - right_margin) > 1:
sys.stderr.write(
"FAIL: %s is off-center on 240x240 (left=%d right=%d)\n" %
(band_name, left_margin, right_margin))
return 1
print("[ok] external button: centered clock/date, battery and backlight on")
daemon.send("NETWORK 3G SIG20") daemon.send("NETWORK 3G SIG20")
if not wait_for(lambda: daemon.frame()[0] != with_clock): if not wait_for(lambda: daemon.frame()[0] != with_clock):
@@ -206,13 +235,24 @@ def main():
(sub / "cover.sock", sub / "fb1", sub / "backlight"), (sub / "cover.sock", sub / "fb1", sub / "backlight"),
encoding="utf-8") encoding="utf-8")
main_cfg.write_text("0\n") main_cfg.write_text("0\n")
daemon2 = Cover(sub, exe, config2, main_cfg) auth_lid = sub / "lid-state"
auth_lid.write_text("closed\n")
daemon2 = Cover(sub, exe, config2, main_cfg, lid_state=auth_lid)
try: try:
daemon2.send("LID CLOSED") daemon2.send("LID CLOSED")
daemon2.send("BUTTON") daemon2.send("BUTTON")
if not wait_for(lambda: daemon2.frame()[1]): if not wait_for(lambda: daemon2.frame()[1]):
sys.stderr.write("FAIL: auto timeout daemon did not light the cover\n") sys.stderr.write("FAIL: auto timeout daemon did not light the cover\n")
return 1 return 1
# A bogus LID OPEN (such as dwm misreading SW_KEYPAD_SLIDE=1 on close)
# must be ignored while bananarchy-lid's state file reports "closed".
daemon2.send("LID OPEN")
time.sleep(0.15)
if not daemon2.frame()[1] or "visible=1" not in daemon2.send("STATUS") or \
"lid=closed" not in daemon2.send("STATUS"):
sys.stderr.write(
"FAIL: bogus LID OPEN blanked the cover while lid-state=closed\n")
return 1
time.sleep(2.5) time.sleep(2.5)
if not daemon2.frame()[1] or "visible=1" not in daemon2.send("STATUS"): if not daemon2.frame()[1] or "visible=1" not in daemon2.send("STATUS"):
sys.stderr.write("FAIL: Screen blank = 0 should keep the cover on\n") sys.stderr.write("FAIL: Screen blank = 0 should keep the cover on\n")
@@ -221,6 +261,72 @@ def main():
sys.stderr.write("FAIL: auto timeout did not read the main Screen blank config\n") sys.stderr.write("FAIL: auto timeout did not read the main Screen blank config\n")
return 1 return 1
print("[ok] auto timeout follows Config -> Screen blank (0 = never)") print("[ok] auto timeout follows Config -> Screen blank (0 = never)")
# Changing Config -> Screen blank at runtime updates the live daemon.
noidle = sub / "sxmo.noidle"
main_cfg.write_text("1\n")
daemon2.send("REFRESH")
if not wait_for(lambda: not daemon2.frame()[1], timeout=3):
sys.stderr.write("FAIL: runtime Screen blank update did not blank cover\n")
return 1
if "blank_ms=1000" not in daemon2.send("STATUS") or \
"visible=0" not in daemon2.send("STATUS"):
sys.stderr.write("FAIL: runtime Screen blank update did not refresh blank_ms\n")
return 1
noidle.write_text("")
if "blank_ms=0" not in daemon2.send("STATUS"):
sys.stderr.write("FAIL: sxmo.noidle did not disable cover blanking\n")
return 1
noidle.unlink()
daemon2.send("BUTTON")
if not wait_for(lambda: daemon2.frame()[1]):
sys.stderr.write("FAIL: BUTTON after runtime config update did not wake cover\n")
return 1
if not wait_for(lambda: not daemon2.frame()[1], timeout=3):
sys.stderr.write("FAIL: cover did not blank after updated 1 s main timeout\n")
return 1
print("[ok] runtime Screen blank changes and sxmo.noidle apply live")
# End-to-end evdev binary record -> bananarchy-volume-keys -> cover wake.
ev_fifo = sub / "event0"
os.mkfifo(ev_fifo)
keep_w = os.open(ev_fifo, os.O_RDWR | os.O_NONBLOCK)
lid_file = sub / "lid-state"
lid_file.write_text("closed\n")
vol_env = dict(os.environ)
vol_env.update({
"BANANARCHY_VOLUME_LOCK": str(sub / "volume.lock"),
"BANANARCHY_LID_STATE": str(lid_file),
"BANANARCHY_COVER_SOCKET": str(sub / "cover.sock"),
"BANANARCHY_VOLUME_CLIENT_SOCKET": str(sub / "vol-client.sock"),
"BANANARCHY_INPUT_GLOB": str(ev_fifo),
})
vol_proc = subprocess.Popen(
[str(root / "volume-keys")], env=vol_env,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
try:
main_cfg.write_text("0\n")
daemon2.send("REFRESH")
time.sleep(0.15)
os.write(keep_w, struct.pack("LLHHi", 1, 0, 1, 115, 1))
if not wait_for(lambda: daemon2.frame()[1], timeout=3):
sys.stderr.write(
"FAIL: evdev KEY_VOLUMEUP did not wake cover via volume-keys\n")
return 1
daemon2.send("BLANK")
if not wait_for(lambda: not daemon2.frame()[1], timeout=3):
sys.stderr.write("FAIL: BLANK did not clear cover before camera key\n")
return 1
os.write(keep_w, struct.pack("LLHHi", 2, 0, 1, 212, 1))
if not wait_for(lambda: daemon2.frame()[1], timeout=3):
sys.stderr.write(
"FAIL: evdev KEY_CAMERA did not wake cover via volume-keys\n")
return 1
print("[ok] evdev outer side buttons wake cover end-to-end")
finally:
vol_proc.kill()
vol_proc.wait()
os.close(keep_w)
finally: finally:
daemon2.close() daemon2.close()
print("cover display behaviour: all checks passed") print("cover display behaviour: all checks passed")
+48 -28
View File
@@ -3,9 +3,9 @@
The daemon runs in simulation mode against a fake /dev/fb0, fake DPMS/backlight The daemon runs in simulation mode against a fake /dev/fb0, fake DPMS/backlight
and the panel-mipi-dbi-spi debugfs command hook. It verifies the stock vendor and the panel-mipi-dbi-spi debugfs command hook. It verifies the stock vendor
init, active-low cover backlight, shared-backlight marker, 240x240 frame, init, active-high shared backlight, active-black internal GRAM isolation,
periodic repaint against Xorg, blanking, handover on open and the initial shared-backlight marker, 240x240 frame, periodic repaint against Xorg,
DPMS-off gate. blanking, handover on open and the initial DPMS-off gate.
""" """
import os import os
import pathlib import pathlib
@@ -45,7 +45,7 @@ class Daemon:
"BANANARCHY_COVER_KERNEL_BL": str(bl), "BANANARCHY_COVER_KERNEL_BL": str(bl),
"BANANARCHY_COVER_KERNEL_BL_POWER": str(bl_power), "BANANARCHY_COVER_KERNEL_BL_POWER": str(bl_power),
"BANANARCHY_COVER_KERNEL_MARKER": str(marker), "BANANARCHY_COVER_KERNEL_MARKER": str(marker),
"BANANARCHY_COVER_KERNEL_BL_INVERT": "1", "BANANARCHY_COVER_KERNEL_BL_INVERT": "0",
}) })
(root / "dpms").write_text("Off\n") (root / "dpms").write_text("Off\n")
self.proc = subprocess.Popen([str(exe), "--config", str(config)], self.proc = subprocess.Popen([str(exe), "--config", str(config)],
@@ -111,7 +111,8 @@ def main():
"kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power", "kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power",
"kernel_backlight_marker = /run/bananarchy/cover-backlight", "kernel_backlight_marker = /run/bananarchy/cover-backlight",
"kernel_backlight_level = 14", "kernel_backlight_level = 14",
"kernel_backlight_invert = 1"): "kernel_backlight_invert = 0",
"kernel_internal_sleep = 0"):
if token not in conf: if token not in conf:
return fail("shipping config lost %s" % token) return fail("shipping config lost %s" % token)
helper = HELPER.read_text(encoding="utf-8") helper = HELPER.read_text(encoding="utf-8")
@@ -161,7 +162,8 @@ def main():
"panel_firmware = %s\nkernel_dpms_helper = /bin/true\n" "panel_firmware = %s\nkernel_dpms_helper = /bin/true\n"
"kernel_backlight_path = %s\nkernel_backlight_power_path = %s\n" "kernel_backlight_path = %s\nkernel_backlight_power_path = %s\n"
"kernel_backlight_marker = %s\nkernel_backlight_level = 14\n" "kernel_backlight_marker = %s\nkernel_backlight_level = 14\n"
"kernel_backlight_invert = 1\nmux_closed_level = 1\n" "kernel_backlight_invert = 0\nkernel_internal_sleep = 0\n"
"mux_closed_level = 1\n"
"mux_open_level = 0\nreset_assert_level = 0\nreset_idle_level = 1\n" % "mux_open_level = 0\nreset_assert_level = 0\nreset_idle_level = 1\n" %
(root / "cover.sock", root / "no-fb1", root / "legacy-backlight", (root / "cover.sock", root / "no-fb1", root / "legacy-backlight",
fb, FIRMWARE, bl, bl_power, marker)) fb, FIRMWARE, bl, bl_power, marker))
@@ -181,28 +183,41 @@ def main():
print("[ok] open flip: internal mux and backlight restored, no cover frame") print("[ok] open flip: internal mux and backlight restored, no cover frame")
daemon.send("LID CLOSED") daemon.send("LID CLOSED")
if not daemon.wait("kernel marker 0") or not daemon.wait("dpms reinit"): if not daemon.wait("kernel marker absent") or not daemon.wait("dpms off"):
return fail("closing the flip did not blank the cover") return fail("closing the flip did not power down the displays")
if not any(e == "gpio 1 1" for e in daemon.events()): if any(e == "gpio 1 1" for e in daemon.events()):
return fail("the mux was not switched to the external panel") return fail("closing the flip selected the cover without a button press")
if marker.read_text().strip() != "0" or bl.read_text().strip() != "14" \ if marker.exists() or bl.read_text().strip() != "0" \
or bl_power.read_text().strip() != "0": or bl_power.read_text().strip() != "4":
return fail("the active-low cover backlight was not held off") return fail("closing the flip did not hold both backlights dark")
print("[ok] closed flip: mux to cover, external backlight held off") print("[ok] closed flip: mux parked low, both panels dark")
tail = len(daemon.events())
daemon.send("BUTTON") daemon.send("BUTTON")
expected = ("kernel marker 1", "dpms reinit", "kernel reset", expected = ("kernel marker 0", "dpms on", "kernel clear fb",
"kernel cmd fe", "kernel cmd 29", "gpio 1 1", "kernel reset", "kernel cmd fe",
"kernel backlight 0 power=0", "kernel frame lit=1") "kernel cmd 29", "kernel frame lit=1",
"kernel marker 1", "kernel backlight 14 power=0")
for text in expected: for text in expected:
if not daemon.wait(text): if not daemon.wait(text):
return fail("BUTTON did not produce %s" % text) return fail("BUTTON did not produce %s" % text)
if marker.read_text().strip() != "1" or bl.read_text().strip() != "0" \ wake_events = daemon.events()[tail:]
if "dpms reinit" in wake_events:
return fail("BUTTON ran dpms reinit and reset internal gpio25")
clear_idx = next(i for i, e in enumerate(wake_events)
if e == "kernel clear fb")
mux_idx = next(i for i, e in enumerate(wake_events) if e == "gpio 1 1")
if clear_idx > mux_idx:
return fail("internal fb clear did not precede cover mux switch")
if any(e == "kernel cmd 28" for e in wake_events[:mux_idx]):
return fail("BUTTON put the normally-white internal panel to sleep before cover mux switch")
if not marker.exists() or marker.read_text().strip() != "1" \
or bl.read_text().strip() != "14" \
or bl_power.read_text().strip() != "0": or bl_power.read_text().strip() != "0":
return fail("the active-low cover backlight was not enabled") return fail("the active-high cover backlight was not enabled")
if "kernel" not in daemon.send("STATUS"): if "kernel" not in daemon.send("STATUS"):
return fail("STATUS does not report the kernel backend") return fail("STATUS does not report the kernel backend")
print("[ok] BUTTON: vendor init, active-low cover backlight and UI") print("[ok] BUTTON: internal panel active-black, vendor init and cover UI")
frames = daemon.count("kernel frame lit=1") frames = daemon.count("kernel frame lit=1")
time.sleep(1.2) time.sleep(1.2)
@@ -210,15 +225,20 @@ def main():
return fail("the kernel cover UI is not repainted against Xorg") return fail("the kernel cover UI is not repainted against Xorg")
print("[ok] kernel UI is repainted every second") print("[ok] kernel UI is repainted every second")
tail = len(daemon.events())
daemon.send("BLANK") daemon.send("BLANK")
time.sleep(0.1) time.sleep(0.15)
if not daemon.wait("kernel cmd 28") or not daemon.wait("dpms reinit") or \ blank_events = daemon.events()[tail:]
not daemon.wait("kernel marker 0") or \ for text in ("kernel cmd 28", "kernel cmd 10", "gpio 0 1",
not daemon.wait("kernel backlight 14 power=0"): "kernel marker absent", "kernel backlight 0 power=4",
return fail("blanking did not power the cover down") "dpms off"):
if marker.read_text().strip() != "0" or bl.read_text().strip() != "14": if not any(text in e for e in blank_events):
return fail("the cover backlight was not returned to the OFF duty: marker=%r bl=%r blp=%r events=%r" % (marker.read_text() if marker.exists() else None, bl.read_text(), bl_power.read_text(), daemon.events()[-12:])) return fail("blanking did not produce %s: %r" % (text, blank_events))
print("[ok] BLANK: display-off, external backlight OFF duty") if marker.exists() or bl.read_text().strip() != "0" \
or bl_power.read_text().strip() != "4":
return fail("blanking did not power down the backlight: marker=%r bl=%r blp=%r" %
(marker.exists(), bl.read_text(), bl_power.read_text()))
print("[ok] BLANK: display-off, mux parked low and backlight powered down")
daemon.send("LID OPEN") daemon.send("LID OPEN")
if not daemon.wait("release") or not daemon.wait("kernel restore internal"): if not daemon.wait("release") or not daemon.wait("kernel restore internal"):
+47 -3
View File
@@ -14,6 +14,8 @@ import tempfile
BASE = pathlib.Path(__file__).resolve().parent.parent BASE = pathlib.Path(__file__).resolve().parent.parent
LID_SRC = BASE / "src/bananarchy-daemons/bananarchy-lid.c" LID_SRC = BASE / "src/bananarchy-daemons/bananarchy-lid.c"
COVER_SRC = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c" COVER_SRC = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c"
LOCKER_SRC = BASE / "src/dwm-plugins/locker_plugin.cpp"
CALLSCREEN_SRC = BASE / "src/dwm-plugins/callscreen_plugin.cpp"
GATE = BASE / "overlay/rootfs/usr/bin/bananarchy-lid-gate.sh" GATE = BASE / "overlay/rootfs/usr/bin/bananarchy-lid-gate.sh"
LID_WRAPPER = BASE / "overlay/rootfs/usr/bin/bananarchy-lid-state.sh" LID_WRAPPER = BASE / "overlay/rootfs/usr/bin/bananarchy-lid-state.sh"
COMMON = BASE / "src/bananarchy-daemons/common.h" COMMON = BASE / "src/bananarchy-daemons/common.h"
@@ -26,6 +28,7 @@ DPMS_SYNC = BASE / "overlay/rootfs/usr/bin/bananarchy-display-power-sync"
INPUT_HOOKS = ( INPUT_HOOKS = (
BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh", BASE / "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh",
BASE / "overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_inputhandler.sh", BASE / "overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_inputhandler.sh",
BASE / "overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_inputhandler.sh",
) )
EVENT = BASE / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh" EVENT = BASE / "overlay/rootfs/usr/bin/bananarchy-cover-event.sh"
HOOKS = ( HOOKS = (
@@ -118,8 +121,18 @@ def main():
if " wake)" not in event or "coverctl WAKE" not in event: if " wake)" not in event or "coverctl WAKE" not in event:
return fail("cover event bridge lost the wake forwarding case") return fail("cover event bridge lost the wake forwarding case")
common = COMMON.read_text(encoding="utf-8") common = COMMON.read_text(encoding="utf-8")
if "device_has_code(fd, EV_KEY, KEY_POWER)" not in common: if "device_has_code(fd, EV_KEY, KEY_POWER)" not in common or \
return fail("the End/Power key is not watched while the flip is closed") "device_has_code(fd, EV_KEY, KEY_CAMERA)" not in common:
return fail("the outer Power/Camera keys are not watched while closed")
locker = LOCKER_SRC.read_text(encoding="utf-8")
if "isLidClosed()" not in locker or \
"if (!visible || isLidClosed())" not in locker or \
'runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake")' not in locker:
return fail("locker_plugin.cpp is not gated on /run/bananarchy/lid-state")
callscreen = CALLSCREEN_SRC.read_text(encoding="utf-8")
if "/run/bananarchy/lid-state" not in callscreen or \
'runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake")' not in callscreen:
return fail("callscreen_plugin.cpp wakeDisplayHardware is not lid-gated")
conf = COVER_CONF.read_text(encoding="utf-8") conf = COVER_CONF.read_text(encoding="utf-8")
if "spi_word_bits" not in conf: if "spi_word_bits" not in conf:
return fail("the cover config lost the 8/9-bit sign-off knob") return fail("the cover config lost the 8/9-bit sign-off knob")
@@ -138,11 +151,42 @@ def main():
("%s", calls)) ("%s", calls))
stub.chmod(0o755) stub.chmod(0o755)
profile.write_text("slider\n")
state.write_text("closed\n")
if run_gate(profile, state, "wake", stub).returncode != 0:
return fail("nokia-argon slider device was blocked by the flip lid gate")
if calls.exists() and calls.read_text().strip():
return fail("nokia-argon slider device forwarded a wake to coverctl")
lid_state_out = root / "daemon-lid-state"
lid_env = dict(os.environ)
lid_env["BANANARCHY_LID_PROFILE"] = str(profile)
lid_env["BANANARCHY_LID_STATE"] = str(lid_state_out)
proc = subprocess.run([str(scratch / "lid-gate-host")],
env=lid_env, capture_output=True, text=True,
timeout=2)
if proc.returncode != 0 or lid_state_out.exists():
return fail("compiled lid daemon stayed active on a slider device")
overlay_sh = (BASE / "scripts/apply-bananarchy-overlay.sh").read_text(encoding="utf-8")
for token in ('LID_PROFILE="slider"', 'LID_PROFILE="flip"',
'LID_PROFILE="none"',
'printf \'%s\\n\' "$LID_PROFILE" > "$TARGET_ROOTFS/usr/share/bananarchy/lid-profile"',
'"$TARGET_ROOTFS/etc/runlevels/default/bananarchy-lid"',
'"$TARGET_ROOTFS/etc/runlevels/default/bananarchy-cover-display"',
'"$TARGET_ROOTFS/etc/runlevels/default/bananarchy-volume-keys"'):
if token not in overlay_sh:
return fail("apply-bananarchy-overlay.sh lost target lid isolation: %s" % token)
if '"/usr/share/bananarchy/lid-profile"' not in locker or \
'"/usr/share/bananarchy/lid-profile"' not in callscreen or \
'LID_PROFILE=' not in DPMS_SYNC.read_text(encoding="utf-8"):
return fail("plugins or display-power-sync lost the flip lid-profile check")
profile.write_text("bar\n") profile.write_text("bar\n")
state.write_text("closed\n") state.write_text("closed\n")
if run_gate(profile, state, stub=stub).returncode != 0: if run_gate(profile, state, stub=stub).returncode != 0:
return fail("a non-flip device was blocked by the lid gate") return fail("a non-flip device was blocked by the lid gate")
print("[ok] non-flip devices are unaffected") print("[ok] non-flip / slider devices are completely unaffected")
profile.write_text("flip\n") profile.write_text("flip\n")
state.write_text("open\n") state.write_text("open\n")
+1
View File
@@ -16,6 +16,7 @@ YEAR_LETTER="$(printf "\\$(printf '%03o' $(( 97 + LETTER_IDX )))")"
VERSION="${BANANARCHY_VERSION:-${YEAR_LETTER}${MONTH}${DAY}}" VERSION="${BANANARCHY_VERSION:-${YEAR_LETTER}${MONTH}${DAY}}"
case "$VERSION" in case "$VERSION" in
a1111) DEFAULT_CODENAME=lennon ;;
a1108) DEFAULT_CODENAME=dejavu ;; a1108) DEFAULT_CODENAME=dejavu ;;
a1105) DEFAULT_CODENAME=vendetta ;; a1105) DEFAULT_CODENAME=vendetta ;;
a1031) DEFAULT_CODENAME=myers ;; a1031) DEFAULT_CODENAME=myers ;;
File diff suppressed because it is too large. Load diff
+84 -2
View File
@@ -38,11 +38,15 @@
#define COVER_SOCKET "/run/bananarchy/cover.sock" #define COVER_SOCKET "/run/bananarchy/cover.sock"
#define LID_CLIENT_SOCKET "/run/bananarchy/lid-client.sock" #define LID_CLIENT_SOCKET "/run/bananarchy/lid-client.sock"
#define LID_BROADCAST_MS 2000 #define LID_BROADCAST_MS 2000
#define EV_SYN 0x00
#define SYN_REPORT 0x00
#define EV_SW 0x05 #define EV_SW 0x05
#define SW_LID 0x00 #define SW_LID 0x00
#define SW_KEYPAD_SLIDE 0x0a #define SW_KEYPAD_SLIDE 0x0a
#define CLOSED_MASK ((1u << SW_LID) | (1u << SW_KEYPAD_SLIDE)) #define CLOSED_MASK ((1u << SW_LID) | (1u << SW_KEYPAD_SLIDE))
#define BA_EVIOCGSW(len) BA_IOC(2U, 'E', 0x1bU, (unsigned int)(len)) #define BA_EVIOCGSW(len) BA_IOC(2U, 'E', 0x1bU, (unsigned int)(len))
#define COVER_MARKER "/run/bananarchy/cover-backlight"
#define MAIN_DPMS_PATH "/sys/class/drm/card0-SPI-1/dpms"
static char *const session_env[] = { static char *const session_env[] = {
(char *)"PATH=/home/user/.local/bin:/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin", (char *)"PATH=/home/user/.local/bin:/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin",
@@ -176,6 +180,70 @@ static const char *sxmo_state_path(void)
return path && *path ? path : SXMO_STATE_FILE; return path && *path ? path : SXMO_STATE_FILE;
} }
/* On nokia-beatles, gpio92 (SW_LID) never toggles and gpio36 (SW_KEYPAD_SLIDE)
* asserts 1 when the flip closes, which the shipped dwm binary misreads as a
* slider-open event. Mirroring the authoritative hall state onto SW_LID keeps
* EVIOCGSW(SW_LID) accurate and sets dwm's internal lid_closed flag. */
static void sync_sw_lid(int closed)
{
glob_t gl;
size_t i;
if(getenv("BANANARCHY_LID_GPIO_FILE"))
return;
if(glob("/dev/input/event*", 0, NULL, &gl) != 0)
return;
for(i = 0; i < gl.gl_pathc; i++) {
int fd = open(gl.gl_pathv[i], O_RDWR | O_NONBLOCK | O_CLOEXEC);
struct input_event ev[2];
if(fd < 0)
continue;
if(!device_has_code(fd, EV_SW, SW_LID)) {
close(fd);
continue;
}
memset(ev, 0, sizeof(ev));
ev[0].type = EV_SW;
ev[0].code = SW_LID;
ev[0].value = closed ? 1 : 0;
ev[1].type = EV_SYN;
ev[1].code = SYN_REPORT;
ev[1].value = 0;
(void)!write(fd, ev, sizeof(ev));
close(fd);
}
globfree(&gl);
}
/* Self-heal if a concurrent X11 client or close-time race left the main panel
* DPMS-on while the flip is closed and the cover does not own the backlight. */
static void enforce_closed_dark(void)
{
int fd;
char dpms[16];
ssize_t got = 0;
int dpms_on = 0;
if(getenv("BANANARCHY_LID_GPIO_FILE"))
return;
if(access(COVER_MARKER, F_OK) == 0)
return;
fd = open(MAIN_DPMS_PATH, O_RDONLY | O_CLOEXEC);
if(fd >= 0) {
got = read(fd, dpms, sizeof(dpms) - 1);
close(fd);
if(got > 0) {
dpms[got] = '\0';
dpms_on = strncmp(dpms, "Off", 3) != 0;
}
}
if(!dpms_on &&
read_int_file(BRIGHTNESS, 0) == 0 &&
read_int_file(BL_POWER, 4) == 4)
return;
write_text_file(BRIGHTNESS, "0");
write_text_file(BL_POWER, "4");
run_dpms("off");
}
/* Everything user-visible happens synchronously here: no shell, no fork and /* Everything user-visible happens synchronously here: no shell, no fork and
* no scheduler wait before the main panel is dark and the screen is locked. * no scheduler wait before the main panel is dark and the screen is locked.
* The Sxmo state hooks are spawned afterwards and only repeat these writes. */ * The Sxmo state hooks are spawned afterwards and only repeat these writes. */
@@ -188,6 +256,7 @@ static void on_transition(int closed)
write_session_file(LID_GENERATION_FILE, generation); write_session_file(LID_GENERATION_FILE, generation);
/* Publish first: every main-panel wake path is gated on this file. */ /* Publish first: every main-panel wake path is gated on this file. */
write_lid_state(closed); write_lid_state(closed);
sync_sw_lid(closed);
if(closed) { if(closed) {
int saved_bl = read_int_file(BRIGHTNESS, -1); int saved_bl = read_int_file(BRIGHTNESS, -1);
int saved_kbd = read_int_file(KBD_BACKLIGHT, -1); int saved_kbd = read_int_file(KBD_BACKLIGHT, -1);
@@ -359,7 +428,7 @@ static void read_ready(struct watch_list *list, struct pollfd *fds, int nfds,
int main(void) int main(void)
{ {
int lock_fd = lock_singleton(LID_LOCK); int lock_fd;
struct watch_list list; struct watch_list list;
long long now; long long now;
long long last_scan = 0; long long last_scan = 0;
@@ -376,6 +445,9 @@ int main(void)
int hall_observed; int hall_observed;
int edge; int edge;
int observed; int observed;
if(is_non_flip_profile())
return 0;
lock_fd = lock_singleton(LID_LOCK);
if(lock_fd < 0) if(lock_fd < 0)
return 1; return 1;
install_reaper(); install_reaper();
@@ -393,7 +465,12 @@ int main(void)
now = now_ms(); now = now_ms();
candidate_since = now; candidate_since = now;
write_lid_state(stable_closed); write_lid_state(stable_closed);
cover_send(stable_closed ? "CLOSED" : "OPEN"); if(stable_closed)
on_transition(1);
else {
sync_sw_lid(0);
cover_send("OPEN");
}
last_broadcast = now; last_broadcast = now;
while(1) { while(1) {
struct pollfd fds[WATCH_MAX]; struct pollfd fds[WATCH_MAX];
@@ -429,6 +506,8 @@ int main(void)
((switch_mask & (int)CLOSED_MASK) != 0); ((switch_mask & (int)CLOSED_MASK) != 0);
last_hall_poll = now; last_hall_poll = now;
fast_until = now + 120; fast_until = now + 120;
if(hall == 1 && !(switch_mask & (int)switch_bit(SW_LID)))
sync_sw_lid(1);
} else if(now - last_hall_poll >= } else if(now - last_hall_poll >=
(now < fast_until ? HALL_EDGE_MS : HALL_POLL_MS)) { (now < fast_until ? HALL_EDGE_MS : HALL_POLL_MS)) {
hall = hall_state(); hall = hall_state();
@@ -451,6 +530,9 @@ int main(void)
} }
if(now - last_broadcast >= LID_BROADCAST_MS) { if(now - last_broadcast >= LID_BROADCAST_MS) {
write_lid_state(stable_closed); write_lid_state(stable_closed);
sync_sw_lid(stable_closed);
if(stable_closed)
enforce_closed_dark();
cover_send(stable_closed ? "CLOSED" : "OPEN"); cover_send(stable_closed ? "CLOSED" : "OPEN");
last_broadcast = now; last_broadcast = now;
} }
@@ -26,6 +26,9 @@
#ifndef KEY_POWER #ifndef KEY_POWER
#define KEY_POWER 116 #define KEY_POWER 116
#endif #endif
#ifndef KEY_CAMERA
#define KEY_CAMERA 212
#endif
static char *const session_env[] = { static char *const session_env[] = {
(char *)"PATH=/home/user/.local/bin:/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin", (char *)"PATH=/home/user/.local/bin:/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin",
@@ -37,10 +40,28 @@ static char *const session_env[] = {
NULL NULL
}; };
static const char *lid_state_path(void)
{
const char *override = getenv("BANANARCHY_LID_STATE");
return (override && *override) ? override : LID_STATE_FILE;
}
static const char *cover_socket_path(void)
{
const char *override = getenv("BANANARCHY_COVER_SOCKET");
return (override && *override) ? override : COVER_SOCKET;
}
static const char *client_socket_path(void)
{
const char *override = getenv("BANANARCHY_VOLUME_CLIENT_SOCKET");
return (override && *override) ? override : LID_CLIENT_SOCKET;
}
static int lid_is_closed(void) static int lid_is_closed(void)
{ {
char buf[32] = ""; char buf[32] = "";
FILE *handle = fopen(LID_STATE_FILE, "r"); FILE *handle = fopen(lid_state_path(), "r");
if(!handle) if(!handle)
return 0; return 0;
if(!fgets(buf, sizeof(buf), handle)) if(!fgets(buf, sizeof(buf), handle))
@@ -54,26 +75,29 @@ static int lid_is_closed(void)
* server; a failed send just means it is not running on this target. */ * server; a failed send just means it is not running on this target. */
static void cover_button(void) static void cover_button(void)
{ {
const char *client_path = client_socket_path();
const char *remote_path = cover_socket_path();
int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0); int fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
struct sockaddr_un local; struct sockaddr_un local;
struct sockaddr_un remote; struct sockaddr_un remote;
if(fd < 0) if(fd < 0)
return; return;
mkdir("/run/bananarchy", 0755); if(strcmp(client_path, LID_CLIENT_SOCKET) == 0)
unlink(LID_CLIENT_SOCKET); mkdir("/run/bananarchy", 0755);
unlink(client_path);
memset(&local, 0, sizeof(local)); memset(&local, 0, sizeof(local));
local.sun_family = AF_UNIX; local.sun_family = AF_UNIX;
snprintf(local.sun_path, sizeof(local.sun_path), "%s", LID_CLIENT_SOCKET); snprintf(local.sun_path, sizeof(local.sun_path), "%s", client_path);
if(bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) { if(bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd); close(fd);
return; return;
} }
memset(&remote, 0, sizeof(remote)); memset(&remote, 0, sizeof(remote));
remote.sun_family = AF_UNIX; remote.sun_family = AF_UNIX;
snprintf(remote.sun_path, sizeof(remote.sun_path), "%s", COVER_SOCKET); snprintf(remote.sun_path, sizeof(remote.sun_path), "%s", remote_path);
sendto(fd, "BUTTON\n", 7, 0, (struct sockaddr *)&remote, sizeof(remote)); sendto(fd, "BUTTON\n", 7, 0, (struct sockaddr *)&remote, sizeof(remote));
close(fd); close(fd);
unlink(LID_CLIENT_SOCKET); unlink(client_path);
} }
static void apply_volume(const char *action) static void apply_volume(const char *action)
@@ -107,7 +131,7 @@ static void read_ready(struct watch_list *list, struct pollfd *fds, int nfds)
if(ev.type != EV_KEY || ev.value != 1) if(ev.type != EV_KEY || ev.value != 1)
continue; continue;
if(ev.code != KEY_VOLUMEUP && ev.code != KEY_VOLUMEDOWN && if(ev.code != KEY_VOLUMEUP && ev.code != KEY_VOLUMEDOWN &&
ev.code != KEY_POWER) ev.code != KEY_POWER && ev.code != KEY_CAMERA)
continue; continue;
if(lid_is_closed()) { if(lid_is_closed()) {
cover_button(); cover_button();
@@ -130,9 +154,14 @@ static void read_ready(struct watch_list *list, struct pollfd *fds, int nfds)
int main(void) int main(void)
{ {
int lock_fd = lock_singleton(VOLUME_LOCK); const char *lock_override = getenv("BANANARCHY_VOLUME_LOCK");
int lock_fd;
struct watch_list list; struct watch_list list;
long long last_scan = 0; long long last_scan = 0;
if(is_non_flip_profile())
return 0;
lock_fd = lock_singleton(
(lock_override && *lock_override) ? lock_override : VOLUME_LOCK);
if(lock_fd < 0) if(lock_fd < 0)
return 1; return 1;
install_reaper(); install_reaper();
+39 -5
View File
@@ -37,19 +37,29 @@
#ifndef KEY_POWER #ifndef KEY_POWER
#define KEY_POWER 116 #define KEY_POWER 116
#endif #endif
#ifndef KEY_CAMERA
#define KEY_CAMERA 212
#endif
#define BA_IOC(dir, type, nr, size) \ #define BA_IOC(dir, type, nr, size) \
(((unsigned int)(dir) << 30) | ((unsigned int)(type) << 8) | \ (((unsigned int)(dir) << 30) | ((unsigned int)(type) << 8) | \
((unsigned int)(nr) << 0) | ((unsigned int)(size) << 16)) ((unsigned int)(nr) << 0) | ((unsigned int)(size) << 16))
#define BA_EVIOCGBIT(ev, len) \ #define BA_EVIOCGBIT(ev, len) \
BA_IOC(2U, 'E', 0x20U + (unsigned int)(ev), (unsigned int)(len)) BA_IOC(2U, 'E', 0x20U + (unsigned int)(ev), (unsigned int)(len))
/* Match the kernel evdev record layout (__kernel_ulong_t sec/usec), not musl
* time64 struct timeval: on 32-bit armv7 musl, struct timeval is 16 bytes
* while the kernel writes 8-byte sec/usec (16-byte input_event total). */
struct input_event { struct input_event {
struct timeval time; unsigned long tv_sec;
unsigned long tv_usec;
uint16_t type; uint16_t type;
uint16_t code; uint16_t code;
int32_t value; int32_t value;
}; };
typedef char ba_input_event_abi[
(sizeof(struct input_event) == 2 * sizeof(unsigned long) + 8) ? 1 : -1];
enum watch_filter { enum watch_filter {
WATCH_ALL = 0, WATCH_ALL = 0,
WATCH_SWITCHES, WATCH_SWITCHES,
@@ -170,17 +180,22 @@ static BA_UNUSED int device_has_code(int fd, unsigned int ev, unsigned int code)
static BA_UNUSED int wanted_device(int fd, enum watch_filter filter) static BA_UNUSED int wanted_device(int fd, enum watch_filter filter)
{ {
const char *glob_override = getenv("BANANARCHY_INPUT_GLOB");
if(glob_override && *glob_override)
return 1;
if(filter == WATCH_ALL) if(filter == WATCH_ALL)
return 1; return 1;
if(filter == WATCH_SWITCHES) { if(filter == WATCH_SWITCHES) {
return device_has_code(fd, EV_SW, SW_LID) || return device_has_code(fd, EV_SW, SW_LID) ||
device_has_code(fd, EV_SW, SW_KEYPAD_SLIDE); device_has_code(fd, EV_SW, SW_KEYPAD_SLIDE);
} }
/* The End/Power key lives on a KEY_POWER-only device (pm8941_pwrkey), /* The End/Power key lives on a KEY_POWER-only device (pm8941_pwrkey) and
* so it must be watched too or the third outer button is invisible. */ * the left-side button on 2720 Flip emits KEY_CAMERA on the matrix keypad,
* so watch both alongside the volume keys. */
return device_has_code(fd, EV_KEY, KEY_VOLUMEUP) || return device_has_code(fd, EV_KEY, KEY_VOLUMEUP) ||
device_has_code(fd, EV_KEY, KEY_VOLUMEDOWN) || device_has_code(fd, EV_KEY, KEY_VOLUMEDOWN) ||
device_has_code(fd, EV_KEY, KEY_POWER); device_has_code(fd, EV_KEY, KEY_POWER) ||
device_has_code(fd, EV_KEY, KEY_CAMERA);
} }
static BA_UNUSED void prune_devices(struct watch_list *list) static BA_UNUSED void prune_devices(struct watch_list *list)
@@ -196,10 +211,13 @@ static BA_UNUSED void prune_devices(struct watch_list *list)
static BA_UNUSED void scan_devices(struct watch_list *list, enum watch_filter filter) static BA_UNUSED void scan_devices(struct watch_list *list, enum watch_filter filter)
{ {
const char *pattern = getenv("BANANARCHY_INPUT_GLOB");
glob_t gl; glob_t gl;
size_t i; size_t i;
prune_devices(list); prune_devices(list);
if(glob("/dev/input/event*", 0, NULL, &gl) != 0) if(!pattern || !*pattern)
pattern = "/dev/input/event*";
if(glob(pattern, 0, NULL, &gl) != 0)
return; return;
for(i = 0; i < gl.gl_pathc && list->count < WATCH_MAX; i++) { for(i = 0; i < gl.gl_pathc && list->count < WATCH_MAX; i++) {
const char *path = gl.gl_pathv[i]; const char *path = gl.gl_pathv[i];
@@ -234,6 +252,22 @@ static BA_UNUSED void scan_devices(struct watch_list *list, enum watch_filter fi
globfree(&gl); globfree(&gl);
} }
static BA_UNUSED int is_non_flip_profile(void)
{
const char *override = getenv("BANANARCHY_LID_PROFILE");
const char *path = (override && *override) ? override :
"/usr/share/bananarchy/lid-profile";
FILE *handle = fopen(path, "r");
char buf[32] = "";
if(!handle)
return 0;
if(!fgets(buf, sizeof(buf), handle))
buf[0] = '\0';
fclose(handle);
buf[strcspn(buf, " \t\r\n")] = '\0';
return buf[0] != '\0' && strcmp(buf, "flip") != 0;
}
static BA_UNUSED long long now_ms(void) static BA_UNUSED long long now_ms(void)
{ {
struct timespec ts; struct timespec ts;
+19
View File
@@ -301,6 +301,25 @@ void finalizeWavHeader(const std::string& path) {
} }
void wakeDisplayHardware(Display* dpy) { void wakeDisplayHardware(Display* dpy) {
int profFd = ::open("/usr/share/bananarchy/lid-profile", O_RDONLY | O_CLOEXEC);
bool isFlip = false;
if (profFd >= 0) {
char profBuf[16] {};
ssize_t pn = ::read(profFd, profBuf, sizeof(profBuf) - 1);
::close(profFd);
isFlip = (pn >= 4 && std::strncmp(profBuf, "flip", 4) == 0 &&
(profBuf[4] == '\0' || profBuf[4] == '\n' || profBuf[4] == '\r'));
}
int lidFd = isFlip ? ::open("/run/bananarchy/lid-state", O_RDONLY | O_CLOEXEC) : -1;
if (lidFd >= 0) {
char lidBuf[32] {};
ssize_t n = ::read(lidFd, lidBuf, sizeof(lidBuf) - 1);
::close(lidFd);
if (n >= 6 && std::strncmp(lidBuf, "closed", 6) == 0) {
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
return;
}
}
int saved = readIntFile("/tmp/sxmo_saved_brightness", -1); int saved = readIntFile("/tmp/sxmo_saved_brightness", -1);
if (saved <= 1) { if (saved <= 1) {
saved = readIntFile("/sys/class/backlight/backlight/max_brightness", 14); saved = readIntFile("/sys/class/backlight/backlight/max_brightness", 14);
+30 -4
View File
@@ -84,12 +84,26 @@ void writeSysfsStr(const char* path, const char* val) {
} }
} }
bool isLidClosed() {
return readSmallFileTrimmed("/usr/share/bananarchy/lid-profile") == "flip" &&
readSmallFileTrimmed("/run/bananarchy/lid-state") == "closed";
}
bool isScreenBlanked() { bool isScreenBlanked() {
if (isLidClosed()) {
return true;
}
std::string br = readSmallFileTrimmed("/sys/class/backlight/backlight/brightness"); std::string br = readSmallFileTrimmed("/sys/class/backlight/backlight/brightness");
return (!br.empty() && std::atoi(br.c_str()) <= 0); return (!br.empty() && std::atoi(br.c_str()) <= 0);
} }
void blankScreenBacklight() { void blankScreenBacklight() {
if (isLidClosed() &&
readSmallFileTrimmed("/run/bananarchy/cover-backlight") == "1") {
writeSysfsStr("/sys/class/leds/white:kbd_backlight/brightness", "0");
writeSysfsStr("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor", "powersave");
return;
}
std::string cur = readSmallFileTrimmed("/sys/class/backlight/backlight/brightness"); std::string cur = readSmallFileTrimmed("/sys/class/backlight/backlight/brightness");
if (!cur.empty() && std::atoi(cur.c_str()) >= 1) { if (!cur.empty() && std::atoi(cur.c_str()) >= 1) {
std::string line = std::to_string(std::atoi(cur.c_str())) + "\n"; std::string line = std::to_string(std::atoi(cur.c_str())) + "\n";
@@ -102,6 +116,10 @@ void blankScreenBacklight() {
} }
void wakeScreenBacklight() { void wakeScreenBacklight() {
if (isLidClosed()) {
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
return;
}
writeSysfsStr("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor", "schedutil"); writeSysfsStr("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor", "schedutil");
std::string cur = readSmallFileTrimmed("/tmp/sxmo_saved_brightness"); std::string cur = readSmallFileTrimmed("/tmp/sxmo_saved_brightness");
int val = std::atoi(cur.c_str()); int val = std::atoi(cur.c_str());
@@ -575,7 +593,9 @@ int locker_run_main(int argc, char** argv) {
if (!visible || isCallScreenVisible()) { if (!visible || isCallScreenVisible()) {
return; return;
} }
XRaiseWindow(dpy, win); if (!isLidClosed()) {
XRaiseWindow(dpy, win);
}
XSetInputFocus(dpy, win, RevertToParent, CurrentTime); XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
XFlush(dpy); XFlush(dpy);
grabHeld = false; grabHeld = false;
@@ -814,10 +834,11 @@ int locker_run_main(int argc, char** argv) {
if (!visible) { if (!visible) {
XMapRaised(dpy, win); XMapRaised(dpy, win);
XMoveResizeWindow(dpy, win, 0, 0, kScreenWidth, kScreenHeight); XMoveResizeWindow(dpy, win, 0, 0, kScreenWidth, kScreenHeight);
XSync(dpy, False);
visible = true; visible = true;
} }
grabLockerInput(); grabLockerInput();
if (blankDisplay) { if (blankDisplay || isLidClosed()) {
setSxmoStateFile("screenoff"); setSxmoStateFile("screenoff");
blankScreenBacklight(); blankScreenBacklight();
wasScreenBlanked = true; wasScreenBlanked = true;
@@ -873,7 +894,7 @@ int locker_run_main(int argc, char** argv) {
}; };
auto handleKeyInput = [&](unsigned int kc, unsigned int state, KeySym sym) { auto handleKeyInput = [&](unsigned int kc, unsigned int state, KeySym sym) {
if (!visible) { if (!visible || isLidClosed()) {
return; return;
} }
int64_t now = nowMs(); int64_t now = nowMs();
@@ -1035,6 +1056,10 @@ int locker_run_main(int argc, char** argv) {
continue; continue;
} }
if (cmd == "WAKE") { if (cmd == "WAKE") {
if (isLidClosed()) {
runAsyncArgv("/usr/bin/bananarchy-lid-gate.sh", "wake");
continue;
}
if (::access(kLockFlagPath, F_OK) == 0 || visible) { if (::access(kLockFlagPath, F_OK) == 0 || visible) {
if (!visible) { if (!visible) {
lockPhone(false); lockPhone(false);
@@ -1119,7 +1144,8 @@ int locker_run_main(int argc, char** argv) {
} else if (!callNow && callWasActive) { } else if (!callNow && callWasActive) {
grabLockerInput(); grabLockerInput();
render(); render();
} else if (!callNow && !grabHeld && !isScreenBlanked()) { } else if (!callNow && !grabHeld &&
(!isScreenBlanked() || isLidClosed())) {
grabLockerInput(); grabLockerInput();
} }
callWasActive = callNow; callWasActive = callNow;