From e068c9d22eb6442dc3d41872ff4bc6d153fbf8b8 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 12 May 2014 17:52:03 -0300 Subject: Improving limbat --- limbat | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 -- cgit v1.2.3