summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openembedded.org>2006-01-26 16:59:16 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-01-26 16:59:16 +0000
commit8d17ee65c66e5e6af8a835c43ef7567b9451144e (patch)
tree81271ed5088561e1118fa1ef98f983da5573dc4e
parentba8c1624b6e26e750a9b6faf9cc31f766d999035 (diff)
apm: finally fixed suspend/resume problem on Zaurus with 2.4-crapix
- rewritten /usr/bin/apm wrapper from shell to C and added into apm - now Zaurus machines can be suspended by non-root users - die Sharp, die!
-rw-r--r--packages/apmd/apmd-3.2.2/apmwrapper9
-rw-r--r--packages/apmd/apmd-3.2.2/devfs.patch11
-rw-r--r--packages/apmd/apmd-3.2.2/hwclock16
-rw-r--r--packages/apmd/apmd-3.2.2/logcheck.ignore.paranoid13
-rw-r--r--packages/apmd/apmd-3.2.2/zaurus24.patch50
-rw-r--r--packages/apmd/apmd_3.2.2.bb25
6 files changed, 53 insertions, 71 deletions
diff --git a/packages/apmd/apmd-3.2.2/apmwrapper b/packages/apmd/apmd-3.2.2/apmwrapper
deleted file mode 100644
index 3bc9bece3d..0000000000
--- a/packages/apmd/apmd-3.2.2/apmwrapper
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if ( cat /proc/cpuinfo|grep -i hardware|grep -i SHARP ) && \
- [ ".$@" = ".-s" -o ".$@" = ".--suspend" ]; then
- killall -USR1 apmd || /usr/bin/apm.orig -s
-else
- /usr/bin/apm.orig "$@"
-fi
-
diff --git a/packages/apmd/apmd-3.2.2/devfs.patch b/packages/apmd/apmd-3.2.2/devfs.patch
deleted file mode 100644
index b11e01929b..0000000000
--- a/packages/apmd/apmd-3.2.2/devfs.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- apmd-3.2.0.orig/apm.h~devfs
-+++ apmd-3.2.0.orig/apm.h
-@@ -24,7 +24,7 @@
- #include <sys/types.h>
-
- #define APM_PROC "/proc/apm"
--#define APM_DEVICE "/dev/apm_bios"
-+#define APM_DEVICE "/dev/misc/apm_bios"
-
- #define APM_DEV "/proc/devices"
- #define APM_NAME "apm_bios"
diff --git a/packages/apmd/apmd-3.2.2/hwclock b/packages/apmd/apmd-3.2.2/hwclock
deleted file mode 100644
index a1c1c2294c..0000000000
--- a/packages/apmd/apmd-3.2.2/hwclock
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-# Preserve the system clock around suspend/resume.
-
-INIT="/etc/init.d/hwclock.sh"
-[ -x "${INIT}" ] || exit 0
-
-case "${1},${2}" in
-(suspend,*)
- "${INIT}" stop
- ;;
-(resume,suspend)
- "${INIT}" start
- ;;
-esac
-
-exit 0
diff --git a/packages/apmd/apmd-3.2.2/logcheck.ignore.paranoid b/packages/apmd/apmd-3.2.2/logcheck.ignore.paranoid
deleted file mode 100644
index de37f01a2d..0000000000
--- a/packages/apmd/apmd-3.2.2/logcheck.ignore.paranoid
+++ /dev/null
@@ -1,13 +0,0 @@
-apmd\[[0-9]+\]: (Normal|Standby|Critical) Resume
-apmd\[[0-9]+\]: (Now using|Using) (AC|battery|backup) power
-apmd\[[0-9]+\]: (System|User) (Standby|Suspend)
-apmd\[[0-9]+\]: (apmd_)?call_proxy:
-apmd\[[0-9]+\]: Battery: [0-9]+%,
-apmd\[[0-9]+\]: Battery: absent
-apmd\[[0-9]+\]: Capability Change
-apmd\[[0-9]+\]: Exiting
-apmd\[[0-9]+\]: Performing APM status check
-apmd\[[0-9]+\]: Suspending now
-apmd\[[0-9]+\]: Update Time
-apmd\[[0-9]+\]: Version: apmd [0-9.]+, (apm )?driver [0-9.]+, APM BIOS [0-9.]+
-apmd\[[0-9]+\]: apmd [0-9.]+ interfacing with apm driver [0-9.]+ and APM BIOS [0-9.]+
diff --git a/packages/apmd/apmd-3.2.2/zaurus24.patch b/packages/apmd/apmd-3.2.2/zaurus24.patch
new file mode 100644
index 0000000000..5df016ab77
--- /dev/null
+++ b/packages/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/packages/apmd/apmd_3.2.2.bb b/packages/apmd/apmd_3.2.2.bb
index 0e8b364458..206c520f8a 100644
--- a/packages/apmd/apmd_3.2.2.bb
+++ b/packages/apmd/apmd_3.2.2.bb
@@ -3,12 +3,12 @@ SECTION = "base"
PRIORITY = "required"
DEPENDS = "libtool-cross"
LICENSE = "GPL"
-PR = "r5"
+PR = "r6"
SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_${PV}.orig.tar.gz; \
file://debian.patch;patch=1 \
file://workaround.patch;patch=1 \
- file://apmwrapper \
+ file://zaurus24.patch;patch=1 \
file://init \
file://default \
file://apmd_proxy \
@@ -44,25 +44,8 @@ do_install() {
install -d ${D}${bindir}
install -d ${D}${libdir}
install -d ${D}${datadir}/apmd
-#
-# only Zaurus 2.4-embedix kernels need a breadead apm hack
-#
-#
- case ${MACHINE} in
- collie | poodle | tosa | c7x0 | akita | spitz | borzoi)
- if [ "${KERNEL_VERSION}" == "2.6" ]
- then
- install -m 4577 ${S}/.libs/apm ${D}${bindir}/apm
- else
- install -m 4755 ${S}/.libs/apm ${D}${bindir}/apm.orig
- install -m 0755 ${WORKDIR}/apmwrapper ${D}${bindir}/apm
- fi
- ;;
- *)
- install -m 4577 ${S}/.libs/apm ${D}${bindir}/apm
- ;;
- esac
+ install -m 4577 ${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/
@@ -79,5 +62,3 @@ PACKAGES =+ "libapm libapm-dev apm"
FILES_libapm = "${libdir}/libapm.so.*"
FILES_libapm-dev = "${libdir}/libapm.* ${includedir}"
FILES_apm = "${bindir}/apm*"
-
-