Finalize verified 2720 Flip release source and untrack image outputs

This commit is contained in:
Luxferre committed 2026-11-09 23:04:13 +02:00
1 parent 2a3078e42c
commit 1c011b360a
121 files changed
+8467 -686

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
# Bridge Sxmo hooks to the cover display daemon. Safe no-op on non-flip
# devices and when the daemon is not running.
set -u
EVENT="${1:-refresh}"
shift 2>/dev/null || true
[ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" = "flip" ] || exit 0
case "$EVENT" in
notification)
/usr/bin/bananarchy-coverctl NOTIFY "Notification" >/dev/null 2>&1 || true
;;
ring)
/usr/bin/bananarchy-coverctl CALL incoming "${1:--}" "-" >/dev/null 2>&1 || true
;;
missed)
/usr/bin/bananarchy-coverctl CALL missed "${1:--}" "-" >/dev/null 2>&1 || true
;;
call|active)
/usr/bin/bananarchy-coverctl CALL active "${1:--}" "-" >/dev/null 2>&1 || true
;;
hangup|ended)
/usr/bin/bananarchy-coverctl CALL none "-" "-" >/dev/null 2>&1 || true
;;
sms)
/usr/bin/bananarchy-coverctl SMS "${1:-1}" >/dev/null 2>&1 || true
;;
screenoff)
/usr/bin/bananarchy-coverctl REFRESH >/dev/null 2>&1 || true
;;
wake|refresh|theme)
/usr/bin/bananarchy-coverctl RELOAD_THEME >/dev/null 2>&1 || true
;;
*)
/usr/bin/bananarchy-coverctl REFRESH >/dev/null 2>&1 || true
;;
esac
exit 0
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
# Publish a notification on the 2720 Flip cover display via the daemon IPC.
set -eu
exec /usr/bin/bananarchy-coverctl -s /run/bananarchy/cover.sock NOTIFY "$*"
Binary file not shown.
Binary file not shown.
+71
View File
@@ -0,0 +1,71 @@
#!/bin/sh
# Collect everything needed to diagnose an unresponsive 2720 Flip keypad.
# Writes a compact report to stdout (redirect it to a file to keep it).
set -u
echo "=== bananarchy keypad diagnostics $(date) ==="
echo
echo "--- kernel ---"
uname -a
echo
echo "--- input devices ---"
cat /proc/bus/input/devices 2>/dev/null || echo "(no /proc/bus/input/devices)"
echo
echo "--- input event nodes ---"
ls -l /dev/input/event* 2>/dev/null || echo "(no event nodes)"
echo
echo "--- udev tags ---"
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
name=$(udevadm info --query=property --name="$dev" 2>/dev/null | grep '^NAME=' | head -1)
tags=$(udevadm info --query=property --name="$dev" 2>/dev/null | grep -E '^ID_INPUT(_KEY|_KEYBOARD|_SWITCH)?=' | tr '\n' ' ')
echo "$dev ${name:-NAME=} $tags"
done
echo
echo "--- switch state (SW_LID / SW_KEYPAD_SLIDE) ---"
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
sw=$(udevadm info --query=property --name="$dev" 2>/dev/null | grep -c 'ID_INPUT_SWITCH=1')
[ "$sw" = "0" ] && continue
printf '%s: ' "$dev"
evtest --query "$dev" EV_SW SW_LID 2>/dev/null || echo "(evtest unavailable)"
done
echo
echo "--- kernel messages ---"
dmesg 2>/dev/null | grep -iE 'keypad|matrix|gpio-keys|input:|libinput' | tail -40 || echo "(dmesg unavailable)"
echo
echo "--- X input devices ---"
if command -v libinput >/dev/null 2>&1; then
DISPLAY=${DISPLAY:-:0} libinput list-devices 2>&1 | head -60
else
echo "(libinput CLI unavailable)"
fi
echo
echo "--- Xorg log ---"
grep -iE 'keypad|input|libinput|Ignoring|no devices' /var/log/Xorg.0.log 2>/dev/null | tail -40 || echo "(no Xorg log)"
echo
echo "--- raw event probe (5 s, press keys now) ---"
keypad_dev=""
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
name=$(udevadm info --query=property --name="$dev" 2>/dev/null | grep '^NAME=' | head -1)
case "$name" in *keypad*) keypad_dev="$dev" ;; esac
done
if [ -n "$keypad_dev" ] && command -v evtest >/dev/null 2>&1; then
timeout 5 evtest "$keypad_dev" 2>&1 | head -30
else
echo "keypad device: ${keypad_dev:-not found}; evtest: $(command -v evtest || echo missing)"
fi
echo
echo "--- volume keys ---"
echo "XKB: $(DISPLAY=${DISPLAY:-:0} xkbcomp :0 - 2>/dev/null | grep -c XF86AudioRaiseVolume) XF86AudioRaiseVolume bindings"
for dev in /dev/input/event*; do
[ -e "$dev" ] || continue
name=$(udevadm info --query=property --name="$dev" 2>/dev/null | grep '^NAME=' | head -1)
case "$name" in *gpio-keys*|*resin*) echo "$dev $name (KEY_VOLUMEUP / KEY_VOLUMEDOWN)" ;; esac
done
echo "logical volume: $(sxmo_audio.sh vol get 2>/dev/null)"
if command -v wpctl >/dev/null 2>&1; then
sink=$(wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p' | sed -n 's/^[^0-9]*\([0-9][0-9]*\)\..*/\1/p' | head -n 1)
[ -n "$sink" ] && echo "pipewire sink $sink: $(wpctl get-volume "$sink" 2>/dev/null)"
fi
echo "=== end ==="
Binary file not shown.
Binary file not shown.
@@ -69,8 +69,30 @@ rm -f "$XDG_RUNTIME_DIR/sxmo.led.lock" "$XDG_RUNTIME_DIR"/sxmo_bat_state_* 2>/de
# of idle blanking, or /etc/bananarchy-no-deep-standby to opt out of suspend.
rm -f "$XDG_CACHE_HOME/sxmo/sxmo.nosuspend"
[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ] && printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR/dbus.bus"
printf "1\n" > /tmp/bananarchy_screen_locked
printf "lock\n" > "$XDG_RUNTIME_DIR/sxmo.state"
# A flip phone that boots open must start unlocked with a live keypad. The
# root lid daemon publishes the debounced hall state before tinydm starts;
# default to open if that file is unavailable so X never stalls on xlocker.
_lid_state="open"
if [ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" = "flip" ]; then
_lid_wait=0
while [ "$_lid_wait" -lt 20 ] && [ ! -r /run/bananarchy/lid-state ]; do
sleep 0.1
_lid_wait=$((_lid_wait + 1))
done
if [ -r /run/bananarchy/lid-state ]; then
read -r _lid_state < /run/bananarchy/lid-state 2>/dev/null || _lid_state="open"
fi
if [ "$_lid_state" = "closed" ]; then
printf "1\n" > /tmp/bananarchy_screen_locked
printf "screenoff\n" > "$SXMO_STATE"
else
rm -f /tmp/bananarchy_screen_locked
printf "unlock\n" > "$SXMO_STATE"
fi
else
printf "1\n" > /tmp/bananarchy_screen_locked
printf "lock\n" > "$SXMO_STATE"
fi
_init_bl=""
if [ -r "$XDG_CONFIG_HOME/sxmo/brightness" ]; then
@@ -93,6 +115,11 @@ elif [ -r /tmp/sxmo_saved_kbd_brightness ]; then
fi
printf "%s\n" "${_init_kbd:-255}" > /tmp/sxmo_saved_kbd_brightness
printf "%s\n" "${_init_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
if [ "$_lid_state" = "closed" ]; then
printf "0\n" > /sys/class/backlight/backlight/brightness 2>/dev/null || true
printf "0\n" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
printf "4\n" > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
fi
XORG_BIN="Xorg"
[ -x /tmp/x11/usr/bin/Xorg ] && XORG_BIN="/tmp/x11/usr/bin/Xorg"
@@ -124,6 +151,7 @@ else
xset +dpms >/dev/null 2>&1 || true
xset dpms 0 0 0 >/dev/null 2>&1 || true
fi
xset r rate 180 30 >/dev/null 2>&1 || true
SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid"
printf "%s\n" "$$" > "$SESSION_PID_FILE"
@@ -140,6 +168,36 @@ if [ -f /tmp/bananarchy_ext_logging ]; then
else
( sxmo_hook_start.sh >/dev/null 2>&1 </dev/null & )
fi
if [ "$(cat /usr/share/bananarchy/lid-profile 2>/dev/null)" = "flip" ] && \
[ "$_lid_state" != "closed" ]; then
# Some Sxmo start hooks still map xlocker from a transient boot lock file.
# Keep the first 10 s of an open-lid boot unlocked, then stop interfering.
(
i=0
while [ "$i" -lt 20 ]; do
[ "$(cat /run/bananarchy/lid-state 2>/dev/null)" = "closed" ] && break
rm -f /tmp/bananarchy_screen_locked
printf "unlock\n" > "$SXMO_STATE"
if [ -p /tmp/dwm_plugin_locker.fifo ]; then
printf "CLOSE\n" > /tmp/dwm_plugin_locker.fifo 2>/dev/null || true
fi
sleep 0.5
i=$((i + 1))
done
) &
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.
(
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
fi
xdotool key --clearmodifiers Escape >/dev/null 2>&1 || true
) &
first_iter=1
while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
Binary file not shown.
+46 -6
View File
@@ -470,17 +470,39 @@ EOF
if [ "$eff_pct" -gt 0 ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
if [ "$dev" = "Bluetooth" ]; then
pactl set-sink-volume @DEFAULT_SINK@ "${eff_pct}%" >/dev/null 2>&1 || true
else
pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1 || true
fi
bananarchy_set_sink_volume "$eff_pct"
else
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
fi
}
# Bananarchy: the MSM8905 mainline kernel exposes no ALSA card yet, so the
# amixer csets below are no-ops and PipeWire's null sink is the real output.
# @DEFAULT_SINK@ does not resolve when wireplumber has no default configured
# node, so resolve the first live sink id and set its volume directly.
bananarchy_set_sink_volume() {
pct="$1"
if [ -z "${XDG_RUNTIME_DIR:-}" ]; then
XDG_RUNTIME_DIR="/run/user/$(id -u)"
export XDG_RUNTIME_DIR
fi
if command -v wpctl >/dev/null 2>&1; then
sink="$(wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p' \
| sed -n 's/^[^0-9]*\([0-9][0-9]*\)\..*/\1/p' | head -n 1)"
if [ -n "$sink" ]; then
wpctl set-volume "$sink" "${pct}%" >/dev/null 2>&1 || true
if [ "$pct" -le 0 ]; then
wpctl set-mute "$sink" 1 >/dev/null 2>&1 || true
else
wpctl set-mute "$sink" 0 >/dev/null 2>&1 || true
fi
return 0
fi
fi
pactl set-sink-volume @DEFAULT_SINK@ "${pct}%" >/dev/null 2>&1 || true
}
apply_vol_out() {
dev="$(normalize_out_dev "${1:-$(fast_out_dev)}")"
pct="$(clamp_pct "${2:-$(read_dev_vol "$dev")}" 85)"
@@ -568,13 +590,14 @@ EOF
if [ "$pw_muted" != "0" ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
pactl set-sink-volume @DEFAULT_SINK@ 100% >/dev/null 2>&1 || true
fi
bananarchy_set_sink_volume "$eff_pct"
else
if [ "$pw_muted" != "1" ]; then
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
fi
bananarchy_set_sink_volume 0
fi
}
@@ -849,7 +872,23 @@ volset() {
fi
}
# A direct evdev volume daemon and the X11 binding can both react to one
# physical key press. Collapse calls that arrive within 300 ms so the volume
# only steps once per press.
bananarchy_vol_debounce() {
# Timestamp based, no background subshell: a stale lock directory could
# otherwise block every future volume step forever.
now="$(awk '{printf "%d", $1 * 100}' /proc/uptime 2>/dev/null || printf 0)"
last="$(cat /tmp/bananarchy_vol_step 2>/dev/null || printf 0)"
[ -n "$now" ] || now=0
[ -n "$last" ] || last=0
[ $((now - last)) -lt 30 ] && return 1
printf '%s\n' "$now" > /tmp/bananarchy_vol_step 2>/dev/null || true
return 0
}
volup() {
bananarchy_vol_debounce || return 0
step="${1:-5}"
target_dev="$(normalize_out_dev "${2:-$(fast_out_dev)}")"
cur="$(read_dev_vol "$target_dev")"
@@ -859,6 +898,7 @@ volup() {
}
voldown() {
bananarchy_vol_debounce || return 0
step="${1:-5}"
target_dev="$(normalize_out_dev "${2:-$(fast_out_dev)}")"
cur="$(read_dev_vol "$target_dev")"