diff options
-rw-r--r-- | app-laptop/tp_smapi/Manifest | 4 | ||||
-rw-r--r-- | app-laptop/tp_smapi/files/tp_smapi-0.40-confd | 20 | ||||
-rwxr-xr-x | app-laptop/tp_smapi/files/tp_smapi-0.40-initd | 92 | ||||
-rw-r--r-- | app-laptop/tp_smapi/tp_smapi-0.40-r3.ebuild (renamed from app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild) | 19 |
4 files changed, 128 insertions, 7 deletions
diff --git a/app-laptop/tp_smapi/Manifest b/app-laptop/tp_smapi/Manifest index 340bc26..c995e28 100644 --- a/app-laptop/tp_smapi/Manifest +++ b/app-laptop/tp_smapi/Manifest @@ -1,7 +1,9 @@ AUX 0.40-add-x120e-and-t520-to-whitelist.patch 523 RMD160 248746f18ff43ebb199be9c43ae88d6260518cb1 SHA1 1622a683b14e02f2d2c1e5da263ff56e1fe0436a SHA256 304be734d3b14faa9bb80720454e158959554539c09908f89c81ae7dc5f06308 AUX fix_header_check.patch 701 RMD160 c1a79ee4d8501831b3f7522848f979993be5eb8d SHA1 17941fc5583c4740618627d4c1c925e6217dcedd SHA256 5cfc979ac6f9f3f1fb94625b3bf3a31fc6132d3ad8670d38cff2b2116400015c AUX tp_smapi-0.40-2.6.37.patch 1181 RMD160 602ba1598ee7175abfda516fe61ab96b80e2691e SHA1 ed3fbf2e06def4572e8dd2b9ee16e6aac8f500ed SHA256 b36523686dd1710ee8dae2b9ba6598572afe0d564c2278a7105a0fa27fe3d4d5 +AUX tp_smapi-0.40-confd 785 RMD160 55d174b025625dd51e128baaaad2271fbddc3cab SHA1 a2a6d5198230da99dfbd3f451406ec9989b3ae49 SHA256 3996b08957adea6f14e5a0e394212026dc73e6802a8dcd5aa9a3b413530c3fdb +AUX tp_smapi-0.40-initd 1832 RMD160 154ac41defcd04f2edbc83d5ab71c4048f02835d SHA1 4ffd64701c8158b945b45ef46986876bc073d7c2 SHA256 a6f5096f52d2d9fdaa0e2be9a3b796f101ba109fa53816b7c515a400110de1af DIST tp_smapi-0.40.tgz 39002 RMD160 8b564396afe6255476e73c9c78bd47294eeb8d53 SHA1 bc1bd1c6558d1972501e816308234d48ac530fc6 SHA256 ccb0965684cad076160750f2ac380f99373fa73f0bcc1091ffce2492f56349ab -EBUILD tp_smapi-0.40-r2.ebuild 1566 RMD160 43bfabf20c6cd68efc65a9a8d05cd627e502c330 SHA1 e5aea170c7a72641d3c1e3240627e4edc03cc1da SHA256 d8692ab3654567fdf0d8beaac9ca411fd8d082c5f35e6c970fdf1e4cd28ff363 +EBUILD tp_smapi-0.40-r3.ebuild 1717 RMD160 284ce8d882f7f1f83d9bb249c24348b11598411b SHA1 ffc5f3b683597d90597fa3370666dd3bf1747a68 SHA256 b93eba4b707e8bec3f39208d141dc1263b859deb61c26d6e080d84f6160b51fe MISC ChangeLog 4793 RMD160 6dd3e2c030353a0825bddf8a05df82b8694a8287 SHA1 be3cc29fb45bbccc310200b87d5eaeca665b201f SHA256 e0f40126b37889170c857e209219814804c37e00660614ae888c8582ff852272 MISC metadata.xml 242 RMD160 ae266e9b31780c5bf3de48ff64cb377c484be043 SHA1 1e42ee4142d75d4d5a98ebe944b225178ec57680 SHA256 c4b5ad1432ce813ea0f307e9ff1c1bad05cc4aed39c0344be243259400a45372 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 0000000..7c80f35 --- /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 0000000..4edb051 --- /dev/null +++ b/app-laptop/tp_smapi/files/tp_smapi-0.40-initd @@ -0,0 +1,92 @@ +#!/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() { + local state1 + local state2 + + ebegin "Making sure that module 'tp_smapi' is loaded" + modprobe tp_smapi + state1=$? + eend ${state1} + + ebegin "Checking for \"${SMAPI_SYSFS}\"" + test -d "${SMAPI_SYSFS}" + state2=$? + eend ${state2} + + if [ "${state1}" -ne "0" ] || [ "${state2}" -ne "0" ]; then + return 1 + fi + + ebegin "Starting ${SVCNAME}" + set_all ${SMAPI_THRESH_START} ${SMAPI_THRESH_STOP} + eend $? +} + +stop() { + einfo "Nothing required to be done to stop ${SVCNAME}" +} + +require_started() { + if ! service_started; then + "${RC_SERVICE}" start || return $? + fi +} + +high() { + require_started + + einfo "Switching ${SVCNAME} to high thesholds" + set_all ${SMAPI_HIGH_THRESH_START} ${SMAPI_HIGH_THRESH_STOP} +} + +low() { + require_started + + einfo "Switching ${SVCNAME} to low thesholds" + set_all ${SMAPI_LOW_THRESH_START} ${SMAPI_LOW_THRESH_STOP} +} + +set_all() { + local tstart=$1 + local tstop=$2 + local bat + + 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() { + local presence + local tstart + local tstop + local bat + + require_started + + for bat in ${BATS}; do + tstart=$(cat ${SMAPI_SYSFS}/${bat}/start_charge_thresh) + tstop=$(cat ${SMAPI_SYSFS}/${bat}/stop_charge_thresh) + if [ "$(cat ${SMAPI_SYSFS}/${bat}/installed)" -eq "1" ]; then + presence=" [installed]" + fi + 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-r3.ebuild index 226f2c2..3bbd8d6 100644 --- a/app-laptop/tp_smapi/tp_smapi-0.40-r2.ebuild +++ b/app-laptop/tp_smapi/tp_smapi-0.40-r3.ebuild @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-laptop/tp_smapi/tp_smapi-0.40-r1.ebuild,v 1.4 2011/05/20 11:20:42 tomka Exp $ -EAPI="3" +EAPI=4 inherit eutils linux-mod @@ -23,7 +23,7 @@ RESTRICT="userpriv" DEPEND="sys-apps/dmidecode" RDEPEND="${DEPEND}" -pkg_setup() { +pkg_pretend() { linux-mod_pkg_setup if kernel_is lt 2 6 19; then @@ -38,7 +38,6 @@ pkg_setup() { 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 @@ -52,13 +51,21 @@ pkg_setup() { fi } +pkg_setup() { + # run again as pkg_pretend is not var safe + pkg_pretend +} + src_prepare() { - epatch "${FILESDIR}/${P}-2.6.37.patch" - epatch "${FILESDIR}"/fix_header_check.patch - epatch "${FILESDIR}"/0.40-add-x120e-and-t520-to-whitelist.patch + epatch \ + "${FILESDIR}/${P}-2.6.37.patch" \ + "${FILESDIR}"/fix_header_check.patch \ + "${FILESDIR}"/0.40-add-x120e-and-t520-to-whitelist.patch } src_install() { linux-mod_src_install dodoc CHANGES README + newinitd "${FILESDIR}"/${P}-initd smapi + newconfd "${FILESDIR}"/${P}-confd smapi } |