#!/bin/sh
+#
+# See http://www.thinkwiki.org/wiki/Battery
+# http://www.thinkwiki.org/wiki/Tp_smapi
+#
function usage() {
echo "Usage: ${0} [--help | option]"
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