Fix 2720 Flip cover init, shared backlight and flip lock
This commit is contained in:
1 parent
c939687138
commit
b389120328
24 files changed
+494
-217
No files matched your search
@@ -4,7 +4,10 @@
|
||||
# (via doas). Every blank path writes brightness=0; every wake path restores it.
|
||||
|
||||
BR_PATH=/sys/class/backlight/backlight/brightness
|
||||
KBD_PATH=/sys/class/leds/white:kbd_backlight/brightness
|
||||
RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
|
||||
COVER_MARKER=/run/bananarchy/cover-backlight
|
||||
LID_STATE=/run/bananarchy/lid-state
|
||||
|
||||
DPMS_PATH=
|
||||
for _dpms in /sys/class/drm/card*-*/dpms; do
|
||||
@@ -18,11 +21,21 @@ case "$br" in ''|*[!0-9]*) br=1 ;; esac
|
||||
cur=On
|
||||
[ -r "$DPMS_PATH" ] && { read -r cur < "$DPMS_PATH" 2>/dev/null || cur=On; }
|
||||
|
||||
# The main and cover panels share one PWM backlight. While the cover owns the
|
||||
# bus, its daemon publishes this marker before raising brightness; the closed
|
||||
# lid gate must not turn that shared backlight back off.
|
||||
if [ -f "$COVER_MARKER" ] &&
|
||||
[ "$(cat "$LID_STATE" 2>/dev/null)" = "closed" ]; then
|
||||
printf '0\n' > "$KBD_PATH" 2>/dev/null || true
|
||||
[ "$cur" = "On" ] || DISPLAY=:0 xset dpms force on >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 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
|
||||
printf '0\n' > "$KBD_PATH" 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
|
||||
|
||||
Reference in new issue
Block a user