3

The thing is that when an external slice battery pack is connected, the laptop first discharges the internal one. This is a problem because then it is impossible to switch between multiple external battery packs without powering off the laptop. It is also not possible to just disconnect the external battery pack when you e.g. need to insert it into a docking station.

Thus, my question: how to change the discharge order under Linux?

For my use cases following order would make much more sense: when an external slice battery is connected, first discharge it completely before using power from the internal battery.

Background: For some Thinkpad models (e.g. X220) there are slice battery packs (example) available that you can connect to the bottom of the laptop (similar to a docking station).

They seem to be supported well on Linux - e.g. the Gnome Shell battery applet includes both batteries (internal and external) when connected - including displaying the current capacity for each.

5

There's (out-of-tree) module called tp_smapi, which provides access to (amongst others) access to the battery-related functions of the embedded controller. This allows you to do things like setting the start/stop charging thresholds, charge-inhibition timeout and also force discharge of a battery. Most distributions have a tp_smapi package, providing the module, otherwise you could still download the sources from Github and build them by hand.

When loading this module, it'll provide you with a sysfs interface under /sys/devices/platform/smapi/, one directory for every (possible) battery called BATn (where n would be 0 or 1 in your case) and some files you could write to. The file that could be the solution to your problem is called force_discharge. By writing 1 to it, you'll tell the embedded controller to forcibly discharge the according battery (this even works on AC, which allows you to »recalibrate« the battery as is possible with the Thinkpad Windows-Tools) — 0 disables forced discharge, accordingly.

I'm a bit puzzled that your internal battery is used first, though. I had a X61s with the additional battery-pack and AFAIR it used the external one first (which is… intelligent, since at least the X61s e.g. didn't use the external battery for suspend-to-RAM for obvious reasons, where it would be bad to have the internal battery discharged to zero). Hrm.

  • I am puzzled, too - especially after I've read some lenovo forum posts that also report that the default is: external first - I'll have to keep an eye on it, if I can reproduce it and if the sysfs interface of the mentioned module gives some insight. I'll also check if there are firmware updates available, since it could also be a firmware issue. – maxschlepzig May 21 '14 at 16:52
  • 2
    An important notes for fellow Thinkpad users, Thinkwiki states that 'If you are installing on a recent Thinkpad that has an Ivy Bridge processor (X230, T430, T530, etc.), tp_smapi will not work.' X220 is Sandy Bridge based, though. – maxschlepzig May 21 '14 at 17:05
  • I did leave this out since you mentioned your exact model (I actually have an X230). – Andreas Wiese May 21 '14 at 18:12
  • @maxschlepzig your link need a little fix – navigaid Aug 5 '17 at 6:16
  • @navigaid thinkwiki.org/wiki/Tp_smapi - one can't edit old comments – maxschlepzig Aug 5 '17 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.