User:Hum/charge battery.sh
From Openmoko
< User:Hum
I want my battery to be charged up to 75% (longer life) and start this in a screen. It is only tested with a connection to USB.
charge_battery.sh:
# charge_battery.sh # Copyright by Hum, GPL3 # # 1000mA # 0%- 72% 500mA # 73% no change # 74%- 75% 100mA # 76% no change # 77%-100% 0mA CUR_LIM_PATH=/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/usb_curlim CAPACITY_PATH=/sys/devices/platform/s3c24xx_pwm.0/hdq.0/bq27000-battery.0/power_supply/battery/capacity while true;do CAPACITY=`cat $CAPACITY_PATH` CUR_LIM=`cat $CUR_LIM_PATH` test $CAPACITY -le 72 && echo 500 > $CUR_LIM_PATH # if $CAPACITY -eq 73 && do_nothing # maybe we found our balance test $CAPACITY -eq 74 && echo 100 > $CUR_LIM_PATH test $CAPACITY -eq 75 && echo 100 > $CUR_LIM_PATH # if $CAPACITY -eq 76 && do_nothing # maybe we found our balance test $CAPACITY -ge 77 && echo 0 > $CUR_LIM_PATH sleep 60 done