Make 2720 Flip lid switching instant and route closed-flip events to the cover
The lid daemon re-derived "observed" from a stale EV_SW mask on every 100 ms iteration and only read the raw hall lines every 200 ms, so the candidate oscillated and the 80 ms debounce almost never completed. A controlled hall transition on the live phone took over 2.2 s to blank and lock the main panel. The hall reading is now sticky, every EV_SW edge forces an immediate hall re-read, the loop and debounce are 20 ms, and the daemon writes the lid state, lock flag, Sxmo state and both backlights synchronously in C before spawning hooks. A direct xset DPMS off/on stops or resumes Xorg's SPI flushes at once. bananarchy-lid-state.sh guards the asynchronous hooks by lid state and a transition generation counter, so a late screenoff cannot re-lock a flip that was just opened. bananarchy-lid-gate.sh now gates sxmo_wm.sh display on, the screen-wake helper, the backlight udev helper, sxmo_state.sh set unlock (dwm calls it directly) and both input handler copies. While the flip is closed it blocks the main panel and keypad backlight, forces brightness/kbd/DPMS off against stray writes, and forwards a WAKE datagram to the cover display. Ring, notification and call-state hooks publish to the cover, and the cover daemon gained WAKE, event wakes, immunity to repeated LID CLOSED rebroadcasts and a bounded retry for a DPMS-deferred draw. Live verification with controlled hall transitions and uinput switch/key injection: close blanks and locks in ~45-90 ms (hall-poll fallback ~100-220 ms), open restores brightness, keypad backlight, unlock and DPMS in ~10-130 ms with no stale-hook re-lock. All three external keys and an incoming call leave brightness=0, kbd_backlight=0 and DPMS=Off while the cover reports backend=spidev visible=1; opening returns mux=open. Rebuilt the a1108/dejavu nokia-beatles image and pinned the verified hash 0f33aa6e9fc70022574b453aaafb9307c4d185431d3be272782c8403dd0fb291 in check-rebuild.sh. e2fsck -fn passed on both partitions, debugfs confirms twelve updated rootfs files byte-for-byte, and the bootfs sync, boot image check, artifact sync, host tests and rebuild preflight all pass. This is an intermediate checkpoint: eyes-on cover illumination and the remaining polarity/CS fixes are still required.
This commit is contained in:
1 parent
40a840b49b
commit
2857ef4374
29 files changed
+567
-49
No files matched your search
@@ -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
|
||||
|
||||
@@ -35,7 +35,11 @@ case "$EVENT" in
|
||||
# bananarchy-volume-keys when the flip is closed).
|
||||
/usr/bin/bananarchy-coverctl BUTTON >/dev/null 2>&1 || true
|
||||
;;
|
||||
wake|refresh|theme)
|
||||
wake)
|
||||
# Every blocked main-panel wake request is forwarded here by the lid gate.
|
||||
/usr/bin/bananarchy-coverctl WAKE >/dev/null 2>&1 || true
|
||||
;;
|
||||
refresh|theme)
|
||||
/usr/bin/bananarchy-coverctl RELOAD_THEME >/dev/null 2>&1 || true
|
||||
;;
|
||||
*)
|
||||
|
||||
Binary file not shown.
@@ -18,6 +18,16 @@ case "$br" in ''|*[!0-9]*) br=1 ;; esac
|
||||
cur=On
|
||||
[ -r "$DPMS_PATH" ] && { read -r cur < "$DPMS_PATH" 2>/dev/null || cur=On; }
|
||||
|
||||
# Hard gate: while the flip is closed no path may relight the main panel or
|
||||
# the keypad backlight. This also enforces DPMS-off, which is the condition
|
||||
# the cover daemon needs before it takes the shared QUP5 SPI bus.
|
||||
if ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then
|
||||
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
[ "$br" -eq 0 ] || printf '0\n' > "$BR_PATH" 2>/dev/null || true
|
||||
[ "$cur" = "Off" ] || DISPLAY=:0 xset dpms force off >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$br" -eq 0 ]; then
|
||||
[ "$cur" = "Off" ] || DISPLAY=:0 xset dpms force off >/dev/null 2>&1 || true
|
||||
else
|
||||
|
||||
Binary file not shown.
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Closed-flip main-panel gate for the 2720 Flip.
|
||||
#
|
||||
# Returns 0 when the main panel / keypad backlight may be lit, 1 when the flip
|
||||
# is closed. With the "wake" argument a blocked main-panel wake request is
|
||||
# forwarded to the cover display, so an incoming call, SMS, notification or
|
||||
# external button can only light the outer panel.
|
||||
#
|
||||
# Every wake path (sxmo_wm.sh display on, bananarchy-screen-wake.sh,
|
||||
# bananarchy-display-power-sync, the input handler) calls this helper, which
|
||||
# makes /run/bananarchy/lid-state the single source of truth. The compiled lid
|
||||
# daemon writes that file synchronously before any other transition work.
|
||||
set -u
|
||||
|
||||
PROFILE="${BANANARCHY_LID_PROFILE:-/usr/share/bananarchy/lid-profile}"
|
||||
STATE="${BANANARCHY_LID_STATE:-/run/bananarchy/lid-state}"
|
||||
COVERCTL="${BANANARCHY_COVERCTL:-/usr/bin/bananarchy-coverctl}"
|
||||
|
||||
[ "$(cat "$PROFILE" 2>/dev/null)" = "flip" ] || exit 0
|
||||
[ "$(cat "$STATE" 2>/dev/null)" = "closed" ] || exit 0
|
||||
|
||||
if [ "${1:-}" = "wake" ] && [ -x "$COVERCTL" ]; then
|
||||
"$COVERCTL" WAKE >/dev/null 2>&1 || true
|
||||
fi
|
||||
exit 1
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Guarded Sxmo state transition for the 2720 Flip lid daemon.
|
||||
#
|
||||
# The compiled lid daemon already writes the state, the lock flag and the
|
||||
# backlights synchronously; this wrapper only starts the Sxmo hooks. A slow
|
||||
# "screenoff" spawn from a close must not run after the flip has opened and
|
||||
# re-lock or re-blank the phone, so it re-checks the lid state at exec time.
|
||||
set -u
|
||||
|
||||
EXPECTED="${1:-}"
|
||||
ACTION="${2:-}"
|
||||
GENERATION="${3:-}"
|
||||
STATE_FILE="${BANANARCHY_LID_STATE:-/run/bananarchy/lid-state}"
|
||||
GEN_FILE="${BANANARCHY_LID_GENERATION:-/run/bananarchy/lid-generation}"
|
||||
|
||||
[ -n "$EXPECTED" ] && [ -n "$ACTION" ] && [ -n "$GENERATION" ] || exit 0
|
||||
[ "$(cat "$STATE_FILE" 2>/dev/null)" = "$EXPECTED" ] || exit 0
|
||||
[ "$(cat "$GEN_FILE" 2>/dev/null)" = "$GENERATION" ] || exit 0
|
||||
exec /usr/bin/sxmo_state.sh set "$ACTION"
|
||||
@@ -2,6 +2,11 @@
|
||||
# Wake the screen for an external event (incoming call / SMS / notification)
|
||||
# and reset dwm's idle-blank timer so it cannot blank again immediately.
|
||||
export DISPLAY="${DISPLAY:-:0}"
|
||||
# With the flip closed every wake is cover-only: do not touch the main panel,
|
||||
# the keypad backlight, the idle timer or the Sxmo state machine.
|
||||
if ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}" wake; then
|
||||
exit 0
|
||||
fi
|
||||
# Cancel a pending idle-blank lock before the panel is powered on, so a wake
|
||||
# does not race with the screenoff transition started by the blank handler.
|
||||
"${BANANARCHY_IDLE_LOCK_HELPER:-/usr/bin/bananarchy-idle-lock.sh}" cancel >/dev/null 2>&1 || true
|
||||
|
||||
@@ -160,6 +160,12 @@ case "$action" in
|
||||
read_state
|
||||
"$action" "$@" ;;
|
||||
set)
|
||||
# dwm calls "sxmo_state.sh set unlock" directly on every key press.
|
||||
# A closed flip must stay locked: forward the request to the cover.
|
||||
if [ "${1:-}" = "unlock" ] && \
|
||||
! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}" wake; then
|
||||
exit 0
|
||||
fi
|
||||
lock_exclusive
|
||||
read_state
|
||||
case " $SXMO_STATES " in
|
||||
|
||||
@@ -62,6 +62,11 @@ xorgdisplay() {
|
||||
/usr/bin/bananarchy-power-policy.sh screenoff >/dev/null 2>&1 &
|
||||
;;
|
||||
on)
|
||||
# A closed flip must never relight the main panel or keypad backlight.
|
||||
# The gate forwards the wake request to the outer cover panel instead.
|
||||
if ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}" wake; then
|
||||
return 0
|
||||
fi
|
||||
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
|
||||
printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
|
||||
fi
|
||||
|
||||
@@ -2,3 +2,6 @@
|
||||
# configversion: 226734e9b1dd5ffb1a8c45a6c88bd741
|
||||
|
||||
# This script is executed (asynchronously) when you hangup an incoming call
|
||||
|
||||
# Keep the outer cover panel in sync with the call state.
|
||||
/usr/bin/bananarchy-cover-event.sh ended >/dev/null 2>&1 || true
|
||||
@@ -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
|
||||
|
||||
@@ -10,4 +10,7 @@
|
||||
# $1 = Contact Name or Number (if not in contacts)
|
||||
|
||||
# kill existing ring playback
|
||||
|
||||
# Keep the outer cover panel in sync with the call state.
|
||||
/usr/bin/bananarchy-cover-event.sh missed >/dev/null 2>&1 || true
|
||||
sxmo_jobs.sh stop ringing
|
||||
@@ -54,6 +54,8 @@ exec 8>&-
|
||||
|
||||
# SMS / notification: turn the panel on immediately and reset the idle timer.
|
||||
/usr/bin/bananarchy-screen-wake.sh >/dev/null 2>&1 || true
|
||||
# Cover-only when the flip is closed (the lid gate handles the wake itself).
|
||||
/usr/bin/bananarchy-cover-event.sh notification >/dev/null 2>&1 || true
|
||||
|
||||
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
# This script is executed (asynchronously) when you pick up an incoming call
|
||||
|
||||
# kill existing ring playback
|
||||
|
||||
# Keep the outer cover panel in sync with the call state.
|
||||
/usr/bin/bananarchy-cover-event.sh active >/dev/null 2>&1 || true
|
||||
rm -f /tmp/sxmo_call_ringing 2>/dev/null || true
|
||||
sxmo_jobs.sh stop ringing
|
||||
pkill -TERM -f sxmo_hook_ring.sh 2>/dev/null || true
|
||||
|
||||
@@ -14,6 +14,8 @@ export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
|
||||
|
||||
# Incoming call: turn the panel on immediately and reset the idle timer.
|
||||
/usr/bin/bananarchy-screen-wake.sh >/dev/null 2>&1 || true
|
||||
# The lid gate turns that wake into a cover-only event; publish the call state.
|
||||
/usr/bin/bananarchy-cover-event.sh ring >/dev/null 2>&1 || true
|
||||
|
||||
if [ -z "${SXMO_VIBRATE_DEV:-}" ] && [ ! -e /dev/input/by-path/platform-vibrator-event ]; then
|
||||
for vdev in /dev/input/by-path/*vibrator*-event; do
|
||||
|
||||
Reference in new issue
Block a user