Files
2026-11-18 01:39:26 +09:00

50 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Always start dark. Display charger UI in charger boot mode, or release logo briefly.
for path in /sys/class/backlight/*/brightness; do
[ -w "$path" ] && printf '0\n' > "$path"
done
CMDLINE=$(cat /proc/cmdline 2>/dev/null || true)
CHARGER_MODE=0
case " $CMDLINE " in
*" androidboot.mode=charger "*|*" androidboot.bootreason=usb_chg "*)
CHARGER_MODE=1
;;
esac
if [ "$CHARGER_MODE" = 1 ]; then
if [ -x /usr/local/sbin/platina-status-screen ]; then
umask 027
(
timeout -s TERM -k 3 10 /usr/local/sbin/platina-status-screen --once --mode charger --seconds 5 || true
if [ -x /usr/local/sbin/platina-display ]; then
/usr/local/sbin/platina-display off || true
fi
) >> /var/log/platina-splash.log 2>&1 &
fi
exit 0
fi
if [ -x /usr/local/sbin/platina-splash ] && [ -r /usr/local/share/platina/current/release.json ]; then
umask 027
(
driver=$(readlink -f /sys/bus/mipi-dsi/devices/c994000.dsi.0/driver 2>/dev/null || true)
if [ "${driver##*/}" = panel-novatek-nt36672a ]; then
timeout -s TERM -k 3 15 /usr/local/sbin/platina-display show --boot --seconds 7
elif [ -r /usr/local/lib/platina/display/module.json ]; then
timeout -s TERM -k 3 15 /usr/local/sbin/platina-display-session --boot --seconds 7
else
timeout -s TERM -k 3 12 /usr/local/sbin/platina-splash --boot --seconds 7
fi
# Recover full panel powerdown even after the outer timeout killed a renderer.
if [ "${driver##*/}" = panel-novatek-nt36672a ]; then
/usr/local/sbin/platina-display off
fi
# Also recover brightness if timeout had to stop the renderer.
for path in /sys/class/backlight/*/brightness; do
[ -w "$path" ] && printf '0\n' > "$path"
done
) >> /var/log/platina-splash.log 2>&1 &
fi
if [ -x /usr/local/sbin/platina-cellular ]; then
/usr/local/sbin/platina-cellular --auto >> /var/log/platina-cellular.log 2>&1 &
fi
exit 0