protect battery on thinkpad T490 - Ubuntu 18.04
After a discussion with the package author and maintainer (many thanks to him for his patience with my n00bness), the solution was to update to the PPA version 1.2.2 (I guess newer may work as well):
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tp-smapi-dkms acpi-call-dkms tlp
After that things start to work:
~$ sudo tlp-stat
--- TLP 1.2.2 --------------------------------------------
...
+++ Battery Features: Charge Thresholds and Recalibrate
natacpi = active (data, thresholds)
tpacpi-bat = inactive (kernel module 'acpi_call' load error)
tp-smapi = inactive (ThinkPad not supported)
...
and the battery levels can be updated:
~$ sudo tlp setcharge 70 80
Setting temporary charge thresholds for BAT0:
start = 70 (no change)
stop = 80 (no change)
leading to:
~$ sudo tlp-stat
...
/sys/class/power_supply/BAT0/charge_start_threshold = 70 [%]
/sys/class/power_supply/BAT0/charge_stop_threshold = 80 [%]
...
Note that if you want the update to survive reboot, you need to update the configuration file at /etc/default/tlp
by uncommenting / modifying the lines 355-356 (you will need to open as root and overwrite readonly protection, for example in vim you need :w!
):
350 # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
351 # required). Charging starts when the remaining capacity falls below the
352 # START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
353 # Main / Internal battery (values in %)
354 # Default: <none>
355 START_CHARGE_THRESH_BAT0=70
356 STOP_CHARGE_THRESH_BAT0=80
357 # Ultrabay / Slice / Replaceable battery (values in %)
358 # Default: <none>
359 #START_CHARGE_THRESH_BAT1=75
360 #STOP_CHARGE_THRESH_BAT1=80
For more details:
https://linrunner.de/en/tlp/docs/tlp-configuration.html#chargethresholds