mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-24 01:09:38 +01:00
sys-power/acpid: added our own acpid so I could influence the processor on AC vs on BATT
this action should completely replace cpufreqd and waste less CPU
This commit is contained in:
parent
44bcd1f766
commit
e4ff37c83b
9 changed files with 278 additions and 0 deletions
9
sys-power/acpid/Manifest
Normal file
9
sys-power/acpid/Manifest
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
AUX acpid-1.0.4-default 663 RMD160 5e40661ec9112c3cc675a0d283e96311d2d159f1 SHA1 e74b2f7388c303fc3d3e33c0500d4b8185474dce SHA256 2b18111978043d68848983a54dfc946dd9b9b15592d0f4dc33491599dbe24b23
|
||||
AUX acpid-1.0.6-conf.d 156 RMD160 a7c8822a88b51f185c8740b075c968d0c045791d SHA1 497f35e98f1f499d2223c52f4491218b3def489a SHA256 5dfc6dbf687a47e853b0a9f9ed491cb1778b0d99195df5e7a5de849d269ca28c
|
||||
AUX acpid-1.0.6-default.sh 1214 RMD160 1d656cee490664931062cb6a8f6ee968b48f28d1 SHA1 52b7a36da5915dfb72636cf554d5b0aa99779ecc SHA256 9d95f204b39129758de47bd0b003ff47501759db98a8641034e1203130ea1f52
|
||||
AUX acpid-2.0.3-init.d 668 RMD160 66d460850e02e8e817c3dbabef120a0d0e53758f SHA1 f4fc04c345215eb4c1ec971d284cb18a9405a0e8 SHA256 70d0ffc4cc11046e4445619784e187c009a97273b9826e7f62a0b7c92aa330d0
|
||||
AUX acpid-2.0.3.patch 881 RMD160 81a32d23d72e3104d67c37863f14aa88fe8b5b39 SHA1 ea9c629cbfed5f2e3e34c4d242fcff2b69fda51d SHA256 d313d9645e705221ef9f4610a0b127ee38240125d5e2f39554537bde38a7a813
|
||||
AUX acpid-pentoo-1.0.6-default.sh 1401 RMD160 2f6af4a0ad19dabebafee52ee793ce8c0a7a471b SHA1 50e3d9ccc85e24829e29a32deb6caf458534f6bd SHA256 d9e9f6d3b309f995d986d611149e1a5d252cbde33d62732bf6e5ac713fe9d3ab
|
||||
DIST acpid-2.0.6.tar.gz 74689 RMD160 d22a43998c795a8a2058cd53a06f6d336fc6220e SHA1 d2f5fdb80c6cee8b49250435d66828a4610b0846 SHA256 89db450ab9c740f24fb8324f75efebf38096afa0f4c5cabc4072441659059a33
|
||||
EBUILD acpid-2.0.6.ebuild 1396 RMD160 7ebb98d9da4219ee8547e18039f6a71049701e33 SHA1 c223e0208fb1f513e694f6c2d544427411ee32a8 SHA256 54175c529bdaf7243258b7b05969bd8d0c2f748e5418b8e4eefe5e78cb4ef7ea
|
||||
MISC metadata.xml 161 RMD160 a5e1f234c4886ff31d39f229a0cf30d0bfcea869 SHA1 3876fd42cd9e63a7edb04c5025d53d773aa80bc3 SHA256 838bd208a7f948ea9b4e2b8869464622bc64a2f02468de4c3d7f6c2530e28e89
|
||||
55
sys-power/acpid/acpid-2.0.6.ebuild
Normal file
55
sys-power/acpid/acpid-2.0.6.ebuild
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/acpid-2.0.6.ebuild,v 1.4 2010/10/05 19:34:14 maekke Exp $
|
||||
|
||||
EAPI=2
|
||||
inherit eutils toolchain-funcs
|
||||
|
||||
DESCRIPTION="Daemon for Advanced Configuration and Power Interface"
|
||||
HOMEPAGE="http://tedfelix.com/linux/acpid-netlink.html"
|
||||
SRC_URI="http://tedfelix.com/linux/${P}.tar.gz"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~ia64 -ppc x86"
|
||||
IUSE="pentoo"
|
||||
|
||||
src_prepare() {
|
||||
epatch "${FILESDIR}"/${PN}-2.0.3.patch
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
tc-export CC CPP
|
||||
emake || die
|
||||
emake -C kacpimon || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install || die
|
||||
|
||||
dobin kacpimon/kacpimon || die
|
||||
newdoc kacpimon/README README.kacpimon
|
||||
|
||||
exeinto /etc/acpi
|
||||
if use pentoo; then
|
||||
newexe "${FILESDIR}"/${PN}-pentoo-1.0.6-default.sh default.sh || die
|
||||
else
|
||||
newexe "${FILESDIR}"/${PN}-1.0.6-default.sh default.sh || die
|
||||
fi
|
||||
|
||||
insinto /etc/acpi/events
|
||||
newins "${FILESDIR}"/${PN}-1.0.4-default default || die
|
||||
|
||||
newinitd "${FILESDIR}"/${PN}-2.0.3-init.d acpid || die
|
||||
newconfd "${FILESDIR}"/${PN}-1.0.6-conf.d acpid || die
|
||||
|
||||
prepalldocs
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog
|
||||
elog "You may wish to read the Gentoo Linux Power Management Guide,"
|
||||
elog "which can be found online at:"
|
||||
elog "http://www.gentoo.org/doc/en/power-management-guide.xml"
|
||||
elog
|
||||
}
|
||||
19
sys-power/acpid/files/acpid-1.0.4-default
Normal file
19
sys-power/acpid/files/acpid-1.0.4-default
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# /etc/acpi/events/default
|
||||
# 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
|
||||
# In case of the power event above, your entry may look this way:
|
||||
#event=button[ /]power.*
|
||||
#action=/sbin/init 0
|
||||
|
||||
# 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/default.sh %e
|
||||
6
sys-power/acpid/files/acpid-1.0.6-conf.d
Normal file
6
sys-power/acpid/files/acpid-1.0.6-conf.d
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# /etc/conf.d/acpid: config file for /etc/init.d/acpid
|
||||
|
||||
# Options to pass to the acpid daemon.
|
||||
# See the acpid(8) man page for more info.
|
||||
|
||||
ACPID_OPTIONS=""
|
||||
59
sys-power/acpid/files/acpid-1.0.6-default.sh
Executable file
59
sys-power/acpid/files/acpid-1.0.6-default.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/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
|
||||
30
sys-power/acpid/files/acpid-2.0.3-init.d
Normal file
30
sys-power/acpid/files/acpid-2.0.3-init.d
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/sbin/runscript
|
||||
# Copyright 1999-2010 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/files/acpid-2.0.3-init.d,v 1.1 2010/04/04 16:39:09 ssuominen Exp $
|
||||
|
||||
opts="reload"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
use logger
|
||||
before hald
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting acpid"
|
||||
start-stop-daemon --start --quiet --exec /usr/sbin/acpid -- ${ACPID_OPTIONS}
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping acpid"
|
||||
start-stop-daemon --stop --exec /usr/sbin/acpid
|
||||
eend $?
|
||||
}
|
||||
|
||||
reload() {
|
||||
ebegin "Reloading acpid configuration"
|
||||
start-stop-daemon --stop --oknodo --exec /usr/sbin/acpid --signal HUP
|
||||
eend $?
|
||||
}
|
||||
36
sys-power/acpid/files/acpid-2.0.3.patch
Normal file
36
sys-power/acpid/files/acpid-2.0.3.patch
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
--- kacpimon/makefile
|
||||
+++ kacpimon/makefile
|
||||
@@ -8,7 +8,7 @@
|
||||
# release build
|
||||
#CFLAGS = -O2 -Wall -Wextra -Wundef -Wshadow -Werror
|
||||
# hybrid build, optimized, but with debugging symbols (Debian-style)
|
||||
-CFLAGS = -g -O2 -Wall -Wextra -Wundef -Wshadow -Werror
|
||||
+CFLAGS += -Wall -Wextra -Wundef -Wshadow
|
||||
|
||||
objects := $(sources:.c=.o)
|
||||
|
||||
--- Makefile
|
||||
+++ Makefile
|
||||
@@ -3,8 +3,6 @@
|
||||
# update these numbers for new releases
|
||||
VERSION = 2.0.3
|
||||
|
||||
-OPT = -O2
|
||||
-
|
||||
DESTDIR =
|
||||
PREFIX = /usr
|
||||
|
||||
@@ -29,10 +27,10 @@
|
||||
MAN8 = acpid.8 acpi_listen.8
|
||||
MAN8GZ = $(MAN8:.8=.8.gz)
|
||||
|
||||
-DOCS = COPYING Changelog README TESTPLAN TODO
|
||||
+DOCS = Changelog README TESTPLAN TODO
|
||||
|
||||
-CFLAGS = -W -Wall -Werror -Wundef -Wshadow -D_GNU_SOURCE $(OPT) \
|
||||
- -fno-strict-aliasing -g $(DEFS)
|
||||
+CFLAGS += -W -Wall -Wundef -Wshadow -D_GNU_SOURCE \
|
||||
+ -fno-strict-aliasing $(DEFS)
|
||||
DEFS = -DVERSION="\"$(VERSION)\""
|
||||
|
||||
all: $(PROGS)
|
||||
59
sys-power/acpid/files/acpid-pentoo-1.0.6-default.sh
Executable file
59
sys-power/acpid/files/acpid-pentoo-1.0.6-default.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/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)
|
||||
for CPU in `ls /sys/devices/system/cpu/|grep -E "cpu[0-9]+"|cut -d"u" -f2`; do cpufreq-set -r -c $CPU -g ondemand; done
|
||||
;;
|
||||
|
||||
# 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)
|
||||
for CPU in `ls /sys/devices/system/cpu/|grep -E "cpu[0-9]+"|cut -d"u" -f2`; do cpufreq-set -r -c $CPU -g performance; done
|
||||
;;
|
||||
|
||||
*) log_unhandled $* ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*) log_unhandled $* ;;
|
||||
esac
|
||||
5
sys-power/acpid/metadata.xml
Normal file
5
sys-power/acpid/metadata.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<herd>mobile</herd>
|
||||
</pkgmetadata>
|
||||
Loading…
Reference in a new issue