Drive the 2720 Flip cover panel through the kernel panel driver
Autonomous testing (clean reboot, kernel SPI statistics, kHz GPIO sweeps, CS0/CS1 register reads, battery/ALS/hwmon checks, host webcam differential imaging) showed all twelve userspace PROBE cases delivered complete, error-free SPI traffic while the cover stayed dark. The QUP5 pinctrl group has one CS line and gpio110 (the kernel panel-mipi-dbi-spi driver's D/C) is shared behind the gpio13 bus switch, so no userspace D/C framing can work. backend = kernel is now the default. While the flip is closed the compiled cover daemon claims only gpio13 (mux) and gpio23 (cover reset), switches the bus to the cover and forces a DPMS off/on cycle through bananarchy-cover-dpms.sh reinit; mipi_dbi_enable() then replays the kernel's firmware init sequence onto the external panel with CS0 and gpio110 D/C. The cover UI is rendered as a 240x240 XR24 damage rect at the top of /dev/fb0 using the fbdev stride, which makes mipi_dbi set a 240x240 address window. The main backlight and keypad stay at 0, so only the outer panel can light. On open the mux returns to the internal panel and the lid daemon requests a reinit after an 80 ms settle. Live verification: closed -> backend=kernel-dark (DPMS off); BUTTON -> backend=kernel, dpms=On, gpio13 high, 172800 non-zero bytes of cover UI in /dev/fb0, kernel spi0.0 +460899 bytes and userspace spi0.1 +0, zero SPI errors; BLANK -> kernel-dark/DPMS off; LID OPEN -> mux=free, gpio13 low. Main backlight and keypad stayed at 0 throughout. All spidev/8-bit/9-bit paths, PROBE, bananarchy-cover-probe.sh and backend = fb|spidev|none remain as runtime rollback paths. New host test scripts/test-cover-kernel.py plus check-rebuild.sh guards. Rebuilt the a1108/dejavu nokia-beatles image and pinned the verified hash ce0542321990a8cff8ab122c0a47c0684fcc7e3d5f6fc97e74b3b0ea4c4826b5 in check-rebuild.sh. e2fsck -fn passed on both partitions, debugfs confirms the rebuilt daemons, helper and config byte-for-byte, and the bootfs sync, boot image check, artifact sync, host tests and rebuild preflight all pass. Limitation: Xorg shares /dev/fb0, so its repaints can still overwrite part of the cover UI; a dedicated override-redirect cover compositor is next. Physical illumination is still unverified from the host.
This commit is contained in:
1 parent
5f8b7c88ac
commit
c939687138
15 files changed
+468
-21
No files matched your search
@@ -79,6 +79,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, `
|
||||
- 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
|
||||
`scripts/test-cover-dt.py` / `scripts/test-cover-spidev.py` guards.
|
||||
- The shipping cover backend is `backend = kernel`: the kernel `panel-mipi-dbi-spi` driver owns CS0 and the shared gpio110 D/C. Keep `bananarchy-cover-dpms.sh reinit`, the gpio13 mux claim, the 240x240 `/dev/fb0` damage rect, the main-backlight-off gate and `scripts/test-cover-kernel.py`. Keep `spidev`/`fb`/`none` and PROBE as rollback paths.
|
||||
- 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`. Every main-panel
|
||||
wake path must call `bananarchy-lid-gate.sh`; a closed flip may only light the cover. `sxmo_state.sh set unlock` is
|
||||
|
||||
@@ -13,6 +13,16 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
||||
|
||||
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
|
||||
|
||||
### Kernel-owned cover panel path (option b)
|
||||
|
||||
- **Why**: after a clean reboot, the kernel's own SPI statistics showed all twelve userspace PROBE cases delivered complete, error-free transfers (230558 B per 9-bit frame, 115279 B per 8-bit frame, zero `errors`/`timedout` and zero dmesg failures) while the cover stayed dark. MISO reads return zeros (write-only panels), no TE toggles on any of 64 TLMM lines at kHz sampling, battery voltage is frozen, there is no current/ALS sensor and only one PWM backlight. The QUP5 pinctrl group has a single CS line and gpio110 (the kernel panel driver's D/C) is shared behind the gpio13 bus switch, so no userspace D/C framing can work.
|
||||
- **Switch**: `backend = kernel` is now the default. While the flip is closed the compiled cover daemon claims only gpio13 (mux) and gpio23 (cover reset), switches the bus to the cover, and forces a DPMS off/on cycle through `bananarchy-cover-dpms.sh reinit`; `mipi_dbi_enable()` then replays the kernel's firmware init sequence onto the external panel with CS0 and gpio110 D/C. The cover UI is rendered as a 240x240 XR24 damage rect at the top of `/dev/fb0` (using the fbdev stride), which makes `mipi_dbi` set a 240x240 address window matching the cover's native geometry. `FBIOBLANK`/DPMS off blanks it again. The main backlight and keypad stay at 0, so only the outer panel can light. On open the mux returns to the internal panel and the lid daemon requests a `reinit` after an 80 ms settle so the kernel re-initialises the main panel.
|
||||
- **Rollback**: `backend = spidev` (userspace GC9305), `backend = fb` (opt-in `/dev/fb1` DT) and `backend = none` remain; all polarity/word-width keys, PROBE and `bananarchy-cover-probe.sh` are kept for the legacy path. `SET backend ...` switches at runtime.
|
||||
- **Guards**: `scripts/test-cover-kernel.py` runs the daemon in simulation against a fake fbdev/backlight/DPMS helper and verifies open-flip silence, mux claim/restore, reinit-on-BUTTON, frame rendering, blanking and the lit-main-backlight block. `scripts/check-rebuild.sh` guards the source, config, helper and lid-daemon reinit.
|
||||
- **Limitation**: Xorg shares `/dev/fb0`, so its repaints can still overwrite part of the cover UI; a dedicated override-redirect cover compositor is the next step. Physical illumination remains unverified from the host.
|
||||
- **Live verification**: with the flip closed, `backend=kernel-dark` blanked the cover; `BUTTON` switched to `backend=kernel`, `dpms=On`, gpio13 high (mux on cover), rendered 172800 non-zero bytes of cover UI into the top 240x240 of `/dev/fb0`, and made the **kernel** `spi0.0` push 460899 bytes while the userspace `spi0.1` pushed 0 — zero SPI errors. `BLANK` returned `kernel-dark`/DPMS off; `LID OPEN` released the mux (gpio13 low, `mux=free`). Main backlight and keypad stayed at 0 throughout.
|
||||
- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu`; verified raw hash `ce0542321990a8cff8ab122c0a47c0684fcc7e3d5f6fc97e74b3b0ea4c4826b5`, pinned by `scripts/check-rebuild.sh`. `e2fsck -fn` passed on both partitions, `debugfs` confirms the rebuilt daemons, helper and config byte-for-byte, and the bootfs sync, boot image check, artifact sync, host tests and rebuild preflight pass. The standalone boot image hash is unchanged.
|
||||
|
||||
### Cover panel hardware sign-off path after the button regression
|
||||
|
||||
- **Live diagnosis**: with the flip physically closed, `bananarchy-coverctl BUTTON`, `WAKE`, `bananarchy-lid-gate.sh wake` and `sxmo_state.sh set unlock` all reached `backend=spidev visible=1 mux=closed`, and the daemon held `/dev/spidev0.1`, the gpiochip and two line handles. So the wake chain is intact; the outer panel itself never reacts to the frames. Register-ID reads over SPI return zeros for both chip selects (the panels are write-only), and gpio21 stays static, so readback/TE cannot be used to confirm wiring. A reversible `panel-mipi-dbi-spi`/`spidev` rebind on `spi0.0` proved CS0 + the kernel-owned gpio110 D/C path is also unreadable; the phone was fully restored (`/dev/dri/card0`, `/dev/fb0`, Xorg and dwm back).
|
||||
|
||||
@@ -51,6 +51,8 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
|
||||
- **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.
|
||||
- **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 main network indicators until the same **Config -> Screen blank** timeout expires with no further button press. `bananarchy-volume-keys` turns the external keys into trusted cover wake events, `bananarchy-cover-status.sh` publishes modem/Wi-Fi indicators from network events, and the daemon blocks in `poll()` with no timer while off. **The external 240x240 GC9305 is now driven on the shipping single-panel image**: with the flip closed the daemon claims gpio13 (SPI mux), gpio21 (D/C) and gpio23 (reset) through `/dev/gpiochip0`, replays `/lib/firmware/nokia,beatles-gc9305-ext-panel.bin` over `/dev/spidev0.1` at the verified 25 MHz, and pushes RGB565 frames, but only while the main panel is DPMS-off; on open it sends display-off, restores the mux to the internal panel and releases the panel lines before Xorg can flush another main-panel frame. `backend = auto` prefers `/dev/fb1` when the opt-in two-panel DT is installed. All mux/D-C/reset polarities are config keys plus live `bananarchy-coverctl SET` knobs, and `SET backend none` is a one-command rollback. The two-panel `spi-mux` DT (`devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`, built with `scripts/build-beatles-cover-panel.py`) stays **opt-in**: a live test produced `/dev/fb1` (240x240, 32bpp) but darkened the main panel, so the shipping DTB keeps the verified single-panel layout until gpio13 and the external D/C/reset polarities are probed with eyes on the phone. `FBIOBLANK` powers the cover fbdev down when it is off, `bananarchy-cover-diagnose.sh` reports the live panel state, `scripts/test-cover-idle.py`, `scripts/test-cover-spidev.py` and `scripts/test-cover-dt.py` validate the renderer, the closed-flip backend and both DT layouts on the host, and `scripts/build-beatles-no-cover-dtb.py` builds the single-panel rollback. **Closing the flip now blanks and locks the main panel in tens of milliseconds**: an `EV_SW` edge triggers an immediate hall re-read, and the compiled lid daemon writes the lid state, lock flag, Sxmo state and backlights synchronously before any shell hook runs. While closed, `bananarchy-lid-gate.sh` blocks every main-panel wake (dwm, Sxmo hooks, incoming calls, external keys) and forwards it as a cover `WAKE`, so the three side buttons and any event can only light the outer panel; opening the flip instantly hands the shared bus back to the main panel. See `scripts/test-lid-gate.py`. The external panel wiring is still pending physical sign-off: `bananarchy-cover-idle` defaults to 9-bit MIPI DBI (D/C in bit 8, no DC GPIO) and also supports the old 8-bit D/C-on-gpio21 path (`spi_word_bits`), and `bananarchy-cover-probe.sh` walks twelve polarity/clock/word-width cases with `TEST bars` while the flip is closed; `STATUS probe=case N/12` identifies the working one.
|
||||
|
||||
On the shipping single-panel image the cover is driven by the **kernel** `panel-mipi-dbi-spi` driver (`backend = kernel`): closing the flip switches the gpio13 bus mux to the external GC9305 and a DPMS off/on cycle makes the kernel replay its init sequence with CS0 and the shared gpio110 D/C, while the cover UI is drawn into a 240x240 region of `/dev/fb0`. The main backlight and keypad stay dark; opening the flip restores the mux and re-initialises the main panel. The userspace `spidev` backend, 9-bit MIPI DBI mode and `bananarchy-cover-probe.sh` are retained as rollback paths.
|
||||
- **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.
|
||||
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
# /home/user/.config/bananarchy/cover-display.conf and are applied by
|
||||
# the xcover DWM plugin at session start.
|
||||
|
||||
# auto = /dev/fb1 (opt-in two-panel spi-mux DT) when present, otherwise the
|
||||
# compiled /dev/spidev0.1 backend while the flip is closed. Both panels share
|
||||
# QUP5 SPI through the gpio13 mux, so the userspace backend is NEVER used with
|
||||
# the flip open: the main 240x320 panel keeps the bus then. fb = fbdev only,
|
||||
# spidev = force spidev, none = keep the bus untouched (rollback).
|
||||
backend = auto
|
||||
# kernel = the default: the kernel panel-mipi-dbi-spi driver drives whichever
|
||||
# GC9305 is behind the gpio13 bus switch, using CS0 and its own gpio110 D/C.
|
||||
# While the flip is closed the daemon switches the mux to the cover, forces a
|
||||
# DPMS re-init so the kernel replays its init sequence there, and renders the
|
||||
# cover UI into /dev/fb0; the main backlight and keypad stay dark. On open the
|
||||
# mux returns to the internal panel and the kernel re-initialises it.
|
||||
# auto = /dev/fb1 when the opt-in two-panel DT is present, otherwise spidev;
|
||||
# fb/spidev force those legacy paths, none keeps the bus untouched (rollback).
|
||||
backend = kernel
|
||||
main_fb_device = /dev/fb0
|
||||
kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh
|
||||
fb_device = /dev/fb1
|
||||
spidev_device = /dev/spidev0.1
|
||||
gpiochip_device = /dev/gpiochip0
|
||||
@@ -44,8 +49,9 @@ reset_assert_level = 0
|
||||
reset_idle_level = 1
|
||||
# Keep the verified internal-panel clock on the shared bus.
|
||||
spi_speed_hz = 25000000
|
||||
# The KaiOS downstream DTS labels gpio21 "TE" and Qualcomm MDSS SPI sends
|
||||
# D/C as the ninth bit, so the cover panel may be 8-bit (D/C on gpio21) or
|
||||
# Legacy userspace spidev backend, retained as a rollback path. The KaiOS
|
||||
# downstream DTS labels gpio21 "TE" and Qualcomm MDSS SPI sends D/C as the
|
||||
# ninth bit, so the cover panel may be 8-bit (D/C on gpio21) or
|
||||
# 9-bit MIPI DBI (D/C in bit 8, no DC GPIO). 8 keeps the current wiring;
|
||||
# 9 releases gpio21 and sends every byte as a 9-bit word. Until the physical
|
||||
# sign-off is done, use "bananarchy-coverctl PROBE" repeatedly while the flip
|
||||
|
||||
@@ -41,6 +41,7 @@ else
|
||||
fi
|
||||
printf 'DRM cards : %s\n' "$(ls /dev/dri/card* 2>/dev/null | tr '\n' ' ')"
|
||||
printf 'main panel dpms : %s\n' "$(cat /sys/class/drm/card0-SPI-1/dpms 2>/dev/null || printf 'unknown')"
|
||||
printf 'main fbdev : %s\n' "$(cat /sys/class/graphics/fb0/virtual_size 2>/dev/null || printf 'absent')"
|
||||
printf 'fbdev nodes : %s\n' "$(ls /dev/fb* 2>/dev/null | tr '\n' ' ')"
|
||||
for mod in mux_core mux_gpio spi_mux panel_mipi_dbi spidev; do
|
||||
if grep -q "^$mod " /proc/modules 2>/dev/null; then
|
||||
@@ -61,7 +62,7 @@ if [ -r /sys/kernel/debug/gpio ]; then
|
||||
fi
|
||||
if [ -r "$CONF" ]; then
|
||||
printf 'backend config :\n'
|
||||
grep -E '^(backend|spi_device|spi_mux_gpio|spi_dc_gpio|spi_reset_gpio|mux_open_level|mux_closed_level|dc_command_level|dc_data_level|reset_assert_level|reset_idle_level|spi_speed_hz|spi_word_bits) ' "$CONF" | sed 's/^/ /'
|
||||
grep -E '^(backend|main_fb_device|kernel_dpms_helper|spi_device|spi_mux_gpio|spi_dc_gpio|spi_reset_gpio|mux_open_level|mux_closed_level|dc_command_level|dc_data_level|reset_assert_level|reset_idle_level|spi_speed_hz|spi_word_bits) ' "$CONF" | sed 's/^/ /'
|
||||
fi
|
||||
if [ -x "$COVERCTL" ]; then
|
||||
printf 'daemon : %s\n' "$("$COVERCTL" STATUS 2>/dev/null || printf 'not answering')"
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Replay the kernel panel-mipi-dbi-spi init sequence onto whichever GC9305 is
|
||||
# currently behind the gpio13 bus switch. A DPMS off/on cycle makes
|
||||
# mipi_dbi_enable() rerun the firmware command stack with CS0 and gpio110 D/C;
|
||||
# with the mux on the cover that initialises the 240x240 external panel.
|
||||
set -u
|
||||
export DISPLAY="${DISPLAY:-:0}"
|
||||
case "${1:-}" in
|
||||
reinit)
|
||||
xset dpms force off >/dev/null 2>&1 || true
|
||||
sleep 0.08
|
||||
xset dpms force on >/dev/null 2>&1 || true
|
||||
;;
|
||||
on)
|
||||
xset dpms force on >/dev/null 2>&1 || true
|
||||
;;
|
||||
off)
|
||||
xset dpms force off >/dev/null 2>&1 || true
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: %s [reinit|on|off]\n' "${0##*/}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -373,7 +373,7 @@ fi
|
||||
echo "[check] Known-good flashable image set..."
|
||||
for pair in \
|
||||
"69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \
|
||||
"57d140e9cdf05631a6620b639d143350b9984b2170592fb927c93bfb18f67a2b images/bananarchy-nokia-beatles.img" \
|
||||
"ce0542321990a8cff8ab122c0a47c0684fcc7e3d5f6fc97e74b3b0ea4c4826b5 images/bananarchy-nokia-beatles.img" \
|
||||
"2b5c61aba307dbbda61f3b19a2ad5770f9854f41cba4e2c97e24efb7e20879f3 images/boot-bananarchy-nokia-beatles.img" \
|
||||
"b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do
|
||||
set -- $pair
|
||||
@@ -1510,7 +1510,9 @@ for token in 'cover_hw_release' 'cover_spi_draw' 'hw_init_panel' \
|
||||
fail "bananarchy-cover-idle.c lost the closed-flip spidev backend: $token"
|
||||
fi
|
||||
done
|
||||
for token in 'backend = auto' 'spi_device = /dev/spidev0.1' \
|
||||
for token in 'backend = kernel' 'main_fb_device = /dev/fb0' \
|
||||
'kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh' \
|
||||
'spi_device = /dev/spidev0.1' \
|
||||
'spi_mux_gpio = 13' 'spi_dc_gpio = 21' 'spi_reset_gpio = 23' \
|
||||
'mux_closed_level = 1' 'mux_open_level = 0' \
|
||||
'dc_command_level = 0' 'dc_data_level = 1' \
|
||||
@@ -1525,6 +1527,21 @@ if ! grep -qF 'flip_open' "$COVER_SRC" || \
|
||||
! grep -qF 'cover_draw(&hw, fb_path, &state)' "$COVER_SRC"; then
|
||||
fail "the cover daemon no longer gates the shared bus on the flip state"
|
||||
fi
|
||||
if ! grep -qF 'cover_kernel_draw' "$COVER_SRC" || \
|
||||
! grep -qF 'cover_main_backlight_is_off' "$COVER_SRC" || \
|
||||
! grep -qF 'reinit' \
|
||||
"$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-dpms.sh" || \
|
||||
[ ! -x "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-dpms.sh" ]; then
|
||||
fail "the kernel-owned cover backend or its DPMS re-init helper is missing"
|
||||
fi
|
||||
if ! grep -qF 'bananarchy-cover-dpms.sh' \
|
||||
"$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c"; then
|
||||
fail "the lid daemon no longer re-initialises the kernel panel on open"
|
||||
fi
|
||||
if [ ! -x "$BASE_DIR/scripts/test-cover-kernel.py" ] || \
|
||||
! "$BASE_DIR/scripts/test-cover-kernel.py" >/dev/null 2>&1; then
|
||||
fail "host kernel-owned cover panel test failed"
|
||||
fi
|
||||
if [ ! -x "$BASE_DIR/scripts/test-cover-spidev.py" ]; then
|
||||
fail "missing host test scripts/test-cover-spidev.py"
|
||||
fi
|
||||
|
||||
Executable
+183
@@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Host test for the kernel-owned 2720 Flip cover panel path.
|
||||
|
||||
The daemon runs in SPI simulation mode against a fake /dev/fb0, fake main
|
||||
backlight and a logged DPMS helper. It verifies that the mux is only claimed
|
||||
while closed, that a wake forces a kernel DPMS re-init and renders a frame,
|
||||
that blanking powers the panel down, that opening restores the mux, and that
|
||||
a lit main backlight blocks the whole path.
|
||||
"""
|
||||
import os
|
||||
import pathlib
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
BASE = pathlib.Path(__file__).resolve().parent.parent
|
||||
SRC = BASE / "src/bananarchy-daemons/bananarchy-cover-idle.c"
|
||||
CONF = BASE / "overlay/rootfs/etc/bananarchy/cover-display.conf"
|
||||
HELPER = BASE / "overlay/rootfs/usr/bin/bananarchy-cover-dpms.sh"
|
||||
|
||||
|
||||
class Daemon:
|
||||
def __init__(self, root, exe, log, fb, bl, config):
|
||||
self.log = log
|
||||
self.fb = fb
|
||||
self.bl = bl
|
||||
self.sock = root / "cover.sock"
|
||||
self.client_path = root / "client.sock"
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"BANANARCHY_COVER_LOCK": str(root / "daemon.lock"),
|
||||
"BANANARCHY_COVER_MAIN_BLANK_CFG": str(root / "idle_blank"),
|
||||
"BANANARCHY_COVER_SPI_SIM": str(log),
|
||||
"BANANARCHY_COVER_MAIN_FB": str(fb),
|
||||
"BANANARCHY_COVER_DPMS_HELPER": "/bin/true",
|
||||
"BANANARCHY_COVER_BL_PATH": str(bl),
|
||||
"BANANARCHY_COVER_DPMS_PATH": str(root / "dpms"),
|
||||
})
|
||||
(root / "dpms").write_text("Off\n")
|
||||
self.proc = subprocess.Popen([str(exe), "--config", str(config)],
|
||||
env=env, stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
self.client = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
self.client.bind(str(self.client_path))
|
||||
self.client.settimeout(2)
|
||||
end = time.time() + 3
|
||||
while time.time() < end and not self.sock.exists():
|
||||
time.sleep(0.05)
|
||||
|
||||
def send(self, command):
|
||||
self.client.sendto(command.encode(), str(self.sock))
|
||||
try:
|
||||
return self.client.recv(512).decode().strip()
|
||||
except socket.timeout:
|
||||
return ""
|
||||
|
||||
def events(self):
|
||||
return self.log.read_text(encoding="utf-8", errors="replace").splitlines() \
|
||||
if self.log.is_file() else []
|
||||
|
||||
def wait(self, text, timeout=3.0):
|
||||
end = time.time() + timeout
|
||||
while time.time() < end:
|
||||
if any(text in line for line in self.events()):
|
||||
return True
|
||||
time.sleep(0.05)
|
||||
return False
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
self.send("QUIT")
|
||||
except OSError:
|
||||
pass
|
||||
self.client.close()
|
||||
try:
|
||||
self.proc.wait(timeout=3)
|
||||
except subprocess.TimeoutExpired:
|
||||
self.proc.kill()
|
||||
self.proc.wait()
|
||||
|
||||
|
||||
def fail(message):
|
||||
sys.stderr.write("FAIL: %s\n" % message)
|
||||
return 1
|
||||
|
||||
|
||||
def main():
|
||||
if not SRC.is_file() or not CONF.is_file() or not HELPER.is_file():
|
||||
return fail("missing cover daemon source, config or DPMS helper")
|
||||
conf = CONF.read_text(encoding="utf-8")
|
||||
for token in ("backend = kernel", "main_fb_device = /dev/fb0",
|
||||
"kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh"):
|
||||
if token not in conf:
|
||||
return fail("shipping config lost %s" % token)
|
||||
helper = HELPER.read_text(encoding="utf-8")
|
||||
if "dpms force off" not in helper or "dpms force on" not in helper:
|
||||
return fail("the DPMS helper no longer performs an off/on re-init")
|
||||
source = SRC.read_text(encoding="utf-8")
|
||||
for token in ("cover_kernel_draw", "cover_kernel_frame",
|
||||
"cover_main_backlight_is_off", "reinit"):
|
||||
if token not in source:
|
||||
return fail("cover daemon lost the kernel backend: %s" % token)
|
||||
print("[ok] kernel backend wiring is present")
|
||||
with tempfile.TemporaryDirectory(prefix="bananarchy-cover-kernel-") as tmp:
|
||||
root = pathlib.Path(tmp)
|
||||
exe = root / "cover-idle"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c11", "-O2", "-Wall", "-Wextra", "-Werror",
|
||||
"-I" + str(SRC.parent), str(SRC), "-o", str(exe)],
|
||||
capture_output=True, text=True)
|
||||
if build.returncode:
|
||||
sys.stderr.write(build.stderr)
|
||||
return 1
|
||||
print("[ok] host build of the compiled cover daemon")
|
||||
fb = root / "fb0"
|
||||
fb.write_bytes(b"\x00" * (240 * 320 * 4))
|
||||
bl = root / "brightness"
|
||||
bl.write_text("0\n")
|
||||
log = root / "spi.log"
|
||||
(root / "idle_blank").write_text("300\n")
|
||||
config = root / "cover.conf"
|
||||
config.write_text(
|
||||
"socket_path = %s\nfb_device = %s\nbacklight_path = %s\n"
|
||||
"blank_timeout = 2\nbackend = kernel\nmain_fb_device = %s\n"
|
||||
"kernel_dpms_helper = /bin/true\nmux_closed_level = 1\n"
|
||||
"mux_open_level = 0\nreset_assert_level = 0\nreset_idle_level = 1\n" %
|
||||
(root / "cover.sock", root / "no-fb1", root / "backlight", fb))
|
||||
daemon = Daemon(root, exe, log, fb, bl, config)
|
||||
try:
|
||||
time.sleep(0.3)
|
||||
if daemon.events():
|
||||
return fail("an open flip claimed the mux or touched DPMS: %s" %
|
||||
daemon.events()[:4])
|
||||
print("[ok] open flip: no mux claim, no DPMS, no frame")
|
||||
|
||||
daemon.send("LID CLOSED")
|
||||
if not daemon.wait("dpms off"):
|
||||
return fail("closing the flip did not blank the cover")
|
||||
if not any(e == "gpio 1 1" for e in daemon.events()):
|
||||
return fail("the mux was not switched to the external panel")
|
||||
print("[ok] closed flip: mux to cover, panel blanked")
|
||||
|
||||
daemon.send("BUTTON")
|
||||
if not daemon.wait("dpms reinit") or not daemon.wait("kernel frame lit=1"):
|
||||
return fail("BUTTON did not force a kernel re-init and draw a frame")
|
||||
if not any(fb.read_bytes()):
|
||||
return fail("the cover UI was not rendered into the main framebuffer")
|
||||
if "kernel" not in daemon.send("STATUS"):
|
||||
return fail("STATUS does not report the kernel backend")
|
||||
print("[ok] BUTTON: DPMS re-init and cover UI rendered to fbdev")
|
||||
|
||||
daemon.send("BLANK")
|
||||
if not daemon.wait("dpms off"):
|
||||
return fail("blanking did not power the cover down")
|
||||
daemon.send("LID OPEN")
|
||||
if not daemon.wait("release"):
|
||||
return fail("opening the flip did not release the mux")
|
||||
if not any(e == "gpio 0 1" for e in daemon.events()):
|
||||
return fail("the mux was not restored to the internal panel")
|
||||
print("[ok] blank and open: panel off, mux restored")
|
||||
|
||||
# A lit main backlight must block the whole kernel path.
|
||||
tail = len(daemon.events())
|
||||
daemon.send("LID CLOSED")
|
||||
bl.write_text("14\n")
|
||||
daemon.send("BUTTON")
|
||||
time.sleep(0.3)
|
||||
if "pending" not in daemon.send("STATUS"):
|
||||
return fail("a lit main backlight did not block the kernel backend")
|
||||
if any(e.startswith("kernel frame") or e.startswith("dpms reinit")
|
||||
for e in daemon.events()[tail:]):
|
||||
return fail("the kernel backend drew with the main backlight lit")
|
||||
print("[ok] lit main backlight blocks the kernel backend")
|
||||
finally:
|
||||
daemon.close()
|
||||
print("kernel-owned cover panel: all checks passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -42,8 +42,8 @@ class Cover:
|
||||
self.client_path.unlink()
|
||||
self.client = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
self.client.bind(str(self.client_path))
|
||||
self.client.settimeout(2)
|
||||
deadline = time.time() + 3
|
||||
self.client.settimeout(3)
|
||||
deadline = time.time() + 5
|
||||
while time.time() < deadline and not self.sock_path.exists():
|
||||
time.sleep(0.05)
|
||||
|
||||
@@ -59,7 +59,7 @@ class Cover:
|
||||
return []
|
||||
return self.log.read_text(encoding="utf-8", errors="replace").splitlines()
|
||||
|
||||
def wait_event(self, text, timeout=3.0):
|
||||
def wait_event(self, text, timeout=5.0):
|
||||
end = time.time() + timeout
|
||||
while time.time() < end:
|
||||
if any(text in line for line in self.events()):
|
||||
@@ -146,7 +146,8 @@ def main():
|
||||
sys.stderr.write("FAIL: cover daemon lost %s\n" % token)
|
||||
return 1
|
||||
conf = CONFIG.read_text(encoding="utf-8")
|
||||
for token in ("backend = auto", "spi_device = /dev/spidev0.1",
|
||||
for token in ("backend = kernel", "main_fb_device = /dev/fb0",
|
||||
"spi_device = /dev/spidev0.1",
|
||||
"spi_mux_gpio", "spi_dc_gpio", "spi_reset_gpio",
|
||||
"mux_closed_level", "spi_speed_hz = 25000000", "dc_gpio = -1"):
|
||||
if token not in conf:
|
||||
|
||||
@@ -108,6 +108,16 @@ _Static_assert(sizeof(struct ba_gpiohandle_request) == 364,
|
||||
_Static_assert(sizeof(struct ba_spi_ioc_transfer) == 32,
|
||||
"spidev transfer ABI size");
|
||||
|
||||
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 *)"HOME=/home/user",
|
||||
(char *)"USER=user",
|
||||
(char *)"DISPLAY=:0",
|
||||
(char *)"XDG_RUNTIME_DIR=/run/user/10000",
|
||||
(char *)"SHELL=/bin/sh",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct cover_hw {
|
||||
char backend[16];
|
||||
char spi_path[128];
|
||||
@@ -128,6 +138,9 @@ struct cover_hw {
|
||||
int panel_lines;
|
||||
int probe_index;
|
||||
char probe_desc[96];
|
||||
char kernel_fb[128];
|
||||
char kernel_dpms[128];
|
||||
int kernel_lit;
|
||||
int sim;
|
||||
int spi_enabled;
|
||||
int fd_spi;
|
||||
@@ -885,6 +898,164 @@ static int cover_main_panel_is_off(void)
|
||||
return strncmp(buf, "Off", 3) == 0;
|
||||
}
|
||||
|
||||
/* --- Kernel-owned cover path ----------------------------------------------
|
||||
* The external panel sits behind the gpio13 bus switch on the same QUP5 bus
|
||||
* as the internal panel. The kernel panel-mipi-dbi-spi driver owns CS0, the
|
||||
* shared gpio110 D/C line and the firmware init stream, so userspace cannot
|
||||
* drive the cover with its own D/C framing. Instead, while the flip is closed
|
||||
* we switch the mux to the cover, release its reset, force a DRM DPMS off/on
|
||||
* cycle (which makes the kernel driver replay its init sequence onto the panel
|
||||
* now on the bus) and render the cover UI into the main framebuffer. The main
|
||||
* backlight and keypad stay at 0, so only the outer panel can light up.
|
||||
*/
|
||||
static void hw_dpms(struct cover_hw *hw, const char *mode)
|
||||
{
|
||||
char line[64];
|
||||
if(hw->sim) {
|
||||
snprintf(line, sizeof(line), "dpms %s", mode);
|
||||
hw_event(hw, line);
|
||||
return;
|
||||
}
|
||||
if(!hw->kernel_dpms[0])
|
||||
return;
|
||||
{
|
||||
char *const argv[] = { hw->kernel_dpms, (char *)mode, NULL };
|
||||
daemon_spawn_env(argv, (char *const *)session_env);
|
||||
}
|
||||
}
|
||||
|
||||
static int cover_kernel_claim(struct cover_hw *hw)
|
||||
{
|
||||
unsigned int offsets[2];
|
||||
unsigned char defaults[2];
|
||||
unsigned char values[2];
|
||||
int fd;
|
||||
if(hw->fd_mux >= 0 || hw->mux_claimed)
|
||||
return 1;
|
||||
offsets[0] = hw->mux_gpio;
|
||||
offsets[1] = hw->reset_gpio;
|
||||
defaults[0] = (unsigned char)hw->mux_open_level;
|
||||
defaults[1] = (unsigned char)hw->reset_idle_level;
|
||||
fd = hw_gpio_request(hw, offsets, defaults, 2);
|
||||
if(fd < 0)
|
||||
return 0;
|
||||
hw->fd_mux = fd;
|
||||
hw->mux_claimed = 1;
|
||||
values[0] = (unsigned char)hw->mux_closed_level;
|
||||
values[1] = (unsigned char)hw->reset_idle_level;
|
||||
return hw_gpio_set(hw, hw->fd_mux, values, 2);
|
||||
}
|
||||
|
||||
static void cover_kernel_release(struct cover_hw *hw)
|
||||
{
|
||||
unsigned char values[2];
|
||||
/* The spidev backend owns fd_mux too; only the kernel backend may release
|
||||
* it here, or its STATUS would lose the restored mux state. */
|
||||
if(strcmp(hw->backend, "kernel") != 0)
|
||||
return;
|
||||
if(!hw->mux_claimed)
|
||||
return;
|
||||
values[0] = (unsigned char)hw->mux_open_level;
|
||||
values[1] = (unsigned char)hw->reset_idle_level;
|
||||
hw_gpio_set(hw, hw->fd_mux, values, 2);
|
||||
hw_event(hw, "release");
|
||||
if(!hw->sim && hw->fd_mux >= 0)
|
||||
close(hw->fd_mux);
|
||||
hw->fd_mux = -1;
|
||||
hw->mux_claimed = 0;
|
||||
hw->kernel_lit = -1;
|
||||
}
|
||||
|
||||
static int cover_kernel_frame(struct cover_hw *hw, const struct state *state)
|
||||
{
|
||||
unsigned int width = COVER_SPI_WIDTH;
|
||||
unsigned int height = COVER_SPI_HEIGHT;
|
||||
unsigned int stride = width * 4;
|
||||
char sysfs[128];
|
||||
unsigned int parsed = 0;
|
||||
size_t size;
|
||||
unsigned char *mem;
|
||||
struct frame fb;
|
||||
int fd;
|
||||
char line[96];
|
||||
/* Match the DRM fbdev stride: 240x320 XR24 is padded to 1024 bytes/row.
|
||||
* Writing a 240x240 damage rect makes mipi_dbi set a 240x240 address
|
||||
* window, which is exactly the cover panel's native geometry. */
|
||||
snprintf(sysfs, sizeof(sysfs), "/sys/class/graphics/fb0/stride");
|
||||
if(read_uint_file(sysfs, &parsed) && parsed >= width * 4)
|
||||
stride = parsed;
|
||||
size = (size_t)stride * height;
|
||||
mem = calloc(1, size);
|
||||
if(!mem)
|
||||
return 0;
|
||||
fb.pixels = mem;
|
||||
fb.width = width;
|
||||
fb.height = height;
|
||||
fb.stride = stride;
|
||||
fb.bpp = 32;
|
||||
render_frame(&fb, state);
|
||||
snprintf(line, sizeof(line), "kernel frame lit=%d size=%zu",
|
||||
cover_is_lit(state), size);
|
||||
hw_event(hw, line);
|
||||
fd = open(hw->kernel_fb, O_RDWR | O_CLOEXEC);
|
||||
if(fd < 0) {
|
||||
free(mem);
|
||||
return hw->sim;
|
||||
}
|
||||
if(lseek(fd, 0, SEEK_SET) < 0 || !write_all(fd, mem, size)) {
|
||||
free(mem);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
fsync(fd);
|
||||
close(fd);
|
||||
free(mem);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *cover_kernel_draw(struct cover_hw *hw,
|
||||
const struct state *state)
|
||||
{
|
||||
int lit = cover_is_lit(state);
|
||||
if(!cover_kernel_claim(hw))
|
||||
return "none";
|
||||
if(lit != hw->kernel_lit) {
|
||||
if(lit) {
|
||||
hw_dpms(hw, "reinit");
|
||||
if(!hw->sim)
|
||||
poll(NULL, 0, 180);
|
||||
} else {
|
||||
hw_dpms(hw, "off");
|
||||
}
|
||||
hw->kernel_lit = lit;
|
||||
}
|
||||
if(lit && !cover_kernel_frame(hw, state))
|
||||
return "none";
|
||||
return lit ? "kernel" : "kernel-dark";
|
||||
}
|
||||
|
||||
/* The kernel backend keeps DPMS ON while the cover is lit (that is how the
|
||||
* DRM driver flushes to it), so its safety condition is the main backlight
|
||||
* being dark, not DPMS. */
|
||||
static int cover_main_backlight_is_off(void)
|
||||
{
|
||||
const char *path = getenv("BANANARCHY_COVER_BL_PATH");
|
||||
char buf[32];
|
||||
ssize_t got;
|
||||
int fd;
|
||||
if(!path || !*path)
|
||||
path = "/sys/class/backlight/backlight/brightness";
|
||||
fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||
if(fd < 0)
|
||||
return 1;
|
||||
got = read(fd, buf, sizeof(buf) - 1);
|
||||
close(fd);
|
||||
if(got <= 0)
|
||||
return 1;
|
||||
buf[got] = '\0';
|
||||
return atoi(buf) == 0;
|
||||
}
|
||||
|
||||
static const char *cover_draw(struct cover_hw *hw, const char *fb_path,
|
||||
const struct state *state)
|
||||
{
|
||||
@@ -894,14 +1065,23 @@ static const char *cover_draw(struct cover_hw *hw, const char *fb_path,
|
||||
strcmp(hw->backend, "none") != 0 && fb_present;
|
||||
if(flip_open) {
|
||||
cover_hw_release(hw);
|
||||
cover_kernel_release(hw);
|
||||
if(prefer_fb)
|
||||
return draw_frame(fb_path, state) ? "fb" : "none";
|
||||
return "idle";
|
||||
}
|
||||
if(strcmp(hw->backend, "none") == 0) {
|
||||
cover_hw_release(hw);
|
||||
cover_kernel_release(hw);
|
||||
return "none";
|
||||
}
|
||||
if(strcmp(hw->backend, "kernel") == 0) {
|
||||
if(!cover_main_backlight_is_off()) {
|
||||
cover_kernel_release(hw);
|
||||
return "pending";
|
||||
}
|
||||
return cover_kernel_draw(hw, state);
|
||||
}
|
||||
if(prefer_fb) {
|
||||
cover_hw_release(hw);
|
||||
return draw_frame(fb_path, state) ? "fb" : "none";
|
||||
@@ -1000,12 +1180,24 @@ static void cover_hw_init(struct cover_hw *hw)
|
||||
hw->word_bits = 9;
|
||||
hw->panel_lines = 1;
|
||||
hw->probe_index = -1;
|
||||
hw->kernel_lit = -1;
|
||||
safe_copy(hw->kernel_fb, sizeof(hw->kernel_fb), "/dev/fb0");
|
||||
safe_copy(hw->kernel_dpms, sizeof(hw->kernel_dpms),
|
||||
"/usr/bin/bananarchy-cover-dpms.sh");
|
||||
safe_copy(hw->probe_desc, sizeof(hw->probe_desc), "none");
|
||||
hw->fd_spi = -1;
|
||||
hw->fd_chip = -1;
|
||||
hw->fd_mux = -1;
|
||||
hw->fd_panel = -1;
|
||||
hw->fd_sim = -1;
|
||||
{
|
||||
const char *fb = getenv("BANANARCHY_COVER_MAIN_FB");
|
||||
const char *dp = getenv("BANANARCHY_COVER_DPMS_HELPER");
|
||||
if(fb && *fb)
|
||||
safe_copy(hw->kernel_fb, sizeof(hw->kernel_fb), fb);
|
||||
if(dp && *dp)
|
||||
safe_copy(hw->kernel_dpms, sizeof(hw->kernel_dpms), dp);
|
||||
}
|
||||
sim = getenv("BANANARCHY_COVER_SPI_SIM");
|
||||
if(sim && *sim) {
|
||||
safe_copy(hw->sim_path, sizeof(hw->sim_path), sim);
|
||||
@@ -1065,6 +1257,10 @@ static void read_config(const char *path, char *socket_path, size_t splen,
|
||||
safe_copy(hw->backend, sizeof(hw->backend), value);
|
||||
else if(strcmp(key, "spi_device") == 0)
|
||||
safe_copy(hw->spi_path, sizeof(hw->spi_path), value);
|
||||
else if(strcmp(key, "main_fb_device") == 0)
|
||||
safe_copy(hw->kernel_fb, sizeof(hw->kernel_fb), value);
|
||||
else if(strcmp(key, "kernel_dpms_helper") == 0)
|
||||
safe_copy(hw->kernel_dpms, sizeof(hw->kernel_dpms), value);
|
||||
else if(strcmp(key, "gpiochip_device") == 0)
|
||||
safe_copy(hw->gpio_path, sizeof(hw->gpio_path), value);
|
||||
else if(strcmp(key, "panel_firmware") == 0)
|
||||
@@ -1323,14 +1519,17 @@ static void reply_for(char *buffer, const struct state *state,
|
||||
if(strcmp(command, "PING") == 0) {
|
||||
snprintf(reply, len, "OK pong\n");
|
||||
} else if(strcmp(command, "STATUS") == 0) {
|
||||
const char *mux = "free";
|
||||
if(hw->mux_claimed)
|
||||
mux = strcmp(hw->backend, "kernel") == 0 ? "cover" :
|
||||
(hw->claimed ? "closed" : "open");
|
||||
snprintf(reply, len,
|
||||
"OK lid=%s backend=%s enabled=%d visible=%d blank_ms=%lld "
|
||||
"battery=%d call=%s sms=%d network=%s spi=%d mux=%s "
|
||||
"bits=%d probe=%s\n",
|
||||
state->lid, state->backend, state->enabled, state->visible,
|
||||
state->blank_ms, state->battery, state->call, state->sms,
|
||||
state->network, hw->spi_enabled,
|
||||
hw->mux_claimed ? (hw->claimed ? "closed" : "open") : "free",
|
||||
state->network, hw->spi_enabled, mux,
|
||||
hw->word_bits, hw->probe_desc);
|
||||
} else if(strcmp(command, "LID") == 0) {
|
||||
snprintf(reply, len, "OK lid=%s\n", state->lid);
|
||||
|
||||
@@ -75,8 +75,7 @@ static void run_sxmo_state(const char *action, const char *expected_lid)
|
||||
static void run_dpms(const char *mode)
|
||||
{
|
||||
char *const argv[] = {
|
||||
(char *)"/usr/bin/xset", (char *)"dpms", (char *)"force",
|
||||
(char *)mode, NULL
|
||||
(char *)"/usr/bin/bananarchy-cover-dpms.sh", (char *)mode, NULL
|
||||
};
|
||||
daemon_spawn_env(argv, (char *const *)session_env);
|
||||
}
|
||||
@@ -210,14 +209,17 @@ static void on_transition(int closed)
|
||||
} else {
|
||||
int bl = read_int_file(BRIGHTNESS_SAVE, 10);
|
||||
int kbd = read_int_file(KBD_SAVE, 1);
|
||||
/* Release the cover's shared SPI bus before relighting the main panel. */
|
||||
/* Release the cover's shared SPI bus before relighting the main panel.
|
||||
* The cover daemon restores the mux on this datagram; give it a moment so
|
||||
* the DPMS re-init below hits the internal panel, not the cover. */
|
||||
cover_send("OPEN");
|
||||
poll(NULL, 0, 80);
|
||||
unlink(LOCK_FLAG);
|
||||
write_session_file(state, "unlock");
|
||||
write_text_file(BL_POWER, "0");
|
||||
write_sysfs_int(BRIGHTNESS, bl);
|
||||
write_sysfs_int(KBD_BACKLIGHT, kbd);
|
||||
run_dpms("on");
|
||||
run_dpms("reinit");
|
||||
locker_send("CLOSE\n");
|
||||
run_sxmo_state("unlock", "open");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user