summaryrefslogtreecommitdiff
path: root/community/acpid
diff options
context:
space:
mode:
Diffstat (limited to 'community/acpid')
-rw-r--r--community/acpid/PKGBUILD43
-rw-r--r--community/acpid/acpid38
-rw-r--r--community/acpid/acpid.conf.d5
-rw-r--r--community/acpid/anything3
-rw-r--r--community/acpid/handler.sh70
5 files changed, 159 insertions, 0 deletions
diff --git a/community/acpid/PKGBUILD b/community/acpid/PKGBUILD
new file mode 100644
index 000000000..fa62a9ebb
--- /dev/null
+++ b/community/acpid/PKGBUILD
@@ -0,0 +1,43 @@
+# $Id: PKGBUILD 67166 2012-03-05 00:42:11Z pschmitz $
+# Maintainer:
+# Contributor: xduugu
+# Contributor: Manolis Tzanidakis
+# Contributor: Jonathan Schmidt <j.schmidt@archlinux.us
+
+pkgname=acpid
+pkgver=2.0.14
+pkgrel=1
+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')
+replaces=('acpid2')
+backup=('etc/acpi/handler.sh' 'etc/acpi/events/anything' 'etc/conf.d/acpid')
+source=("http://www.tedfelix.com/linux/$pkgname-$pkgver.tar.gz"
+ 'acpid'
+ 'anything'
+ 'handler.sh'
+ 'acpid.conf.d')
+md5sums=('14fc1eabc3489f3ded9347fcd55f158a'
+ 'd69203a032c4583f9abaafcf21a7ed84'
+ '2d37b98d6e74bab815604b8b48c6cfd4'
+ 'd411b758e8531adee191b66bcbc2892d'
+ '929c6d2e91295c22ed9ec6212d7eabef')
+
+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
+}
diff --git a/community/acpid/acpid b/community/acpid/acpid
new file mode 100644
index 000000000..288ac078d
--- /dev/null
+++ b/community/acpid/acpid
@@ -0,0 +1,38 @@
+#!/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
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/community/acpid/acpid.conf.d b/community/acpid/acpid.conf.d
new file mode 100644
index 000000000..b60103a2d
--- /dev/null
+++ b/community/acpid/acpid.conf.d
@@ -0,0 +1,5 @@
+#
+# Arguments to be passed to the acpid daemon
+#
+
+ACPID_ARGS=""
diff --git a/community/acpid/anything b/community/acpid/anything
new file mode 100644
index 000000000..d1828989b
--- /dev/null
+++ b/community/acpid/anything
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=.*
+action=/etc/acpi/handler.sh %e
diff --git a/community/acpid/handler.sh b/community/acpid/handler.sh
new file mode 100644
index 000000000..505ed7c11
--- /dev/null
+++ b/community/acpid/handler.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+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
+ PBTN|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)
+ case "$3" in
+ close)
+ #echo "LID closed!">/dev/tty5
+ ;;
+ open)
+ #echo "LID opened!">/dev/tty5
+ ;;
+ esac
+ ;;
+
+ *)
+ logger "ACPI group/action undefined: $1 / $2"
+ ;;
+esac