How to make sure that Thinkpad discharges external slice battery first?

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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x