Files
vanilla/buildroot/board/nx/rootfs/usr/bin/vanilla-nx-power-btn
T

16 lines
383 B
Bash
Executable File

#!/bin/sh
# Listen for power button presses, in which case quit Vanilla (which should in turn reboot the Switch)
DEV=/dev/input/event0
APP=vanilla
evtest "$DEV" 2>/dev/null | while read -r line; do
case "$line" in
*KEY_SLEEP*,\ value\ 1*)
pid="$(pidof "$APP" | awk '{print $1}')"
[ -n "$pid" ] && kill -TERM "$pid"
;;
esac
done