parlay

yet another gentoo overlay
git clone https://git.parazyd.org/parlay
Log | Files | Refs | README

commit bc22766cb82a472b6fce2993c85b9e30e7e98191
parent 13025d676de08597f7f31523bdb274d0b556dbfc
Author: parazyd <parazyd@dyne.org>
Date:   Thu, 21 Jul 2016 13:09:14 +0200

app-laptop/tp_smapi: Add 0.42

Diffstat:
Aapp-laptop/tp_smapi/Manifest | 1+
Aapp-laptop/tp_smapi/files/tp_smapi-0.40-confd | 20++++++++++++++++++++
Aapp-laptop/tp_smapi/files/tp_smapi-0.40-initd | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aapp-laptop/tp_smapi/tp_smapi-0.42.ebuild | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 188 insertions(+), 0 deletions(-)

diff --git a/app-laptop/tp_smapi/Manifest b/app-laptop/tp_smapi/Manifest @@ -0,0 +1 @@ +DIST tp_smapi-0.42.tgz 39867 SHA256 7b8d9f488c3859805f1f292bf4d518cc5b32ebb69b0ebe96367d0852dd792d27 SHA512 1004b7ef961a9908c2144b26ea60b6dddabd83d60c11421a03e3b810f5b635415ef52656d6980915512d68f809f7bc3d662328f25d111537bd7e175d252cf83b WHIRLPOOL 7d03aaf2bb4de3aabbc38fba62f126e6f2976ea1964d85da2fffbbcd63bb4c3884a152851cae116438b859c13d59fd4e41be126683f660f9b8322d7fc40ddc28 diff --git a/app-laptop/tp_smapi/files/tp_smapi-0.40-confd 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 @@ -0,0 +1,92 @@ +#!/sbin/openrc-run +# 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 + +extra_started_commands="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.42.ebuild b/app-laptop/tp_smapi/tp_smapi-0.42.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit flag-o-matic linux-mod + +DESCRIPTION="IBM ThinkPad SMAPI BIOS driver" +HOMEPAGE="https://github.com/evgeni/tp_smapi/ http://tpctl.sourceforge.net/" +SRC_URI="https://github.com/evgeni/${PN}/releases/download/tp-smapi%2F${PV}/${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_pretend() { + 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 +} + +pkg_setup() { + # run again as pkg_pretend is not var safe + pkg_pretend +} + +src_compile() { + # Kernel Makefiles may pull in -mpreferred-stack-boundary=3 + # which requires that SSE disabled or compilation will fail. + # So we need to ensure that appended user CLAGS do not re-enable SSE + # https://bugs.gentoo.org/show_bug.cgi?id=492964 + replace-flags '-msse*' '' + replace-flags '-mssse3' '' + + linux-mod_src_compile +} + +src_install() { + linux-mod_src_install + dodoc CHANGES README + newinitd "${FILESDIR}"/${PN}-0.40-initd smapi + newconfd "${FILESDIR}"/${PN}-0.40-confd smapi +}