From: gobo72 Date: Sun, 8 May 2011 03:44:30 +0000 (+0000) Subject: Ajout ACPID X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=785f43b4dd400fff43b9fa169fded7fef7c9025e;p=hvlinux.git Ajout ACPID --- diff --git a/config/packages-list b/config/packages-list index 7dcd95d..ff97787 100644 --- a/config/packages-list +++ b/config/packages-list @@ -4,6 +4,7 @@ # as well the corresponding patches, if needed. ABIWORD="abiword-2.8.6" +ACPID="acpid-2.0.9" AGG="agg-2.5" ALSA_LIB="alsa-lib-1.0.21" ALSA_PLUGINS="alsa-plugins-1.0.21" diff --git a/stage2/bootscripts/acpid b/stage2/bootscripts/acpid new file mode 100755 index 0000000..362d2fe --- /dev/null +++ b/stage2/bootscripts/acpid @@ -0,0 +1,39 @@ +#!/bin/sh + +# acpid + +# Source functions library +source /etc/rc.d/init.d/functions + +DAEMON=acpid +DAEMON_DESC="ACPI" +DAEMON_OPTS="--netlink --logevents" + +log_script_name "$0 $*" + +case "$1" in + start) + cmd_run_log_box_warn "${DAEMON_DESC} daemon start" loadproc /usr/sbin/${DAEMON} ${DAEMON_OPTS} + ;; + + stop) + cmd_run_log_box_warn "${DAEMON_DESC} daemon stop" killproc ${DAEMON} + ;; + + status) + statusproc ${DAEMON} + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "Usage: $0 {restart|start|status|stop}" + exit ${EXIT_CODE_FAILURE} + ;; +esac + +exit $? diff --git a/stage2/hv-install-2 b/stage2/hv-install-2 index 1a78e4c..918bc76 100755 --- a/stage2/hv-install-2 +++ b/stage2/hv-install-2 @@ -48,6 +48,7 @@ if [ -n "${WIFI_SUPPORT}" ]; then fi ipkg ${NANO} +ipkg -m noac ${ACPID} rscr once "Installing HV-utilities" install-hv-utilities rscr once "Installing bootscripts" install-bootscripts diff --git a/stage2/misc/hvs2ram b/stage2/misc/hvs2ram new file mode 100755 index 0000000..8b68703 --- /dev/null +++ b/stage2/misc/hvs2ram @@ -0,0 +1,35 @@ +#!/bin/sh + +# discover video card's ID +ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'` + +# securely create a temporary file +TMP_FILE=`mktemp /var/tmp/video_state.XXXXXX` +trap 'rm -f $TMP_FILE' 0 1 15 + +# write all unwritten data (just in case) +sync + +# dump current data from the video card to the +# temporary file +cat /proc/bus/pci/$ID > $TMP_FILE + +# Stopping network. +# Sony VAIO PCG-Z505RX and PCMCIA Linksys wifi card +/etc/rc.d/init.d/network stop + +echo "Entering suspend mode" + +# suspend +echo -n mem > /sys/power/state + +echo "Resuming" + +# restore video card data from the temporary file +# on resume +cat $TMP_FILE > /proc/bus/pci/$ID + +/etc/rc.d/init.d/network start + +# remove temporary file +rm -f $TMP_FILE diff --git a/stage2/packages-update b/stage2/packages-update index 0ef7037..06a1f9b 100755 --- a/stage2/packages-update +++ b/stage2/packages-update @@ -87,5 +87,6 @@ fpkg ${UDEV_CONFIG} "http://www.linuxfromscratch.org/lfs/downloads/development" fpkg -e "tar.gz" ${GRUB} "ftp://alpha.gnu.org/gnu/grub" fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history" -exit $? +fpkg -e "tar.gz" ${ACPID} "http://www.tedfelix.com/linux" +exit $? diff --git a/stage2/pkg/acpid b/stage2/pkg/acpid new file mode 100644 index 0000000..8eabe5a --- /dev/null +++ b/stage2/pkg/acpid @@ -0,0 +1,18 @@ +#!/bin/bash + +hvbuild_post() +{ + install -d -m755 /etc/acpi/events + + cat > /etc/acpi/events/s2ram << EOF +# When a button/power event is received, the hvs2ram script is run. + +event=button/power +action=/usr/local/bin/hvs2ram +EOF + + install -m755 ${SCRDIR}/misc/hvs2ram /usr/local/bin + + install -v -m740 ${SCRDIR}/bootscripts/acpid /etc/rc.d/init.d + bootscript_add_rcsysinit acpid 65 90 +}