diff options
author | root <root@rshg047.dnsready.net> | 2011-05-16 22:43:10 +0000 |
---|---|---|
committer | root <root@rshg047.dnsready.net> | 2011-05-16 22:43:10 +0000 |
commit | 2f0d12506e7145c0fe4c056e4fbcda1e724dda95 (patch) | |
tree | 8239b0d9ccc81417341ef1798c9bb8a99edce48d /testing/acpid | |
parent | a45aa8f19ea32f45610dafabfc06c8b7d1ed5cfe (diff) |
Mon May 16 22:43:24 UTC 2011
Diffstat (limited to 'testing/acpid')
-rw-r--r-- | testing/acpid/PKGBUILD | 42 | ||||
-rw-r--r-- | testing/acpid/acpid | 37 | ||||
-rw-r--r-- | testing/acpid/acpid.conf.d | 5 | ||||
-rw-r--r-- | testing/acpid/anything | 3 | ||||
-rw-r--r-- | testing/acpid/handler.sh | 65 |
5 files changed, 152 insertions, 0 deletions
diff --git a/testing/acpid/PKGBUILD b/testing/acpid/PKGBUILD new file mode 100644 index 000000000..a8bfa9018 --- /dev/null +++ b/testing/acpid/PKGBUILD @@ -0,0 +1,42 @@ +# $Id: PKGBUILD 123979 2011-05-15 11:10:08Z andrea $ +# Maintainer: +# Contributor: xduugu +# Contributor: Manolis Tzanidakis +# Contributor: Jonathan Schmidt <j.schmidt@archlinux.us + +pkgname=acpid +pkgver=2.0.9 +pkgrel=2 +pkgdesc="A daemon for delivering ACPI power management events with netlink support" +arch=('i686' 'x86_64') +url="http://tedfelix.com/linux/acpid-netlink.html" +license=('GPL') +depends=('bash') +source=("http://www.tedfelix.com/linux/$pkgname-$pkgver.tar.gz" + 'acpid' + 'anything' + 'handler.sh' + 'acpid.conf.d') +backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything' 'etc/conf.d/acpid') + +build() { + cd "${srcdir}"/$pkgname-$pkgver + make +} + +package() { + cd "${srcdir}"/$pkgname-$pkgver + make DESTDIR="${pkgdir}" install + + install -Dm755 "$srcdir/acpid" "$pkgdir/etc/rc.d/acpid" + install -Dm644 "$srcdir/anything" "$pkgdir/etc/acpi/events/anything" + install -Dm755 "$srcdir/handler.sh" "$pkgdir/etc/acpi/handler.sh" + install -Dm644 "$srcdir/acpid.conf.d" "$pkgdir/etc/conf.d/acpid" + + chmod 755 "${pkgdir}"/usr/sbin/acpid +} +md5sums=('8b30aa1b31f607161745a4ac7a19699b' + '955490c4db5233ec44461db694b873a4' + '2d37b98d6e74bab815604b8b48c6cfd4' + '7b2e4c299af5eb87e1a81c07b6916c97' + '929c6d2e91295c22ed9ec6212d7eabef') diff --git a/testing/acpid/acpid b/testing/acpid/acpid new file mode 100644 index 000000000..9177c8207 --- /dev/null +++ b/testing/acpid/acpid @@ -0,0 +1,37 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +[ -f /etc/conf.d/acpid ] && . /etc/conf.d/acpid + +PID=`pidof -o %PPID /usr/sbin/acpid` +case "$1" in + start) + stat_busy "Starting acpid" + [ -z "$PID" ] && /usr/sbin/acpid $ACPID_ARGS + 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/testing/acpid/acpid.conf.d b/testing/acpid/acpid.conf.d new file mode 100644 index 000000000..b60103a2d --- /dev/null +++ b/testing/acpid/acpid.conf.d @@ -0,0 +1,5 @@ +# +# Arguments to be passed to the acpid daemon +# + +ACPID_ARGS="" diff --git a/testing/acpid/anything b/testing/acpid/anything new file mode 100644 index 000000000..d1828989b --- /dev/null +++ b/testing/acpid/anything @@ -0,0 +1,3 @@ +# Pass all events to our one handler script +event=.* +action=/etc/acpi/handler.sh %e diff --git a/testing/acpid/handler.sh b/testing/acpid/handler.sh new file mode 100644 index 000000000..518a62dea --- /dev/null +++ b/testing/acpid/handler.sh @@ -0,0 +1,65 @@ +#!/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" ;; + *) 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|ACAD|ADP0) + 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 |