From: Silvio Rhatto Date: Mon, 12 May 2014 20:52:03 +0000 (-0300) Subject: Improving limbat X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=e068c9d22eb6442dc3d41872ff4bc6d153fbf8b8;p=scripts.git Improving limbat --- diff --git a/limbat b/limbat index 5541d05..c3489f7 100755 --- a/limbat +++ b/limbat @@ -1,4 +1,8 @@ #!/bin/sh +# +# See http://www.thinkwiki.org/wiki/Battery +# http://www.thinkwiki.org/wiki/Tp_smapi +# function usage() { echo "Usage: ${0} [--help | option]" @@ -29,18 +33,21 @@ if [ "${1}" != "" ]; then action=${1} fi +# battery interface location +BAT="/sys/devices/platform/smapi/BAT0" + function show_thresholds() { echo -n "Low threshold: " - cat /sys/devices/platform/smapi/BAT0/start_charge_thresh + cat $BAT/start_charge_thresh echo -n "High threshold: " - cat /sys/devices/platform/smapi/BAT0/stop_charge_thresh + cat $BAT/stop_charge_thresh } function set_thresholds() { START_THRESH=${1} STOP_THRESH=${2} - sudo sh -c "echo ${START_THRESH} > /sys/devices/platform/smapi/BAT0/start_charge_thresh" - sudo sh -c "echo ${STOP_THRESH} > /sys/devices/platform/smapi/BAT0/stop_charge_thresh" + sudo sh -c "echo ${START_THRESH} > $BAT/start_charge_thresh" + sudo sh -c "echo ${STOP_THRESH} > $BAT/stop_charge_thresh" } # do your thang