From dadc3e98be131ed1a3152ec225f3e7d778b2546b Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 18 May 2011 10:03:14 +0200 Subject: [PATCH] acpid: update to 2.0.10. Use default scripts from Arch. --HG-- rename : srcpkgs/acpid/files/default.sh => srcpkgs/acpid/files/handler.sh --- srcpkgs/acpid/files/anything | 3 ++ srcpkgs/acpid/files/default.sh | 59 ------------------------------ srcpkgs/acpid/files/handler.sh | 65 ++++++++++++++++++++++++++++++++++ srcpkgs/acpid/template | 19 ++++------ 4 files changed, 75 insertions(+), 71 deletions(-) create mode 100644 srcpkgs/acpid/files/anything delete mode 100644 srcpkgs/acpid/files/default.sh create mode 100644 srcpkgs/acpid/files/handler.sh diff --git a/srcpkgs/acpid/files/anything b/srcpkgs/acpid/files/anything new file mode 100644 index 0000000000..d1828989b0 --- /dev/null +++ b/srcpkgs/acpid/files/anything @@ -0,0 +1,3 @@ +# Pass all events to our one handler script +event=.* +action=/etc/acpi/handler.sh %e diff --git a/srcpkgs/acpid/files/default.sh b/srcpkgs/acpid/files/default.sh deleted file mode 100644 index 9fe26a168c..0000000000 --- a/srcpkgs/acpid/files/default.sh +++ /dev/null @@ -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 diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh new file mode 100644 index 0000000000..518a62dea6 --- /dev/null +++ b/srcpkgs/acpid/files/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 diff --git a/srcpkgs/acpid/template b/srcpkgs/acpid/template index 05a0981994..cf7cec5a48 100644 --- a/srcpkgs/acpid/template +++ b/srcpkgs/acpid/template @@ -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 " -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 }