設置GPIO後
7 cat /etc/rc.button/reset
8 #!/bin/sh
9 . /lib/functions.sh
10 OVERLAY="$( grep ' /overlay ' /proc/mounts )"
11 case "$ACTION" in
12 pressed)
13 [ -z "$OVERLAY" ] && return 0
14 return 5
15 ;;
16 timeout)
17 . /etc/diag.sh
18 set_state failsafe
19 ;;
20 released)
21 if [ "$SEEN" -ge 3 -a "$SEEN" -lt 8 ]
22 then
23 echo "REBOOT" > /dev/console
24 sync
25 reboot
26 elif [ "$SEEN" -ge 10 -a -n "$OVERLAY" ]
27 then
28 echo "FACTORY RESET" > /dev/console
29 jffs2reset -y && reboot &
30 fi
31 ;;
32 esac