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

@@ -3,18 +3,18 @@
# /home/user/.config/bananarchy/cover-display.conf and are applied by
# the xcover DWM plugin at session start.
# kernel = the default shipping path. The KaiOS 3.10 DTS shows that both
# GC9305s share CS0, gpio110 D/C and one PMIC PWM backlight; gpio13 selects
# the panel, gpio23 is the external reset, and gpio21 is TE. While the flip is
# closed the daemon claims gpio13/gpio23, pulses reset, replays the stock
# 240x240 init through the kernel driver's debugfs command hook, and flushes a
# 240x240 /dev/fb0 damage rect. Live probing showed 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. The marker tells
# bananarchy-display-power-sync which side owns the bus. Opening the flip
# restores the mux, normal brightness and the internal panel. auto = /dev/fb1
# with the opt-in two-panel DT, otherwise spidev; fb/spidev force those legacy
# paths; none keeps the bus untouched.
# kernel = the default shipping path. 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; gpio13 selects the panel, gpio23 is the external reset, and gpio21
# is TE. While the flip is closed and lit, the daemon wakes DRM with gpio13 low,
# clears the normally-white internal 240x320 panel to solid black in DISPON so
# it blocks the shared backlight, switches gpio13 high, pulses gpio23, replays
# the stock 240x240 init through the kernel driver's debugfs command hook, and
# flushes a 240x240 /dev/fb0 damage rect. While dark, both panels sleep and
# DPMS Off powers down the panel regulators. Opening the flip restores gpio13
# low, normal brightness and the internal panel. auto = /dev/fb1 with the
# opt-in two-panel DT, otherwise spidev; fb/spidev force those legacy paths;
# none keeps the bus untouched.
backend = kernel
main_fb_device = /dev/fb0
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_power_path = /sys/class/backlight/backlight/bl_power
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
# 1 = external backlight active-low (duty 0 ON), 0 = active-high.
kernel_backlight_invert = 1
# 0 = shared PMIC MPP2 backlight active-high (stock 2720 Flip), 1 = active-low.
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
spidev_device = /dev/spidev0.1
gpiochip_device = /dev/gpiochip0
@@ -25,8 +25,10 @@ start_pre() {
mkdir -p /run/bananarchy
chmod 0755 /run/bananarchy
# /run is tmpfs: clear stale transition guards after every reboot.
rm -f /run/bananarchy/cover-bl-force \
/run/bananarchy/cover-power-state 2>/dev/null || true
rm -f /run/bananarchy/cover-backlight \
/run/bananarchy/cover-bl-force \
/run/bananarchy/cover-power-state \
/run/bananarchy/cover-runtime.conf 2>/dev/null || true
}
start() {
+9
View File
@@ -12,3 +12,12 @@ depend() {
after udev-settle
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
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
# could not process /etc/modules (it needs /bin/sed, which was missing on some
# 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
while [ "$i" -lt 5 ]; do
/sbin/modprobe -q "$mod" && break
@@ -9,6 +9,13 @@
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
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
Binary file not shown.
@@ -1,8 +1,9 @@
#!/bin/sh
# 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
# (via doas). The 2720 Flip shares one PWM backlight between both panels:
# it is active-low for the cover and active-high for the main panel.
# (via doas). The 2720 Flip shares one active-high PMIC MPP2 PWM backlight
# 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
# 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
FORCE_MARKER=/run/bananarchy/cover-bl-force
STATE_CACHE=/run/bananarchy/cover-power-state
LID_PROFILE="${BANANARCHY_LID_PROFILE:-/usr/share/bananarchy/lid-profile}"
LID_STATE=/run/bananarchy/lid-state
CONF=/etc/bananarchy/cover-display.conf
RUNTIME_CONF=/run/bananarchy/cover-runtime.conf
COVER_BL_LEVEL=14
COVER_BL_INVERT=1
COVER_BL_INVERT=0
FORCE=0
[ "${1:-}" = "force" ] && FORCE=1
@@ -29,12 +32,14 @@ if [ "$FORCE" -eq 0 ] && [ -f "$FORCE_MARKER" ]; then
exit 0
fi
if [ -r "$CONF" ]; then
_level=$(awk -F= '/^[[:space:]]*kernel_backlight_level[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$CONF" 2>/dev/null)
case "${_level:-}" in ''|*[!0-9]*) ;; *) COVER_BL_LEVEL="$_level" ;; esac
_invert=$(awk -F= '/^[[:space:]]*kernel_backlight_invert[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$CONF" 2>/dev/null)
case "${_invert:-}" in 0|1) COVER_BL_INVERT="$_invert" ;; esac
fi
for _cfg in "$CONF" "$RUNTIME_CONF"; do
if [ -r "$_cfg" ]; then
_level=$(awk -F= '/^[[:space:]]*kernel_backlight_level[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$_cfg" 2>/dev/null)
case "${_level:-}" in ''|*[!0-9]*) ;; *) COVER_BL_LEVEL="$_level" ;; esac
_invert=$(awk -F= '/^[[:space:]]*kernel_backlight_invert[[:space:]]*=/ {gsub(/[[:space:]]/, "", $2); print $2; exit}' "$_cfg" 2>/dev/null)
case "${_invert:-}" in 0|1) COVER_BL_INVERT="$_invert" ;; esac
fi
done
DPMS_PATH=
for _dpms in /sys/class/drm/card*-*/dpms; do
@@ -44,7 +49,9 @@ done
read_value() {
_path="$1"
_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"
}
@@ -69,20 +76,37 @@ force_dpms() {
br="$(read_value "$BR_PATH")"
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")"
lid="$(read_value "$LID_STATE")"
HAD_MARKER=0
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
LIT_BR=0
DARK_BR="$COVER_BL_LEVEL"
DARK_BLP=0
else
LIT_BR="$COVER_BL_LEVEL"
DARK_BR=0
DARK_BLP=4
fi
DARK_BR=0
DARK_BLP=4
DESIRED_BR="$br"
DESIRED_BLP="$blp"
@@ -91,27 +115,46 @@ DESIRED_KBD=""
DESIRED_KEY="normal"
if [ "$lid" = "open" ]; then
DESIRED_KEY="open:$COVER_BL_LEVEL:0:On:absent:$COVER_BL_INVERT"
DESIRED_BR="$COVER_BL_LEVEL"
rm -f "$COVER_MARKER" 2>/dev/null || true
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_DPMS="On"
rm -f "$COVER_MARKER" 2>/dev/null || true
elif [ -f "$COVER_MARKER" ]; then
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"
if [ "$marker" = "1" ]; then
DESIRED_KEY="lit:$LIT_BR:0:On:1:$COVER_BL_INVERT"
DESIRED_BR="$LIT_BR"
DESIRED_BLP="0"
else
DESIRED_KEY="dark:$DARK_BR:$DARK_BLP:On:0:$COVER_BL_INVERT"
DESIRED_BR="$DARK_BR"
DESIRED_BLP="$DARK_BLP"
fi
DESIRED_KBD="0"
elif [ "$lid" = "closed" ]; then
DESIRED_KEY="dark:$DARK_BR:$DARK_BLP:Off:absent:$COVER_BL_INVERT"
DESIRED_BR="$DARK_BR"
DESIRED_BLP="$DARK_BLP"
DESIRED_DPMS="Off"
DESIRED_KBD="0"
elif ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then
DESIRED_KEY="closed:0:4:Off:absent:$COVER_BL_INVERT"
DESIRED_BR="0"
DESIRED_BLP="4"
DESIRED_KEY="closed:$DARK_BR:$DARK_BLP:Off:absent:$COVER_BL_INVERT"
DESIRED_BR="$DARK_BR"
DESIRED_BLP="$DARK_BLP"
DESIRED_DPMS="Off"
DESIRED_KBD="0"
else
@@ -124,9 +167,9 @@ if [ "$FORCE" -eq 1 ]; then
printf '1\n' > "$FORCE_MARKER" 2>/dev/null || true
trap cleanup_force EXIT INT TERM HUP
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 "$BR_PATH" "$DESIRED_BR"
printf '%s\n' "$DESIRED_BR" > "$BR_PATH" 2>/dev/null || true
else
set_if_changed "$BL_POWER_PATH" "$DESIRED_BLP"
set_if_changed "$BR_PATH" "$DESIRED_BR"
@@ -2,7 +2,11 @@
# Get or set the unlocked idle screen-blank timeout (seconds).
# Config menu -> "Screen blank" writes ~/.config/sxmo/idle_blank_timeout.
# 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"
DEFAULT=300
@@ -33,6 +37,11 @@ notify_dwm() {
[ -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
get)
get_secs
@@ -50,7 +59,11 @@ case "${1:-get}" in
[ "$v" -le 86400 ] || v=86400
mkdir -p "$CFGDIR" 2>/dev/null || true
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_cover
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
# 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
/usr/bin/dwm-plugin dmenu close >/dev/null 2>&1 || true
if [ -p /tmp/dwm_plugin_locker.fifo ]; then
printf "CLOSE\n" > /tmp/dwm_plugin_locker.fifo 2>/dev/null || true
if [ ! -f /tmp/bananarchy_screen_locked ]; then
/usr/bin/dwm-plugin dmenu close >/dev/null 2>&1 || 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
xdotool key --clearmodifiers Escape >/dev/null 2>&1 || true
) &
first_iter=1
+4 -4
View File
@@ -27,16 +27,16 @@ transition() {
if [ "$state" = "unlock" ] && [ -f /tmp/bananarchy_screen_locked ]; then
state="lock"
printf '%s\n' "$state" > "$SXMO_STATE"
sxmo_wm.sh display on >/dev/null 2>&1 &
xlocker wake >/dev/null 2>&1 &
sxmo_wm.sh display on 3<&- >/dev/null 2>&1 &
xlocker wake 3<&- >/dev/null 2>&1 &
return 0
fi
if [ "$state" = "lock" ]; then
printf '1\n' > /tmp/bananarchy_screen_locked
xlocker >/dev/null 2>&1 &
xlocker 3<&- >/dev/null 2>&1 &
elif [ "$state" = "screenoff" ]; then
printf '1\n' > /tmp/bananarchy_screen_locked
xlocker screenoff >/dev/null 2>&1 &
xlocker screenoff 3<&- >/dev/null 2>&1 &
fi
sxmo_log "transitioning to stage $state"
+15 -3
View File
@@ -31,6 +31,21 @@ swi3msg() {
xorgdisplay() {
case "$1" in
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
_cur_bl=0
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
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
printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true
fi
Binary file not shown.
Binary file not shown.