diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-09-18 16:47:55 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-09-18 16:47:55 -0300 |
commit | b4e2708c6f8cc2191c581aef404803478e65e678 (patch) | |
tree | 703d3f7f8f96d9564e7cc3f8ebf85a38c93ab3e1 /limbat | |
parent | 4fdd3ebb2b0622fb6cff7376a02a5b92c1aba2ae (diff) | |
download | scripts-b4e2708c6f8cc2191c581aef404803478e65e678.tar.gz scripts-b4e2708c6f8cc2191c581aef404803478e65e678.tar.bz2 |
Moved scripts to custom repos
Diffstat (limited to 'limbat')
-rwxr-xr-x | limbat | 67 |
1 files changed, 0 insertions, 67 deletions
@@ -1,67 +0,0 @@ -#!/bin/sh -# -# See http://www.thinkwiki.org/wiki/Battery -# http://www.thinkwiki.org/wiki/Tp_smapi -# - -function usage() { - echo "Usage: ${0} [--help | option]" - echo "Options are:" - echo " show show current charge thresholds." - echo " limit start charging at 30% and stop at 85%." - echo " normal start charging at 96% and stop at 100%." - exit ${1} -} - -# validate command line options -if [[ (${#} -eq 1 \ - && "${1}" != "--help" \ - && "${1}" != "normal" \ - && "${1}" != "limit" \ - && ${1} != "show") ]]; then - usage 1 -fi - -# show help -if [ "${1}" == "--help" ]; then - usage 0 -fi - -# get action -action="show" -if [ "${1}" != "" ]; then - action=${1} -fi - -# battery interface location -BAT="/sys/devices/platform/smapi/BAT0" - -function show_thresholds() { - echo -n "Low threshold: " - cat $BAT/start_charge_thresh - echo -n "High threshold: " - cat $BAT/stop_charge_thresh -} - -function set_thresholds() { - START_THRESH=${1} - STOP_THRESH=${2} - sudo sh -c "echo ${START_THRESH} > $BAT/start_charge_thresh" - sudo sh -c "echo ${STOP_THRESH} > $BAT/stop_charge_thresh" -} - -# do your thang -sudo modprobe tp_smapi - -THRESHOLDS="" -if [ "${action}" == "normal" ]; then - THRESHOLDS="96 100" -elif [ "${action}" == "limit" ]; then - THRESHOLDS="30 85" -fi - -if [ ! -z "${THRESHOLDS}" ]; then - set_thresholds ${THRESHOLDS} -fi - -show_thresholds |