meta-digi-dey: busybox: acpi: Modify the behaviour of power key button.
We switch to the way it works in Android, short press (<2s) takes the target to suspend and long press, >2s but <9s, performs a software controlled power down. Pressing longer than 9 seconds does the uncontrolled hardware power off directly from the PMIC. Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
parent
3549a999fc
commit
8599227cd8
|
|
@ -1,2 +1,3 @@
|
|||
EV_KEY 0x01 KEY_POWER 116 1 pswitch-press
|
||||
EV_KEY 0x01 KEY_POWER 116 0 pswitch-release
|
||||
#s_type n_type(hex) s_code n_code value description
|
||||
EV_KEY 0x01 KEY_SLEEP 142 1 pswitch-suspend
|
||||
EV_KEY 0x01 KEY_POWER 116 0 pswitch-poweroff
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
logger -t acpid "Power key poweroff request."
|
||||
exec /sbin/poweroff
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -f /tmp/pswitch_press ]; then
|
||||
logger -t acpid "Bogus press event, removing."
|
||||
rm -f /tmp/pswitch_press
|
||||
fi
|
||||
|
||||
echo `date +%s` > /tmp/pswitch_press
|
||||
exit 0
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
POWEROFF_DELAY=2
|
||||
|
||||
if [ ! -f /tmp/pswitch_press ]; then
|
||||
logger -t acpid "No press event."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while read line
|
||||
do
|
||||
TSTAMP=$line
|
||||
done < /tmp/pswitch_press
|
||||
|
||||
rm -f /tmp/pswitch_press
|
||||
|
||||
TDIFF=$((`date +%s`- $TSTAMP))
|
||||
if [ $TDIFF -lt $POWEROFF_DELAY ]; then
|
||||
logger -t acpid "Power key suspend request."
|
||||
exec /bin/suspend
|
||||
else
|
||||
logger -t acpid "Power key poweroff request."
|
||||
exec /sbin/poweroff
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
logger -t acpid "Power key suspend request."
|
||||
exec /bin/suspend
|
||||
|
|
@ -13,8 +13,8 @@ SRC_URI += "file://0001-del-baudrates.patch \
|
|||
file://digi-logo.png \
|
||||
file://busybox-acpid \
|
||||
file://acpid.map \
|
||||
file://pswitch-press \
|
||||
file://pswitch-release \
|
||||
file://pswitch-suspend \
|
||||
file://pswitch-poweroff \
|
||||
file://busybox-static-nodes \
|
||||
file://bridgeifupdown \
|
||||
"
|
||||
|
|
@ -32,8 +32,8 @@ INITSCRIPT_NAME_${PN}-ntpd = "busybox-ntpd"
|
|||
PACKAGES =+ "${PN}-acpid"
|
||||
FILES_${PN}-acpid = " ${sysconfdir}/init.d/busybox-acpid \
|
||||
${sysconfdir}/acpi/acpid.map \
|
||||
${sysconfdir}/acpi/pswitch-press \
|
||||
${sysconfdir}/acpi/pswitch-release \
|
||||
${sysconfdir}/acpi/pswitch-suspend \
|
||||
${sysconfdir}/acpi/pswitch-poweroff \
|
||||
"
|
||||
INITSCRIPT_PACKAGES =+ "${PN}-acpid"
|
||||
INITSCRIPT_NAME_${PN}-acpid = "busybox-acpid"
|
||||
|
|
@ -59,8 +59,8 @@ do_install_append() {
|
|||
install -m 0755 ${WORKDIR}/busybox-acpid ${D}${sysconfdir}/init.d/
|
||||
install -d ${D}${sysconfdir}/acpi/
|
||||
install -m 0755 ${WORKDIR}/acpid.map ${D}${sysconfdir}/acpi/
|
||||
install -m 0755 ${WORKDIR}/pswitch-press ${D}${sysconfdir}/acpi/
|
||||
install -m 0755 ${WORKDIR}/pswitch-release ${D}${sysconfdir}/acpi/
|
||||
install -m 0755 ${WORKDIR}/pswitch-suspend ${D}${sysconfdir}/acpi/
|
||||
install -m 0755 ${WORKDIR}/pswitch-poweroff ${D}${sysconfdir}/acpi/
|
||||
fi
|
||||
if grep "CONFIG_MAKEDEVS=y" ${WORKDIR}/defconfig; then
|
||||
install -m 0755 ${WORKDIR}/busybox-static-nodes ${D}${sysconfdir}/init.d/
|
||||
|
|
|
|||
Loading…
Reference in New Issue