Files
bananarchy/overlay/rootfs/usr/bin/bananarchy-cover-diagnose.sh
T
Luxferre a23a9b4edb Fix nokia-beatles closed-flip cover wake via dynamic TLMM gpiochip resolution
- Resolve MSM8909 TLMM (1000000.pinctrl) dynamically across /dev/gpiochip* in bananarchy-cover-idle (BA_GPIO_GET_CHIPINFO / hw_ensure_gpiochip) and bananarchy-cover-diagnose.sh, and default cover-display.conf to gpiochip_device = auto so strict fw_devlink/MPM probe order shifts never leave closed-flip button wakes in backend=none.

- Guard gpiochip_device = auto and BA_GPIO_GET_CHIPINFO in test-cover-kernel.py and check-rebuild.sh, and update a1114 (carbonara) image and release archive SHA-256 pins in check-rebuild.sh and CHANGELOG.md.
2026-11-13 19:06:40 +02:00

103 lines
4.1 KiB
Bash
Executable File

#!/bin/sh
# Report the live state of the 2720 Flip external panel (closed-flip backend).
# Read-only: it never changes the mux, backlight, DPMS or panel state.
set -u
FB=/dev/fb1
SYSFS=/sys/class/graphics/fb1
SPI=/dev/spidev0.1
resolve_tlmm_gpiochip() {
for dev in /sys/bus/gpio/devices/gpiochip*; do
[ -e "$dev" ] || continue
target="$(readlink -f "$dev" 2>/dev/null || true)"
case "$target" in
*pinctrl*|*tlmm*)
printf '/dev/%s\n' "${dev##*/}"
return 0
;;
esac
done
printf '/dev/gpiochip0\n'
}
GPIOCHIP="$(resolve_tlmm_gpiochip)"
FW=/lib/firmware/nokia,beatles-gc9305-ext-panel.bin
CMD=/sys/kernel/debug/dri/0/command
BL=/sys/class/backlight/backlight/brightness
MARKER=/run/bananarchy/cover-backlight
CONF=/etc/bananarchy/cover-display.conf
COVERCTL=/usr/bin/bananarchy-coverctl
printf '=== Bananarchy cover display diagnostics ===\n'
if [ -r /usr/share/bananarchy/lid-profile ]; then
printf 'lid-profile : %s\n' "$(cat /usr/share/bananarchy/lid-profile)"
else
printf 'lid-profile : missing (not a flip build?)\n'
fi
if [ -e "$FB" ]; then
printf 'framebuffer : %s present\n' "$FB"
for attr in virtual_size bits_per_pixel stride; do
if [ -r "$SYSFS/$attr" ]; then
printf ' %-20s: %s\n' "$attr" "$(cat "$SYSFS/$attr")"
else
printf ' %-20s: missing\n' "$attr"
fi
done
else
printf 'framebuffer : %s absent (single-panel shipping DTB)\n' "$FB"
fi
if [ -e "$SPI" ]; then
printf 'spidev : %s present\n' "$SPI"
else
printf 'spidev : %s MISSING\n' "$SPI"
fi
if [ -e "$GPIOCHIP" ]; then
printf 'gpiochip : %s present\n' "$GPIOCHIP"
else
printf 'gpiochip : %s MISSING\n' "$GPIOCHIP"
fi
if [ -w "$CMD" ]; then
printf 'kernel command hook : %s writable\n' "$CMD"
else
printf 'kernel command hook : %s MISSING\n' "$CMD"
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 'shared backlight : %s\n' "$(cat "$BL" 2>/dev/null || printf 'unknown')"
printf 'cover backlight marker: %s\n' "$([ -f "$MARKER" ] && printf 'present' || printf 'absent')"
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
printf 'module %-20s: loaded\n' "$mod"
else
printf 'module %-20s: not loaded\n' "$mod"
fi
done
if [ -r "$FW" ]; then
printf 'panel firmware : %s (%s bytes)\n' "$FW" "$(wc -c < "$FW")"
else
printf 'panel firmware : %s MISSING\n' "$FW"
fi
printf 'mux select (lid-state): %s\n' "$(cat /run/bananarchy/lid-state 2>/dev/null || printf 'unknown')"
if [ -r /sys/kernel/debug/gpio ]; then
printf 'TLMM lines :\n'
grep -E '^ gpio(13|21|23|25|110) ' /sys/kernel/debug/gpio | sed 's/^/ /'
fi
if [ -r "$CONF" ]; then
printf 'backend config :\n'
grep -E '^(backend|main_fb_device|kernel_dpms_helper|kernel_command_path|kernel_backlight_path|kernel_backlight_marker|kernel_backlight_level|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')"
else
printf 'daemon : %s missing\n' "$COVERCTL"
fi
if command -v rc-service >/dev/null 2>&1; then
rc-service bananarchy-cover-display status 2>&1 | sed 's/^/service : /'
fi
printf 'sign-off : close the flip, press an outer button\n'
printf ' if the cover stays dark: SET mux_closed_level 0\n'
printf ' legacy: bananarchy-cover-probe.sh (12 cases)\n'
printf ' rollback: SET backend none\n'
exit 0