summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sping@gentoo.org>2011-06-14 15:31:20 +0000
committerSebastian Pipping <sping@gentoo.org>2011-06-14 15:31:20 +0000
commit7043b0764780eaabf7a690161e4c872eb1f41256 (patch)
tree7b0a75174d644440d4bb325bfccfb8213f0d2c95 /app-laptop
parentVersion bump. Respect CC (diff)
downloadgentoo-2-7043b0764780eaabf7a690161e4c872eb1f41256.tar.gz
gentoo-2-7043b0764780eaabf7a690161e4c872eb1f41256.tar.bz2
gentoo-2-7043b0764780eaabf7a690161e4c872eb1f41256.zip
Add init script (bug #346785)
(Portage version: 2.1.10.2/cvs/Linux x86_64)
Diffstat (limited to 'app-laptop')
-rw-r--r--app-laptop/tp_smapi/ChangeLog8
-rw-r--r--app-laptop/tp_smapi/files/tp_smapi-0.40-confd20
-rwxr-xr-xapp-laptop/tp_smapi/files/tp_smapi-0.40-initd78
-rw-r--r--app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild65
4 files changed, 170 insertions, 1 deletions
diff --git a/app-laptop/tp_smapi/ChangeLog b/app-laptop/tp_smapi/ChangeLog
index 58f5872d66a9..96b7147f7649 100644
--- a/app-laptop/tp_smapi/ChangeLog
+++ b/app-laptop/tp_smapi/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-laptop/tp_smapi
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-laptop/tp_smapi/ChangeLog,v 1.38 2011/05/20 11:20:42 tomka Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/tp_smapi/ChangeLog,v 1.39 2011/06/14 15:31:20 sping Exp $
+
+*tp_smapi-0.40-r2 (14 Jun 2011)
+
+ 14 Jun 2011; Sebastian Pipping <sping@gentoo.org> +tp_smapi-0.40-r2.ebuild,
+ +files/tp_smapi-0.40-confd, +files/tp_smapi-0.40-initd:
+ Add init script, main work by Henning Schild (bug #346785)
20 May 2011; Thomas Kahle <tomka@gentoo.org> tp_smapi-0.40-r1.ebuild:
x86 stable per bug 365559
diff --git a/app-laptop/tp_smapi/files/tp_smapi-0.40-confd b/app-laptop/tp_smapi/files/tp_smapi-0.40-confd
new file mode 100644
index 000000000000..7c80f35e390b
--- /dev/null
+++ b/app-laptop/tp_smapi/files/tp_smapi-0.40-confd
@@ -0,0 +1,20 @@
+# /etc/conf.d/smapi: config file for /etc/init.d/smapi
+
+# use '/etc/init.d/smapi info' at any time to check the thresholds
+# currently used by the driver
+# Note that the kernel does some sanity checking on the values and
+# will not accept any combination of values you may try to set up.
+# (i.e. stop value lower than start) So if the output of info does
+# not match what you wanted the driver probably did not like your
+# configuration.
+
+# default thresholds for '/etc/init.d/smapi start'
+SMAPI_THRESH_START="30"
+SMAPI_THRESH_STOP="85"
+# values to be used for '/etc/init.d/smapi low'
+SMAPI_LOW_THRESH_START="${SMAPI_THRESH_START}"
+SMAPI_LOW_THRESH_STOP="${SMAPI_THRESH_STOP}"
+
+# values to be used for '/etc/init.d/smapi high'
+SMAPI_HIGH_THRESH_START="95"
+SMAPI_HIGH_THRESH_STOP="100"
diff --git a/app-laptop/tp_smapi/files/tp_smapi-0.40-initd b/app-laptop/tp_smapi/files/tp_smapi-0.40-initd
new file mode 100755
index 000000000000..417e7021bec9
--- /dev/null
+++ b/app-laptop/tp_smapi/files/tp_smapi-0.40-initd
@@ -0,0 +1,78 @@
+#!/sbin/runscript
+# Copyright (C) 2011 Henning Schild <henning@wh9.tu-dresden.de>
+# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
+#
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+opts="low high info"
+
+SMAPI_SYSFS="/sys/devices/platform/smapi"
+BATS="BAT0 BAT1"
+
+depend() {
+ after modules
+}
+
+start() {
+ ebegin "Making sure that module 'tp_smapi' is loaded"
+ modprobe tp_smapi
+ eend $? || return $?
+
+ ebegin "Checking for ${SMAPI_SYSFS}"
+ test -d ${SMAPI_SYSFS}
+ eend $? || return $?
+
+ ebegin "Starting ${SVCNAME}"
+ set_all ${SMAPI_THRESH_START} ${SMAPI_THRESH_STOP}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ eend $?
+}
+
+require_started() {
+ service_started && return 0
+
+ ewarn "WARNING: ${SVCNAME} is not running"
+ return 1
+}
+
+high() {
+ require_started || return $?
+
+ ebegin "Switching ${SVCNAME} to high thesholds"
+ set_all ${SMAPI_HIGH_THRESH_START} ${SMAPI_HIGH_THRESH_STOP}
+ eend $?
+}
+
+low() {
+ require_started || return $?
+
+ ebegin "Switching ${SVCNAME} to low thesholds"
+ set_all ${SMAPI_LOW_THRESH_START} ${SMAPI_LOW_THRESH_STOP}
+ eend $?
+}
+
+set_all() {
+ local tstart=$1
+ local tstop=$2
+ for bat in ${BATS}; do
+ ebegin " setting thresholds for ${bat}: $tstart $tstop"
+ echo $tstart > ${SMAPI_SYSFS}/${bat}/start_charge_thresh && \
+ echo $tstop > ${SMAPI_SYSFS}/${bat}/stop_charge_thresh
+ eend $?
+ done
+}
+
+info() {
+ require_started || return $?
+
+ for bat in ${BATS}; do
+ local tstart=$( cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh)
+ local tstop=$( cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh)
+ local presence=$( [[ $(cat ${SMAPI_SYSFS}/${bat}/installed) = 1 ]] && echo ' [installed]')
+ einfo "${bat}: ${tstart} ${tstop}${presence}"
+ done
+}
diff --git a/app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild b/app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild
new file mode 100644
index 000000000000..6466899e99a2
--- /dev/null
+++ b/app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild,v 1.1 2011/06/14 15:31:20 sping Exp $
+
+EAPI="3"
+
+inherit eutils linux-mod
+
+DESCRIPTION="IBM ThinkPad SMAPI BIOS driver"
+HOMEPAGE="http://tpctl.sourceforge.net/"
+SRC_URI="mirror://sourceforge/tpctl/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="hdaps"
+
+RESTRICT="userpriv"
+
+# We need dmideode if the kernel does not support DMI_DEV_TYPE_OEM_STRING
+# in dmi.h
+DEPEND="sys-apps/dmidecode"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ if kernel_is lt 2 6 19; then
+ eerror
+ eerror "${P} requires Linux kernel 2.6.19 or above."
+ eerror
+ die "Unsupported kernel version"
+ fi
+
+ MODULE_NAMES="thinkpad_ec(extra:) tp_smapi(extra:)"
+ BUILD_PARAMS="KSRC=${KV_DIR} KBUILD=${KV_OUT_DIR}"
+ BUILD_TARGETS="default"
+
+ if use hdaps; then
+
+ CONFIG_CHECK="~INPUT_UINPUT"
+ WARNING_INPUT_UINPUT="Your kernel needs uinput for the hdaps module to perform better"
+ linux-info_pkg_setup
+
+ MODULE_NAMES="${MODULE_NAMES} hdaps(extra:)"
+ BUILD_PARAMS="${BUILD_PARAMS} HDAPS=1"
+
+ CONFIG_CHECK="!SENSORS_HDAPS"
+ ERROR_SENSORS_HDAPS="${P} with USE=hdaps conflicts with in-kernel HDAPS (CONFIG_SENSORS_HDAPS)"
+ linux-info_pkg_setup
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-2.6.37.patch"
+ epatch "${FILESDIR}"/fix_header_check.patch
+}
+
+src_install() {
+ linux-mod_src_install
+ dodoc CHANGES README || die
+ newinitd "${FILESDIR}"/${P}-initd smapi || die
+ newconfd "${FILESDIR}"/${P}-confd smapi || die
+}