diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/acpid.map b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/acpid.map new file mode 100644 index 000000000..afefcd731 --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/acpid.map @@ -0,0 +1,2 @@ +EV_KEY 0x01 KEY_POWER 116 1 pswitch-press +EV_KEY 0x01 KEY_POWER 116 0 pswitch-release diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/busybox-acpid b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/busybox-acpid new file mode 100644 index 000000000..14799d06c --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/busybox-acpid @@ -0,0 +1,39 @@ +#!/bin/sh +DAEMON=/sbin/acpid +NAME=acpid +DESC="Busybox ACPI daemon." +ARGS="-M /etc/acpi/acpid.map" + +test -f $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "starting $DESC: $NAME... " + start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS + echo "done." + ;; + stop) + echo -n "stopping $DESC: $NAME... " + start-stop-daemon -K -n $NAME + echo "done." + ;; + restart) + echo -n "restarting $DESC: $NAME... " + $0 stop + $0 start + echo "done." + ;; + reload) + echo -n "reloading $DESC: $NAME... " + killall -HUP $(basename ${DAEMON}) + echo "done." + ;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-press b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-press new file mode 100644 index 000000000..4228dfcb7 --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-press @@ -0,0 +1,9 @@ +#!/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 diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-release b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-release new file mode 100644 index 000000000..b6db85dac --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.20.2/pswitch-release @@ -0,0 +1,26 @@ +#!/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 diff --git a/meta-digi-dey/recipes-core/busybox/busybox_1.20.2.bbappend b/meta-digi-dey/recipes-core/busybox/busybox_1.20.2.bbappend index d1d60faf5..936893a86 100644 --- a/meta-digi-dey/recipes-core/busybox/busybox_1.20.2.bbappend +++ b/meta-digi-dey/recipes-core/busybox/busybox_1.20.2.bbappend @@ -19,6 +19,10 @@ SRC_URI += "file://0001-del-baudrates.patch \ file://busybox-ntpd \ file://index.html \ file://digi.gif \ + file://busybox-acpid \ + file://acpid.map \ + file://pswitch-press \ + file://pswitch-release \ " # Add device handlers to 'mdev' package @@ -42,6 +46,16 @@ FILES_${PN}-ntpd = "${sysconfdir}/init.d/busybox-ntpd" INITSCRIPT_PACKAGES =+ "${PN}-ntpd" INITSCRIPT_NAME_${PN}-ntpd = "busybox-ntpd" +# ACPID package +PACKAGES =+ "${PN}-acpid" +FILES_${PN}-acpid = " ${sysconfdir}/init.d/busybox-acpid \ + ${sysconfdir}/acpi/acpid.map \ + ${sysconfdir}/acpi/pswitch-press \ + ${sysconfdir}/acpi/pswitch-release \ +" +INITSCRIPT_PACKAGES =+ "${PN}-acpid" +INITSCRIPT_NAME_${PN}-acpid = "busybox-acpid" + do_install_append() { if grep "CONFIG_MDEV=y" ${WORKDIR}/defconfig; then if grep "CONFIG_FEATURE_MDEV_CONF=y" ${WORKDIR}/defconfig; then @@ -65,4 +79,11 @@ do_install_append() { fi # Install 'suspend' script install -m 0755 ${WORKDIR}/suspend ${D}${base_bindir} + if grep "CONFIG_ACPID=y" ${WORKDIR}/defconfig; then + 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/ + fi } diff --git a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb index 88d96236a..aef4e4c20 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -47,6 +47,7 @@ RDEPENDS_${PN} = "\ ubootenv \ update-flash \ usbutils \ + busybox-acpid \ ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}" RRECOMMENDS_${PN} = "\