4

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.

Stan
  • 41
  • 1
  • 3
  • 1
    The laptop can't distinguish between an external battery and an AC adapter. – Ignacio Vazquez-Abrams Mar 19 '18 at 23:44
  • 2
    @Ignacio yes, it can; the question isn’t about an external battery pretending to be an AC adapter to provide power, it concerns the two built-in batteries, one of which is swappable (yes, “external” is misleading). – Stephen Kitt Mar 20 '18 at 02:33
  • Did you consider the chance of it being an hardware feature, and thus not controllable by software? Because it looks like it. – Marco Bonelli Mar 20 '18 at 03:07
  • @StephenKitt edited to reflect the somewhat confusing names Lenovo uses for these batteries. – Stan Mar 20 '18 at 07:51
  • @MarcoBonelli that may well be--but packages with close and similar functionality like [this one](http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html) gave me higher hopes. – Stan Mar 20 '18 at 07:54
  • See also: https://unix.stackexchange.com/questions/131313/how-to-make-sure-that-thinkpad-discharges-external-slice-battery-first – Alex Jun 29 '18 at 15:16
  • Try `tlp` with `acpi_call`. It allows me to solve `(2)` on a newer ThinkPad (T480). I'm still searching for a solution to `(1)` – stewSquared Sep 03 '19 at 15:49

2 Answers2

1

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.

0

There is a module named tp_smapi.

For example, you can change the threshold like this:

echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
cat /sys/devices/platform/smapi/BAT0/*_charge_thresh

The link also contains a script which will allow you to select the battery to discharge firstly.

davidbaumann
  • 356
  • 2
  • 11