diff options
author | John Klug <john.klug@multitech.com> | 2021-06-22 08:43:18 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2021-06-22 08:43:18 -0500 |
commit | 83e24fa978a09cffb3d4abf74c6a06ab19492a13 (patch) | |
tree | 02ce2033d56cc48b10e351e46437163360256fae | |
parent | 93ac0fd49ef52c0500a873c48e5f433987594a18 (diff) | |
download | meta-mlinux-83e24fa978a09cffb3d4abf74c6a06ab19492a13.tar.gz meta-mlinux-83e24fa978a09cffb3d4abf74c6a06ab19492a13.tar.bz2 meta-mlinux-83e24fa978a09cffb3d4abf74c6a06ab19492a13.zip |
reset handler 1.1 rev 2 for MTCDTIP2
-rwxr-xr-x | recipes-core/multitech/reset-handler/reset-handler.sh | 15 | ||||
-rw-r--r-- | recipes-core/multitech/reset-handler_1.1.bb | 2 |
2 files changed, 14 insertions, 3 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 diff --git a/recipes-core/multitech/reset-handler_1.1.bb b/recipes-core/multitech/reset-handler_1.1.bb index 39abaab..16d7985 100644 --- a/recipes-core/multitech/reset-handler_1.1.bb +++ b/recipes-core/multitech/reset-handler_1.1.bb @@ -2,7 +2,7 @@ DESCRIPTION = "Default reset button handler" SECTION = "base" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -PR = "r1" +PR = "r2" RDEPENDS_${PN} += "bash" inherit update-rc.d |