diff options
Diffstat (limited to 'recipes/apmd')
-rw-r--r-- | recipes/apmd/apm-tosa-suspendfix_0.1.bb | 10 | ||||
-rw-r--r-- | recipes/apmd/apm-wifi-suspendfix_0.1.bb | 10 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/apmd_proxy | 91 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/apmd_proxy.conf | 16 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/debian.patch | 54 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/default | 8 | ||||
-rwxr-xr-x | recipes/apmd/apmd-3.2.2/init | 44 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/libtool.patch | 16 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/unlinux.patch | 12 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/workaround.patch | 55 | ||||
-rw-r--r-- | recipes/apmd/apmd-3.2.2/zaurus24.patch | 50 | ||||
-rw-r--r-- | recipes/apmd/apmd_3.2.2.bb | 71 | ||||
-rw-r--r-- | recipes/apmd/files/50-tmio-ohci-unbind | 19 | ||||
-rw-r--r-- | recipes/apmd/files/90-wifi-off | 12 |
14 files changed, 468 insertions, 0 deletions
diff --git a/recipes/apmd/apm-tosa-suspendfix_0.1.bb b/recipes/apmd/apm-tosa-suspendfix_0.1.bb new file mode 100644 index 0000000000..ad223c1959 --- /dev/null +++ b/recipes/apmd/apm-tosa-suspendfix_0.1.bb @@ -0,0 +1,10 @@ +DESCRIPTION = "Workaround for bug 2134 (Tosa Angstrom x11 image suspend/resume failure)" +AUTHOR = "Dmitry Baryshkov" +PR = "r0" + +SRC_URI = "file://50-tmio-ohci-unbind" + +do_install() { + install -d ${D}${sysconfdir}/apm/event.d + install -m 0755 ${WORKDIR}/50-tmio-ohci-unbind ${D}${sysconfdir}/apm/event.d +} diff --git a/recipes/apmd/apm-wifi-suspendfix_0.1.bb b/recipes/apmd/apm-wifi-suspendfix_0.1.bb new file mode 100644 index 0000000000..ab9959f3f1 --- /dev/null +++ b/recipes/apmd/apm-wifi-suspendfix_0.1.bb @@ -0,0 +1,10 @@ +DESCRIPTION = "Hacky workaround for bug 3664 (some wifi cards don't recover from suspend) until a real fix is found" +AUTHOR = "Rolf Leggewie" +PR = "r0" + +SRC_URI = "file://90-wifi-off" + +do_install() { + install -d ${D}${sysconfdir}/apm/suspend.d + install -m 0755 ${WORKDIR}/90-wifi-off ${D}${sysconfdir}/apm/suspend.d +} diff --git a/recipes/apmd/apmd-3.2.2/apmd_proxy b/recipes/apmd/apmd-3.2.2/apmd_proxy new file mode 100644 index 0000000000..c48ee4e5d5 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/apmd_proxy @@ -0,0 +1,91 @@ +#!/bin/sh +# +# apmd_proxy - program dispatcher for APM daemon +# +# Written by Craig Markwardt (craigm@lheamail.gsfc.nasa.gov) 21 May 1999 +# Modified for Debian by Avery Pennarun +# +# This shell script is called by the APM daemon (apmd) when a power +# management event occurs. Its first and second arguments describe the +# event. For example, apmd will call "apmd_proxy suspend system" just +# before the system is suspended. +# +# Here are the possible arguments: +# +# start - APM daemon has started +# stop - APM daemon is shutting down +# suspend critical - APM system indicates critical suspend (++) +# suspend system - APM system has requested suspend mode +# suspend user - User has requested suspend mode +# standby system - APM system has requested standby mode +# standby user - User has requested standby mode +# resume suspend - System has resumed from suspend mode +# resume standby - System has resumed from standby mode +# resume critical - System has resumed from critical suspend +# change battery - APM system reported low battery +# change power - APM system reported AC/battery change +# change time - APM system reported time change (*) +# change capability - APM system reported config. change (+) +# +# (*) - APM daemon may be configured to not call these sequences +# (+) - Available if APM kernel supports it. +# (++) - "suspend critical" is never passed to apmd from the kernel, +# so we will never see it here. Scripts that process "resume +# critical" events need to take this into account. +# +# It is the proxy script's responsibility to examine the APM status +# (via /proc/apm) or other status and to take appropriate actions. +# For example, the script might unmount network drives before the +# machine is suspended. +# +# In Debian, the usual way of adding functionality to the proxy is to +# add a script to /etc/apm/event.d. This script will be called by +# apmd_proxy (via run-parts) with the same arguments. +# +# If it is important that a certain set of script be run in a certain +# order on suspend and in a different order on resume, then put all +# the scripts in /etc/apm/scripts.d instead of /etc/apm/event.d and +# symlink to these from /etc/apm/suspend.d, /etc/apm/resume.d and +# /etc/apm/other.d using names whose lexicographical order is the same +# as the desired order of execution. +# +# If the kernel's APM driver supports it, apmd_proxy can return a non-zero +# exit status on suspend and standby events, indicating that the suspend +# or standby event should be rejected. +# +# ******************************************************************* + +set -e + +# The following doesn't yet work, because current kernels (up to at least +# 2.4.20) do not support rejection of APM events. Supporting this would +# require substantial modifications to the APM driver. We will re-enable +# this feature if the driver is ever modified. -- cph@debian.org +# +#SUSPEND_ON_AC=false +#[ -r /etc/apm/apmd_proxy.conf ] && . /etc/apm/apmd_proxy.conf +# +#if [ "${SUSPEND_ON_AC}" = "false" -a "${2}" = "system" ] \ +# && on_ac_power >/dev/null; then +# # Reject system suspends and standbys if we are on AC power +# exit 1 # Reject (NOTE kernel support must be enabled) +#fi + +if [ "${1}" = "suspend" -o "${1}" = "standby" ]; then + run-parts -a "${1}" -a "${2}" /etc/apm/event.d + if [ -d /etc/apm/suspend.d ]; then + run-parts -a "${1}" -a "${2}" /etc/apm/suspend.d + fi +elif [ "${1}" = "resume" ]; then + if [ -d /etc/apm/resume.d ]; then + run-parts -a "${1}" -a "${2}" /etc/apm/resume.d + fi + run-parts -a "${1}" -a "${2}" /etc/apm/event.d +else + run-parts -a "${1}" -a "${2}" /etc/apm/event.d + if [ -d /etc/apm/other.d ]; then + run-parts -a "${1}" -a "${2}" /etc/apm/other.d + fi +fi + +exit 0 diff --git a/recipes/apmd/apmd-3.2.2/apmd_proxy.conf b/recipes/apmd/apmd-3.2.2/apmd_proxy.conf new file mode 100644 index 0000000000..751145c522 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/apmd_proxy.conf @@ -0,0 +1,16 @@ +# /etc/apm/apmd_proxy.conf: configuration file for apmd. +# +# This file is managed by debconf when installing or reconfiguring the +# package. It is generated by merging the answers gathered by debconf +# into the template file "/usr/share/apmd/apmd_proxy.conf". + +# The following doesn't yet work, because current kernels (up to at least +# 2.4.20) do not support rejection of APM events. Supporting this would +# require substantial modifications to the APM driver. We will re-enable +# this feature if the driver is ever modified. -- cph@debian.org +# +# Set the following to "false" if you want to reject system suspend or +# system standby requests when the computer is running on AC power. +# Otherwise set this to "true". Such requests are never rejected when +# the computer is running on battery power. +#SUSPEND_ON_AC=true diff --git a/recipes/apmd/apmd-3.2.2/debian.patch b/recipes/apmd/apmd-3.2.2/debian.patch new file mode 100644 index 0000000000..d49e524bbd --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/debian.patch @@ -0,0 +1,54 @@ +--- apmd-3.2.2.orig/apmd.c ++++ apmd-3.2.2/apmd.c +@@ -343,7 +343,7 @@ + /* parent */ + int status, retval; + ssize_t len; +- time_t time_limit; ++ time_t countdown; + + if (pid < 0) { + /* Couldn't fork */ +@@ -356,8 +356,9 @@ + /* Capture the child's output, if any, but only until it terminates */ + close(fds[1]); + fcntl(fds[0], F_SETFL, O_RDONLY|O_NONBLOCK); +- time_limit = time(0) + proxy_timeout; ++ countdown = proxy_timeout; + do { ++ countdown -= 1; + while ((len = read(fds[0], line, sizeof(line)-1)) > 0) { + line[len] = 0; + APMD_SYSLOG(LOG_INFO, "+ %s", line); +@@ -372,16 +373,16 @@ + goto proxy_done; + } + +- sleep(1); ++ while (sleep(1) > 0) ; + } while ( +- (time(0) < time_limit) ++ (countdown >= 0) + || (proxy_timeout < 0) + ); + + APMD_SYSLOG(LOG_NOTICE, "Proxy has been running more than %d seconds; killing it", proxy_timeout); + + kill(pid, SIGTERM); +- time_limit = time(0) + 5; ++ countdown = 5; + do { + retval = waitpid(pid, &status, WNOHANG); + if (retval == pid) +@@ -392,9 +393,9 @@ + goto proxy_done; + } + +- sleep(1); ++ while (sleep(1) > 0) ; + +- } while (time(0) < time_limit); ++ } while (countdown >= 0); + + kill(pid, SIGKILL); + status = __W_EXITCODE(0, SIGKILL); diff --git a/recipes/apmd/apmd-3.2.2/default b/recipes/apmd/apmd-3.2.2/default new file mode 100644 index 0000000000..4b7965abf8 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/default @@ -0,0 +1,8 @@ +# +# Default for /etc/init.d/apmd +# + +# As apmd can be called with arguments, we use the following variable +# to store them, e.g., APMD="-w 5 -p 2". +# See the manual page apmd(8) for details. +APMD="--proxy-timeout 30" diff --git a/recipes/apmd/apmd-3.2.2/init b/recipes/apmd/apmd-3.2.2/init new file mode 100755 index 0000000000..f1098a752d --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/init @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Start or stop the Advanced Power Management daemon. +# +# Written by Dirk Eddelbuettel <edd@debian.org> +# Greatly modified by Avery Pennarun <apenwarr@debian.org> +# +# I think this script is now free of bashisms. +# Please correct me if I'm wrong! + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +[ -f /etc/default/rcS ] && . /etc/default/rcS +[ -f /etc/default/apmd ] && . /etc/default/apmd + +case "$1" in + start) + echo -n "Starting advanced power management daemon: " + start-stop-daemon -S -x /usr/sbin/apmd -- \ + -P /etc/apm/apmd_proxy $APMD + if [ $? = 0 ]; then + echo "apmd." + else + echo "(failed.)" + fi + ;; + stop) + echo -n "Stopping advanced power management daemon: " + start-stop-daemon -K \ + -x /usr/sbin/apmd + echo "apmd." + ;; + restart|force-reload) + $0 stop + $0 start + exit + ;; + *) + echo "Usage: /etc/init.d/apmd {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/apmd/apmd-3.2.2/libtool.patch b/recipes/apmd/apmd-3.2.2/libtool.patch new file mode 100644 index 0000000000..bf8a373b63 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/libtool.patch @@ -0,0 +1,16 @@ +Index: apmd-3.2.2.orig/Makefile +=================================================================== +--- apmd-3.2.2.orig.orig/Makefile 2004-01-04 08:13:18.000000000 +0000 ++++ apmd-3.2.2.orig/Makefile 2008-04-21 17:10:03.000000000 +0100 +@@ -58,9 +57,8 @@ + #CFLAGS=-O3 -m486 -fomit-frame-pointer + #LDFLAGS=-s + +-LIBTOOL=libtool --quiet +-LT_COMPILE = $(LIBTOOL) --mode=compile $(CC) +-LT_LINK = $(LIBTOOL) --mode=link $(CC) ++LT_COMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) ++LT_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC) + LT_INSTALL = $(LIBTOOL) --mode=install install + LT_CLEAN = $(LIBTOOL) --mode=clean rm + diff --git a/recipes/apmd/apmd-3.2.2/unlinux.patch b/recipes/apmd/apmd-3.2.2/unlinux.patch new file mode 100644 index 0000000000..f7eec6eb03 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/unlinux.patch @@ -0,0 +1,12 @@ +--- apmd-3.2.2.orig/Makefile ++++ apmd-3.2.2/Makefile +@@ -43,8 +43,7 @@ + + CC=gcc + CFLAGS=-O -g +-XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include \ +- -I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \ ++XTRACFLAGS=-Wall -pipe -I. \ + -DVERSION=\"$(VERSION)\" \ + -DDEFAULT_PROXY_NAME=\"$(PROXY_DIR)/apmd_proxy\" + LDFLAGS= diff --git a/recipes/apmd/apmd-3.2.2/workaround.patch b/recipes/apmd/apmd-3.2.2/workaround.patch new file mode 100644 index 0000000000..19cf073115 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/workaround.patch @@ -0,0 +1,55 @@ + +# +# Patch managed by http://www.holgerschurig.de/patcher.html +# + +--- apmd-3.2.2.orig/apmd.c~workaround.patch ++++ apmd-3.2.2.orig/apmd.c +@@ -158,6 +158,7 @@ + static int quiet_bios_batlow; /* = 0 */ + static int verbosity = DEFAULT_VERBOSITY; + static int warn_level = 10; ++static int sleep_now = 0; /* ntp */ + + static uid_t apmd_uid = 0; + static int apmd_fd = -1; +@@ -942,6 +943,12 @@ + exit(0); + } + ++/* ntp */ ++static void sig_usr1(int sig) ++{ ++ sleep_now = 1; ++} ++ + int main(int argc, char **argv) + { + int c; +@@ -1151,6 +1158,8 @@ + openlog("apmd", (verbosity>=LOG_DEBUG)?LOG_PERROR:0 | LOG_PID | LOG_CONS, LOG_DAEMON); + + /* Set up signal handler */ ++ if (signal(SIGUSR1, SIG_IGN) != SIG_IGN) ++ signal(SIGUSR1, sig_usr1); /* ntp */ + if (signal(SIGINT, SIG_IGN) != SIG_IGN) + signal(SIGINT, sig_handler); + if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) +@@ -1230,9 +1239,16 @@ + + for (;;) + { +- int num_events = apm_get_events(apmd_fd, check_interval, events, MAX_EVENTS); ++ int num_events; + int e, a; + ++ /* ntp */ ++ if (sleep_now) { ++ sleep_now = 0; ++ handle_event(APM_USER_SUSPEND, &apminfo); ++ } ++ ++ num_events = apm_get_events(apmd_fd, check_interval, events, MAX_EVENTS); + apm_read(&apminfo); + + if (num_events == 0) { diff --git a/recipes/apmd/apmd-3.2.2/zaurus24.patch b/recipes/apmd/apmd-3.2.2/zaurus24.patch new file mode 100644 index 0000000000..5df016ab77 --- /dev/null +++ b/recipes/apmd/apmd-3.2.2/zaurus24.patch @@ -0,0 +1,50 @@ +Index: apmd-3.2.2.orig/apm.c +=================================================================== +--- apmd-3.2.2.orig.orig/apm.c 2006-01-26 15:15:27.000000000 +0100 ++++ apmd-3.2.2.orig/apm.c 2006-01-26 17:50:14.000000000 +0100 +@@ -24,10 +24,12 @@ + #include <unistd.h> + #include <sys/types.h> + #include <sys/stat.h> ++#include <sys/utsname.h> + #include <fcntl.h> + #include <errno.h> + #include <time.h> + #include <getopt.h> ++#include <signal.h> + #include "apm.h" + + static int verbose = 0; +@@ -43,6 +45,9 @@ + int fd; + time_t then, now; + int error; ++ FILE* pid_file; ++ int apmd_pid; ++ struct utsname uname_ver; + + fd = open(APM_DEVICE, O_WRONLY); + if (fd < 0) +@@ -54,6 +59,22 @@ + switch (mode) + { + case SUSPEND: ++ if(0 == system("grep -i hardware /proc/cpuinfo|grep -i SHARP")) ++ { ++ uname(&uname_ver); ++ ++ if(0 == strncmp("2.4", uname_ver.release, 3)) ++ { ++ pid_file = fopen("/var/run/apmd.pid", "r"); ++ if(pid_file) ++ { ++ fscanf(pid_file, "%d", &apmd_pid); ++ fclose(pid_file); ++ } ++ ++ kill(apmd_pid, SIGKILL); ++ } ++ } + error = apm_suspend(fd); + break; + case STANDBY: diff --git a/recipes/apmd/apmd_3.2.2.bb b/recipes/apmd/apmd_3.2.2.bb new file mode 100644 index 0000000000..471ee9ca10 --- /dev/null +++ b/recipes/apmd/apmd_3.2.2.bb @@ -0,0 +1,71 @@ +DESCRIPTION = "Set of tools for managing notebook power consumption." +SECTION = "base" +PRIORITY = "required" +DEPENDS = "libtool-cross" +LICENSE = "GPL" +PR = "r11.01" + +SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_${PV}.orig.tar.gz \ + file://debian.patch;patch=1 \ + file://workaround.patch;patch=1 \ + file://zaurus24.patch;patch=1 \ + file://unlinux.patch;patch=1 \ + file://libtool.patch;patch=1 \ + file://init \ + file://default \ + file://apmd_proxy \ + file://apmd_proxy.conf" + +S = "${WORKDIR}/apmd-${PV}.orig" + +inherit update-rc.d + +INITSCRIPT_NAME = "apmd" +INITSCRIPT_PARAMS = "defaults" + +do_compile() { + oe_runmake "LIBTOOL=${STAGING_BINDIR_NATIVE}/${TARGET_PREFIX}libtool" apm apmd +} + +do_stage() { + install -m 0644 apm.h ${STAGING_INCDIR} + oe_libinstall -so libapm ${STAGING_LIBDIR} +} + +do_install() { + install -d ${D}${sysconfdir} + install -d ${D}${sysconfdir}/apm + install -d ${D}${sysconfdir}/apm/event.d + install -d ${D}${sysconfdir}/apm/other.d + install -d ${D}${sysconfdir}/apm/suspend.d + install -d ${D}${sysconfdir}/apm/resume.d + install -d ${D}${sysconfdir}/apm/scripts.d + install -d ${D}${sysconfdir}/default + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sbindir} + install -d ${D}${bindir} + install -d ${D}${libdir} + install -d ${D}${datadir}/apmd + install -d ${D}${includedir} + + install -m 4755 ${S}/.libs/apm ${D}${bindir}/apm + install -m 0755 ${S}/.libs/apmd ${D}${sbindir}/apmd + install -m 0755 ${WORKDIR}/apmd_proxy ${D}${sysconfdir}/apm/ + install -m 0644 ${WORKDIR}/apmd_proxy.conf ${D}${datadir}/apmd/ + install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/apmd + oe_libinstall -so libapm ${D}${libdir} + install -m 0644 apm.h ${D}${includedir} + for i in `find ${D} -name "*.la"` ; do \ + sed -i -e s:${STAGING_LIBDIR}:${libdir}:g $i + sed -i -e s:${STAGING_DIR_HOST}::g $i + done + + cat ${WORKDIR}/init | sed -e 's,/usr/sbin,${sbindir},g; s,/etc,${sysconfdir},g;' > ${D}${sysconfdir}/init.d/apmd + chmod 755 ${D}${sysconfdir}/init.d/apmd +} + +PACKAGES =+ "libapm libapm-dev apm" + +FILES_libapm = "${libdir}/libapm.so.*" +FILES_libapm-dev = "${libdir}/libapm.* ${includedir}" +FILES_apm = "${bindir}/apm*" diff --git a/recipes/apmd/files/50-tmio-ohci-unbind b/recipes/apmd/files/50-tmio-ohci-unbind new file mode 100644 index 0000000000..f65e0b37d3 --- /dev/null +++ b/recipes/apmd/files/50-tmio-ohci-unbind @@ -0,0 +1,19 @@ +#!/bin/sh + +TOPATH=/sys/bus/platform/drivers/tmio-ohci + +case "$1" in + suspend) + if [ -d $TOPATH ] + then + echo -n tmio-ohci > $TOPATH/unbind + fi + ;; + resume) + if [ -d $TOPATH ] + then + echo -n tmio-ohci > $TOPATH/bind + fi + ;; +esac + diff --git a/recipes/apmd/files/90-wifi-off b/recipes/apmd/files/90-wifi-off new file mode 100644 index 0000000000..645484b8cd --- /dev/null +++ b/recipes/apmd/files/90-wifi-off @@ -0,0 +1,12 @@ +#!/bin/sh +#Author: Rolf Leggewie +# +# turn off wifi cards before suspend so they are fully reloaded upon resume + +wifislot = `pccardctl ls|egrep '(hostap|orinoco|libertas)'|cut -f 2 -d " "` +if test $wifislot +then + for slot in $wifislot; do + pccardctl eject $wifislot + done +fi |