summaryrefslogtreecommitdiffstats
path: root/abs/core/acpid
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/acpid')
-rw-r--r--abs/core/acpid/Makefile56
-rw-r--r--abs/core/acpid/PKGBUILD34
-rw-r--r--abs/core/acpid/__changelog2
-rw-r--r--abs/core/acpid/acpid35
-rw-r--r--abs/core/acpid/acpid-1.0.4-gcc4.patch20
-rw-r--r--abs/core/acpid/anything3
-rw-r--r--abs/core/acpid/default20
-rwxr-xr-xabs/core/acpid/handler.sh68
8 files changed, 238 insertions, 0 deletions
diff --git a/abs/core/acpid/Makefile b/abs/core/acpid/Makefile
new file mode 100644
index 0000000..a5fe385
--- /dev/null
+++ b/abs/core/acpid/Makefile
@@ -0,0 +1,56 @@
+# Makefile for ACPI daemon
+
+# update these numbers for new releases
+VERSION = 1.0.6
+
+INSTPREFIX =
+BINDIR = $(INSTPREFIX)/usr/bin
+SBINDIR = $(INSTPREFIX)/usr/sbin
+MAN8DIR = $(INSTPREFIX)/usr/share/man/man8
+
+SBIN_PROGS = acpid
+BIN_PROGS = acpi_listen
+PROGS = $(SBIN_PROGS) $(BIN_PROGS)
+
+acpid_SRCS = acpid.c event.c ud_socket.c
+acpid_OBJS = $(acpid_SRCS:.c=.o)
+
+acpi_listen_SRCS = acpi_listen.c ud_socket.c
+acpi_listen_OBJS = $(acpi_listen_SRCS:.c=.o)
+
+MAN8 = acpid.8 acpi_listen.8
+MAN8GZ = $(MAN8:.8=.8.gz)
+
+CFLAGS = -Wall -Werror -g $(DEFS) -D_GNU_SOURCE
+DEFS = -DVERSION="\"$(VERSION)\""
+
+all: $(PROGS)
+
+acpid: $(acpid_OBJS)
+
+acpi_listen: $(acpi_listen_OBJS)
+
+man: $(MAN8)
+ for a in $^; do gzip -f -9 -c $$a > $$a.gz; done
+
+install: $(PROGS) man
+ mkdir -p $(SBINDIR)
+ mkdir -p $(BINDIR)
+ install -m 750 acpid $(SBINDIR)
+ install -m 755 acpi_listen $(BINDIR)
+ mkdir -p $(MAN8DIR)
+ install -m 644 $(MAN8GZ) $(MAN8DIR)
+
+DISTTMP=/tmp
+dist:
+ rm -rf $(DISTTMP)/acpid-$(VERSION)
+ mkdir -p $(DISTTMP)/acpid-$(VERSION)
+ cp -a * $(DISTTMP)/acpid-$(VERSION)
+ find $(DISTTMP)/acpid-$(VERSION) -type d -name CVS | xargs rm -rf
+ make -C $(DISTTMP)/acpid-$(VERSION) clean
+ tar -C $(DISTTMP) -zcvf acpid-$(VERSION).tar.gz acpid-$(VERSION)
+ rm -rf $(DISTTMP)/acpid-$(VERSION)
+
+clean:
+ $(RM) $(PROGS) $(MAN8GZ) *.o
+
diff --git a/abs/core/acpid/PKGBUILD b/abs/core/acpid/PKGBUILD
new file mode 100644
index 0000000..5b9d033
--- /dev/null
+++ b/abs/core/acpid/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 20369 2008-12-03 02:03:14Z thayer $
+# Contributor: Manolis Tzanidakis
+# Contributor: Judd Vinet <jvinet@zeroflux.org>
+# Maintainer: Thayer Williams <thayer@archlinux.org>
+
+pkgname=acpid
+pkgver=1.0.8
+pkgrel=2
+pkgdesc="A daemon for delivering ACPI power management events"
+url="http://acpid.sourceforge.net"
+license=('GPL2')
+arch=('i686' 'x86_64')
+depends=(glibc)
+source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz
+ acpid
+ anything
+ handler.sh)
+backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything')
+
+build() {
+ cd $srcdir/$pkgname-$pkgver
+ /usr/bin/make || return 1
+ /bin/install -d -m0755 $pkgdir/usr/bin || return 1
+ /usr/bin/make INSTPREFIX=$pkgdir \
+ MAN8DIR=$pkgdir/usr/share/man/man8 install || return 1
+
+ # install our supplementary scripts
+ /bin/install -D -m0755 $srcdir/acpid $pkgdir/etc/rc.d/acpid || return 1
+ /bin/install -D -m0644 $srcdir/anything $pkgdir/etc/acpi/events/anything || return 1
+ /bin/install -D -m0755 $srcdir/handler.sh $pkgdir/etc/acpi/handler.sh || return 1
+
+ # set world readable bit on the acpid binary
+ /bin/chmod 755 $pkgdir/usr/sbin/acpid || return 1
+}
diff --git a/abs/core/acpid/__changelog b/abs/core/acpid/__changelog
new file mode 100644
index 0000000..1de4ec0
--- /dev/null
+++ b/abs/core/acpid/__changelog
@@ -0,0 +1,2 @@
+Modify handler.sh to use runit-init.
+
diff --git a/abs/core/acpid/acpid b/abs/core/acpid/acpid
new file mode 100644
index 0000000..585944f
--- /dev/null
+++ b/abs/core/acpid/acpid
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/acpid`
+case "$1" in
+ start)
+ stat_busy "Starting acpid"
+ [ -z "$PID" ] && /usr/sbin/acpid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon acpid
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping acpid"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon acpid
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/abs/core/acpid/acpid-1.0.4-gcc4.patch b/abs/core/acpid/acpid-1.0.4-gcc4.patch
new file mode 100644
index 0000000..b56901d
--- /dev/null
+++ b/abs/core/acpid/acpid-1.0.4-gcc4.patch
@@ -0,0 +1,20 @@
+--- acpid-1.0.4/ud_socket.c 2005-04-26 10:26:29.000000000 +0000
++++ acpid-1.0.4.az/ud_socket.c 2005-04-26 10:27:09.000000000 +0000
+@@ -60,7 +60,7 @@
+ struct sockaddr_un cliaddr;
+ int len = sizeof(struct sockaddr_un);
+
+- newsock = accept(listenfd, (struct sockaddr *)&cliaddr, &len);
++ newsock = accept(listenfd, (struct sockaddr *)&cliaddr, (socklen_t *)&len);
+ if (newsock < 0) {
+ if (errno == EINTR) {
+ continue; /* signal */
+@@ -71,7 +71,7 @@
+
+ if (cred) {
+ len = sizeof(struct ucred);
+- getsockopt(newsock, SOL_SOCKET, SO_PEERCRED,cred,&len);
++ getsockopt(newsock, SOL_SOCKET, SO_PEERCRED,cred,(socklen_t *)&len);
+ }
+
+ return newsock;
diff --git a/abs/core/acpid/anything b/abs/core/acpid/anything
new file mode 100644
index 0000000..d182898
--- /dev/null
+++ b/abs/core/acpid/anything
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=.*
+action=/etc/acpi/handler.sh %e
diff --git a/abs/core/acpid/default b/abs/core/acpid/default
new file mode 100644
index 0000000..93944aa
--- /dev/null
+++ b/abs/core/acpid/default
@@ -0,0 +1,20 @@
+# This is the ACPID default configuration, it takes all
+# events and passes them to /etc/acpi/default.sh for further
+# processing.
+
+# event keeps a regular expression matching the event. To get
+# power events only, just use something like "event=button power.*"
+# to catch it.
+# action keeps the command to be executed after an event occurs
+#This halts the computer when the Power button is pressed.
+
+event=button power.*
+#action=/sbin/shutdown -h now
+action=/usr/local/sbin/shutdown.sh
+
+# Optionally you can specify the placeholder %e. It will pass
+# through the whole kernel event message to the program you've
+# specified.
+
+event=.*
+action=/etc/acpi/acpi_handler.sh %e
diff --git a/abs/core/acpid/handler.sh b/abs/core/acpid/handler.sh
new file mode 100755
index 0000000..f6b0f9b
--- /dev/null
+++ b/abs/core/acpid/handler.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
+# modify it to not use /sys
+
+minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
+
+set $*
+
+case "$1" in
+ button/power)
+ #echo "PowerButton pressed!">/dev/tty5
+ case "$2" in
+ PWRF) logger "PowerButton pressed: $2"
+ /sbin/runit-init 0
+ /sbin/poweroff
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/sleep)
+ case "$2" in
+ SLPB) echo -n mem >/sys/power/state ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ ac_adapter)
+ case "$2" in
+ AC)
+ case "$4" in
+ 00000000)
+ echo -n $minspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode start
+ ;;
+ 00000001)
+ echo -n $maxspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode stop
+ ;;
+ esac
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ battery)
+ case "$2" in
+ BAT0)
+ case "$4" in
+ 00000000) #echo "offline" >/dev/tty5
+ ;;
+ 00000001) #echo "online" >/dev/tty5
+ ;;
+ esac
+ ;;
+ CPU0)
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/lid)
+ #echo "LID switched!">/dev/tty5
+ ;;
+ *)
+ logger "ACPI group/action undefined: $1 / $2"
+ ;;
+esac