From 603e6f1ae11fd6134ac6c707590620c1060fbe9e Mon Sep 17 00:00:00 2001 From: James Meyer Date: Fri, 24 Aug 2012 23:15:16 -0500 Subject: acpid: 2.0 no need to patch for run-it --- abs/core/acpid/Makefile | 56 ----------------------- abs/core/acpid/PKGBUILD | 75 ++++++++++++++++++------------ abs/core/acpid/acpid | 37 --------------- abs/core/acpid/acpid-1.0.4-gcc4.patch | 20 -------- abs/core/acpid/acpid.conf | 5 ++ abs/core/acpid/acpid.conf.d | 6 --- abs/core/acpid/acpid.rc | 40 ++++++++++++++++ abs/core/acpid/acpid.service | 11 +++++ abs/core/acpid/acpid.socket | 8 ++++ abs/core/acpid/default | 20 -------- abs/core/acpid/handler.sh | 86 +++++++++++++++++++++++++++++++++++ 11 files changed, 196 insertions(+), 168 deletions(-) delete mode 100644 abs/core/acpid/Makefile delete mode 100644 abs/core/acpid/acpid delete mode 100644 abs/core/acpid/acpid-1.0.4-gcc4.patch create mode 100644 abs/core/acpid/acpid.conf delete mode 100644 abs/core/acpid/acpid.conf.d create mode 100644 abs/core/acpid/acpid.rc create mode 100644 abs/core/acpid/acpid.service create mode 100644 abs/core/acpid/acpid.socket delete mode 100644 abs/core/acpid/default create mode 100644 abs/core/acpid/handler.sh diff --git a/abs/core/acpid/Makefile b/abs/core/acpid/Makefile deleted file mode 100644 index a5fe385..0000000 --- a/abs/core/acpid/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# 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 index 911f04b..a4d931a 100644 --- a/abs/core/acpid/PKGBUILD +++ b/abs/core/acpid/PKGBUILD @@ -1,41 +1,58 @@ -# $Id: PKGBUILD 65397 2010-01-28 19:48:01Z thayer $ -# Maintainer: Thayer Williams +# $Id: PKGBUILD 71877 2012-06-02 17:57:44Z seblu $ +# Maintainer: Sébastien Luttringer +# Contributor: xduugu # Contributor: Manolis Tzanidakis -# Contributor: Judd Vinet +# Contributor: Jonathan Schmidt /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 deleted file mode 100644 index b56901d..0000000 --- a/abs/core/acpid/acpid-1.0.4-gcc4.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- 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/acpid.conf b/abs/core/acpid/acpid.conf new file mode 100644 index 0000000..b60103a --- /dev/null +++ b/abs/core/acpid/acpid.conf @@ -0,0 +1,5 @@ +# +# Arguments to be passed to the acpid daemon +# + +ACPID_ARGS="" diff --git a/abs/core/acpid/acpid.conf.d b/abs/core/acpid/acpid.conf.d deleted file mode 100644 index 25c9cc1..0000000 --- a/abs/core/acpid/acpid.conf.d +++ /dev/null @@ -1,6 +0,0 @@ -# -# Arguments to be passed to the acpid daemon -# - -ACPID_ARGS="" - diff --git a/abs/core/acpid/acpid.rc b/abs/core/acpid/acpid.rc new file mode 100644 index 0000000..674f462 --- /dev/null +++ b/abs/core/acpid/acpid.rc @@ -0,0 +1,40 @@ +#!/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 + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/abs/core/acpid/acpid.service b/abs/core/acpid/acpid.service new file mode 100644 index 0000000..4c0e073 --- /dev/null +++ b/abs/core/acpid/acpid.service @@ -0,0 +1,11 @@ +[Unit] +Description=ACPI event daemon +Requires=acpid.socket + +[Service] +EnvironmentFile=/etc/conf.d/acpid +ExecStart=/usr/sbin/acpid -f $ACPID_ARGS + +[Install] +WantedBy=multi-user.target +Also=acpid.socket diff --git a/abs/core/acpid/acpid.socket b/abs/core/acpid/acpid.socket new file mode 100644 index 0000000..1e5365b --- /dev/null +++ b/abs/core/acpid/acpid.socket @@ -0,0 +1,8 @@ +[Unit] +Description=ACPID Listen Socket + +[Socket] +ListenStream=/run/acpid.socket + +[Install] +WantedBy=sockets.target diff --git a/abs/core/acpid/default b/abs/core/acpid/default deleted file mode 100644 index 93944aa..0000000 --- a/abs/core/acpid/default +++ /dev/null @@ -1,20 +0,0 @@ -# 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 100644 index 0000000..b5a548f --- /dev/null +++ b/abs/core/acpid/handler.sh @@ -0,0 +1,86 @@ +#!/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) + case "$2" in + PBTN|PWRF) + logger "PowerButton pressed: $2" + poweroff + ;; + *) + logger "ACPI action undefined: $2" + ;; + esac + ;; + button/sleep) + case "$2" in + SLPB|SBTN) + 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) + logger 'Battery online' + ;; + 00000001) + logger 'Battery offline' + ;; + esac + ;; + CPU0) + ;; + *) logger "ACPI action undefined: $2" ;; + esac + ;; + button/lid) + case "$3" in + close) + logger 'LID closed' + ;; + open) + logger 'LID opened' + ;; + *) + logger "ACPI action undefined: $3" + ;; + esac + ;; + *) + logger "ACPI group/action undefined: $1 / $2" + ;; +esac + +# vim:set ts=4 sw=4 ft=sh et: -- cgit v0.12