acpid: update to 2.0.10. Use default scripts from Arch.

--HG--
rename : srcpkgs/acpid/files/default.sh => srcpkgs/acpid/files/handler.sh
This commit is contained in:
Juan RP 2011-05-18 10:03:14 +02:00
parent a1f75dd84b
commit dadc3e98be
4 changed files with 75 additions and 71 deletions

View File

@ -0,0 +1,3 @@
# Pass all events to our one handler script
event=.*
action=/etc/acpi/handler.sh %e

View File

@ -1,59 +0,0 @@
#!/bin/sh
# /etc/acpi/default.sh
# Default acpi script that takes an entry for all actions
set $*
group=${1%%/*}
action=${1#*/}
device=$2
id=$3
value=$4
log_unhandled() {
logger "ACPI event unhandled: $*"
}
case "$group" in
button)
case "$action" in
power)
/sbin/init 0
;;
# if your laptop doesnt turn on/off the display via hardware
# switch and instead just generates an acpi event, you can force
# X to turn off the display via dpms. note you will have to run
# 'xhost +local:0' so root can access the X DISPLAY.
#lid)
# xset dpms force off
# ;;
*) log_unhandled $* ;;
esac
;;
ac_adapter)
case "$value" in
# Add code here to handle when the system is unplugged
# (maybe change cpu scaling to powersave mode). For
# multicore systems, make sure you set powersave mode
# for each core!
#*0)
# cpufreq-set -g powersave
# ;;
# Add code here to handle when the system is plugged in
# (maybe change cpu scaling to performance mode). For
# multicore systems, make sure you set performance mode
# for each core!
#*1)
# cpufreq-set -g performance
# ;;
*) log_unhandled $* ;;
esac
;;
*) log_unhandled $* ;;
esac

View File

@ -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

View File

@ -1,12 +1,12 @@
# Template file for 'acpid'
pkgname=acpid
version=2.0.9
version=2.0.10
revision=1
distfiles="http://tedfelix.com/linux/acpid-$version.tar.gz"
build_style=gnu_makefile
short_desc="The ACPI Daemon (acpid) With Netlink Support"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=f02a4931083ef52e6785c989d9d44720387c1d65a42bdcd364e3b06cd588ba65
checksum=ef7e4ed2f3594dd02a50a92fc47dc0e1fea80c07fab8a5f3d1040ee76fae0acb
long_desc="
In recent linux kernels, the /proc/acpi/event interface has been deprecated.
The same information (and more) is available via netlink (a way for the kernel
@ -14,20 +14,15 @@ long_desc="
input layer (mouse, keyboard, power button, etc...). This version of acpid
supports netlink and the input layer."
keep_empty_dirs=yes
openrc_services="acpid default true"
conf_files="/etc/conf.d/acpid"
Add_dependency full glibc
post_install()
{
install -d ${DESTDIR}/etc/acpi/events
chmod 755 ${DESTDIR}/usr/sbin/acpid
install -D -m755 ${FILESDIR}/acpid.rc \
${DESTDIR}/etc/init.d/acpid
install -D -m644 ${FILESDIR}/acpid.confd \
${DESTDIR}/etc/conf.d/acpid
install -D -m755 ${FILESDIR}/default.sh \
${DESTDIR}/etc/acpi/default.sh
install -D -m755 ${FILESDIR}/acpid.rc ${DESTDIR}/etc/init.d/acpid
install -D -m644 ${FILESDIR}/acpid.confd ${DESTDIR}/etc/conf.d/acpid
install -D -m755 ${FILESDIR}/handler.sh ${DESTDIR}/etc/acpi/handler.sh
install -D -m644 ${FILESDIR}/anything \
${DESTDIR}/etc/acpi/events/anything
}