Wednesday, 19 February 2020

Battery conservation mode on Lenovo Yoga S940

Lenovo Yoga S940 has battery conservation mode which limits charging at 60%. It is also possible to use it in Linux. I found following thread with the commands to change the threshold and wrote a script which makes control of the battery threshold in Linux more convenient
#!/bin/bash
# script is based on answers at https://askubuntu.com/questions/1038471/problem-with-lenovo-battery-threshold
# and relies on the module ideapad-laptop
# arguments are status, on and off are self-explanatory
if [ "$1" == "status" ]
then
cat /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
elif [ "$1" == "on" ]
then
sudo echo 1 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
elif [ "$1" == "off" ]
then
sudo echo 0 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
fi

No comments: