]> gitweb.fluxo.info Git - scripts.git/commitdiff
Improving limbat
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 12 May 2014 20:52:03 +0000 (17:52 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 12 May 2014 20:52:03 +0000 (17:52 -0300)
limbat

diff --git a/limbat b/limbat
index 5541d055a9fff5ad555f8f43ba072b3af1ae2989..c3489f7e892c34e8429efe8314a3ee9329ea5f64 100755 (executable)
--- 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