summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2003-08-21 02:31:55 +0000
committerMike Frysinger <vapier@gentoo.org>2003-08-21 02:31:55 +0000
commit21a3180fa8ba04beaa3603e7867514ae2ce76a26 (patch)
treeffa82e5d07c41117904b20514e11d7fd1e628a15 /sys-apps/speedfreq
parentversion bump (diff)
downloadgentoo-2-21a3180fa8ba04beaa3603e7867514ae2ce76a26.tar.gz
gentoo-2-21a3180fa8ba04beaa3603e7867514ae2ce76a26.tar.bz2
gentoo-2-21a3180fa8ba04beaa3603e7867514ae2ce76a26.zip
initial ebuild #26973
Diffstat (limited to 'sys-apps/speedfreq')
-rw-r--r--sys-apps/speedfreq/ChangeLog8
-rw-r--r--sys-apps/speedfreq/files/battery.sh27
-rw-r--r--sys-apps/speedfreq/files/digest-speedfreq-0.51
-rw-r--r--sys-apps/speedfreq/files/speedfreq.conf19
-rw-r--r--sys-apps/speedfreq/files/speedfreq.rc40
-rw-r--r--sys-apps/speedfreq/speedfreq-0.5.ebuild66
6 files changed, 161 insertions, 0 deletions
diff --git a/sys-apps/speedfreq/ChangeLog b/sys-apps/speedfreq/ChangeLog
new file mode 100644
index 000000000000..a4b6518a9e8a
--- /dev/null
+++ b/sys-apps/speedfreq/ChangeLog
@@ -0,0 +1,8 @@
+# ChangeLog for sys-apps/speedfreq
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/speedfreq/ChangeLog,v 1.1 2003/08/21 02:31:55 vapier Exp $
+
+*speedfreq-0.5 (20 Aug 2003)
+
+ 20 Aug 2003; Christian Axelsson <smiler@lanil.mine.nu> speedfreq-0.5.ebuild :
+ Initial release. #26973
diff --git a/sys-apps/speedfreq/files/battery.sh b/sys-apps/speedfreq/files/battery.sh
new file mode 100644
index 000000000000..b78c15def9c3
--- /dev/null
+++ b/sys-apps/speedfreq/files/battery.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Battery acpi script that set different speedfreq modes depending on AC adapter
+# Can only handle one battery at the time, will add support for more when I get time
+#
+# To use this script add the following lines to /etc/acpi/events/default
+# event=battery.*
+# action=/etc/acpi/battery.sh %e
+
+set $*
+source /etc/conf.d/speedfreq
+[ "${SPEEDFREQ_SPEED}" == "auto" ] && exit 0
+
+case "$2" in
+ BAT1)
+ if [ $4 -eq 00000001 ] && [ -f /proc/acpi/battery/BAT1/state ] ; then
+ action="`cat /proc/acpi/battery/BAT1/state | grep charging | cut -c 26-`"
+ case $action in
+ charging) /usr/bin/speedfreq -p performance
+ logger "A/C adapter plugged in"
+ ;;
+ discharging) /usr/bin/speedfreq -p powersave
+ logger "A/C adapter plugged out"
+ ;;
+ esac
+ fi
+ ;;
+esac
diff --git a/sys-apps/speedfreq/files/digest-speedfreq-0.5 b/sys-apps/speedfreq/files/digest-speedfreq-0.5
new file mode 100644
index 000000000000..36b9ba324f40
--- /dev/null
+++ b/sys-apps/speedfreq/files/digest-speedfreq-0.5
@@ -0,0 +1 @@
+MD5 d014030819b2d54e068ba44ccb124080 speedfreq-0.5.tar.gz 14178
diff --git a/sys-apps/speedfreq/files/speedfreq.conf b/sys-apps/speedfreq/files/speedfreq.conf
new file mode 100644
index 000000000000..cd71383da316
--- /dev/null
+++ b/sys-apps/speedfreq/files/speedfreq.conf
@@ -0,0 +1,19 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/speedfreq/files/speedfreq.conf,v 1.1 2003/08/21 02:31:55 vapier Exp $
+
+# Select here if you want dynamic or static speed
+# If you select static you should use the battery.sh script
+# provided with this ebuild to control speed depending on A/C status
+# acceptable values:
+# powersave maximise power savings
+# performance maximise performance
+# dynamic adjust speed according to CPU load (default)
+# NNN set CPU to a fixed speed of NNN MHz
+# auto let the init script detect current battery status
+SPEEDFREQ_SPEED="auto"
+
+# If you want normal users to be able to control the speed
+# Default is to only allow root
+#SPEEDFREQ_USERS="yes"
+SPEEDFREQ_USERS="no"
diff --git a/sys-apps/speedfreq/files/speedfreq.rc b/sys-apps/speedfreq/files/speedfreq.rc
new file mode 100644
index 000000000000..15b241ec8ffa
--- /dev/null
+++ b/sys-apps/speedfreq/files/speedfreq.rc
@@ -0,0 +1,40 @@
+#!/sbin/runscript
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/speedfreq/files/speedfreq.rc,v 1.1 2003/08/21 02:31:55 vapier Exp $
+
+depend() {
+ need modules logger
+ use acpid
+}
+
+check_acpi() {
+ [ "${SPEEDFREQ_SPEED}" == "auto" ] || return 0
+ [ ! -f /proc/acpi/battery/BAT1/state ] && return 0
+
+ local status="`echo $(</proc/acpi/battery/BAT1/state) | grep charging | cut -c 26-`"
+ case ${status} in
+ charging) SPEEDFREQ_SPEED=performance;;
+ discharging) SPEEDFREQ_SPEED=powersave;;
+ *) SPEEDFREQ_SPEED=performance;;
+ esac
+}
+
+start() {
+ check_acpi
+
+ ebegin "Starting speedfreq"
+ /usr/sbin/speedfreqd -P -p ${SPEEDFREQ_SPEED}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping speedfreq"
+ if [ -e /var/run/speedfreq.pid ] ; then
+ local pid="$(</var/run/speedfreq.pid)"
+ kill ${pid} >& /dev/null
+ eend $? "Could not kill pid '${pid}'"
+ else
+ eend 1 "Lost pid file :("
+ fi
+}
diff --git a/sys-apps/speedfreq/speedfreq-0.5.ebuild b/sys-apps/speedfreq/speedfreq-0.5.ebuild
new file mode 100644
index 000000000000..8152f0da516b
--- /dev/null
+++ b/sys-apps/speedfreq/speedfreq-0.5.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/speedfreq/speedfreq-0.5.ebuild,v 1.1 2003/08/21 02:31:55 vapier Exp $
+
+DESCRIPTION="daemon to control the CPU speed in 2.6 kernels"
+HOMEPAGE="http://www.goop.org/~jeremy/speedfreq/"
+SRC_URI="http://www.goop.org/~jeremy/speedfreq/${P}.tar.gz"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="acpi"
+
+DEPEND="acpi? ( sys-apps/acpid )"
+
+is_2_6_kernel() {
+ local KV_major="$(echo "${KV}" | cut -d. -f1)"
+ local KV_minor="$(echo "${KV}" | cut -d. -f2)"
+ [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 6 ] \
+ && return 0 \
+ || return 1
+}
+
+pkg_setup() {
+ check_KV
+ if [ ! is_2_6_kernel ] ; then
+ eerror "This only works with 2.6.x kernels"
+ die "Only works with 2.6.x kernels, not ${KV}"
+ fi
+}
+
+src_compile() {
+ emake CFLAGS="${CFLAGS}" || die "compile of speedfreq failed"
+}
+
+src_install() {
+ dosbin speedfreqd
+ dobin speedfreq
+ doman *.[38]
+ dolib.so libspeedfreq.so.1
+ dosym libspeedfreq.so.1 /usr/lib/libspeedfreq.so
+ exeinto /etc/init.d ; newexe ${FILESDIR}/speedfreq.rc speedfreq
+ insinto /etc/conf.d ; newins ${FILESDIR}/speedfreq.conf speedfreq
+ insinto /usr/include
+ doins speedfreq.h
+ dodoc README
+ if [ `use acpi` ] ; then
+ exeinto /etc/acpi
+ doexe ${FILESDIR}/battery.sh
+ fi
+}
+
+pkg_postinst() {
+ if [ `use acpi` ] ; then
+ echo
+ einfo "A sample script for powercontrol has been placed in /etc/acpi/battery.sh"
+ einfo "To use it add the following lines to your /etc/acpi/default/events"
+ einfo " event=battery.*"
+ einfo " action=/etc/acpi/battery.sh %e"
+ einfo "Note that this only supports one battery at the time"
+ echo
+ einfo "Configuration should be done in /etc/conf.d/speedfreq"
+ einfo "Make sure that you have sysfs mounted on /sys"
+ echo
+ fi
+}