summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2020-11-23 13:15:05 -0600
committerJohn Klug <john.klug@multitech.com>2020-11-23 14:49:21 -0600
commit468e2ef91fb473aaa179c1d182c376f89e6561d3 (patch)
tree5c39b1b20d29de39ced4bcc8a59a5e420fc0487a /recipes-core
parentf027698814f697d26723a0c3db0d3473ca297876 (diff)
downloadmeta-mlinux-468e2ef91fb473aaa179c1d182c376f89e6561d3.tar.gz
meta-mlinux-468e2ef91fb473aaa179c1d182c376f89e6561d3.tar.bz2
meta-mlinux-468e2ef91fb473aaa179c1d182c376f89e6561d3.zip
Update reset-handler.sh to handle SIGPWR to perform shutdown -h now for supercap power down
Diffstat (limited to 'recipes-core')
-rwxr-xr-xrecipes-core/multitech/reset-handler/reset-handler.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/recipes-core/multitech/reset-handler/reset-handler.sh b/recipes-core/multitech/reset-handler/reset-handler.sh
index 43f7471..7988342 100755
--- a/recipes-core/multitech/reset-handler/reset-handler.sh
+++ b/recipes-core/multitech/reset-handler/reset-handler.sh
@@ -24,9 +24,10 @@ name="reset-handler"
log="logger -t $name -s"
pid="$$"
-short_signal=10 # SIGUSR1
-long_signal=12 # SIGUSR2
+short_signal=10 # SIGUSR1
+long_signal=12 # SIGUSR2
extralong_signal=1 # SIGHUP
+power_signal=30 # SIGPWR
do_reboot() {
$log "Rebooting on button press"
@@ -34,6 +35,11 @@ do_reboot() {
reboot
}
+do_shutdown() {
+ $log "Shutting down"
+ shutdown -h now
+}
+
do_restore_defaults() {
$log "Removing /var/config contents"
rm -rf /var/config/*
@@ -69,11 +75,16 @@ trap do_reboot $short_signal
trap do_restore_defaults $long_signal
trap do_restore_defaults $extralong_signal
trap log_exit TERM
+trap do_shutdown $power_signal
$log "Enabling reset-monitor for pid $pid"
mts-io-sysfs store reset-monitor "$pid $short_signal $long_signal $extralong_signal"
# set long press to 5 seconds for reset to defaults
mts-io-sysfs store reset-monitor-intervals "5 30"
+# set up SIGPWR shutdown
+if [[ -f /sys/devices/platform/mts-io/supercap-monitor ]] ; then
+ mts-io-sysfs store supercap-monitor "$pid $power_signal"
+fi
# wait for signals
idle_wait