Linux – How to force a Thinkpad to draw charge from internal vs external battery

batterylaptoplinuxoptimizationthinkpad

My T450s Thinkpad has two built-in batteries–one hot-swappable and one inside the laptop. Lenovo calls the former "external" and the latter "internal". When not plugged in, the external battery provides charge until it hits a 5% low water mark, at which point the laptop starts using the internal battery.

What I want: (1) to control from Debian Linux which battery the laptop draws power from at any given time while not plugged in, and (2) to set a value of my choice for the low water mark for the automatic switchover to the other battery, as I think 5% is too hard on LiIon cells. The current firmware from Lenovo is no help–I don't see any setting even remotely related to these problems.

Best Answer

To answer you question number 2 you could define TLP battery tresholds, or, if you have kernel 4.17 or newer you can use an interface very similar to that provided by the old tp_smapi module. @davidbaumann's answer would look like:

echo 40 > /sys/class/power_supply/BAT0/charge_start_threshold
echo 70 > /sys/class/power_supply/BAT0/charge_stop_threshold
cat /sys/class/power_supply/BAT0/charge_*_treshold

Note that this would need root permissions.

Related Question