Friday, January 19, 2018

Change the thresholds of battery charging

In Ubuntu, it is possible to control when to start and stop battery charging based on capacity levels.

sudo apt-get install tp-smapi-dkms
sudo modprobe tp_smapi

if [ -e /sys/devices/platform/smapi ]
then
    cd /sys/devices/platform/smapi/
    for i in BAT?
    do
        cd $i
        echo 40 | sudo tee start_charge_thresh
        echo 80 | sudo tee stop_charge_thresh
        cd ..
    done
fi

No comments: