On 3/8/21, Subhaditya Nath <sn03.gene...@gmail.com> wrote: > I have a Thinkpad E495 that has Battery Charge threshold support. i.e. > it can be set such that the battery starts charging at a specified > amount of charge (say, 70%) and automatically stops charging at a > specified charge (say, 80%). This feature is also available on Linux by > using TLP (made by linrunner, his website is linrunner.de)
I just investigated a little more about it, and what do I see? Surprise! It's just a shell script! Yeah! And how does it do the threshold thing? Simple! It just writes the required values to - /sys/class/power_supply/BAT0/charge_start_threshold /sys/class/power_supply/BAT0/charge_stop_threshold Done! And the actual work is done by something called the 'natacpi framework', which is implemented by the linux kernel itself. I don't know :shrug: (I just gathered the above sentence after a few minutes of googling. I know very little about the kernel and all) For those who are curious, below is the output of `tlp-stat -b`. Note this line - natacpi = active (data, thresholds) --- TLP 1.3.1 -------------------------------------------- +++ Battery Features: Charge Thresholds and Recalibrate natacpi = active (data, thresholds) tpacpi-bat = active (recalibrate) tp-smapi = inactive (ThinkPad not supported) +++ ThinkPad Battery Status: BAT0 (Main / Internal) /sys/class/power_supply/BAT0/manufacturer = SMP /sys/class/power_supply/BAT0/model_name = 01AV446 /sys/class/power_supply/BAT0/cycle_count = 205 /sys/class/power_supply/BAT0/energy_full_design = 45280 [mWh] /sys/class/power_supply/BAT0/energy_full = 42750 [mWh] /sys/class/power_supply/BAT0/energy_now = 26430 [mWh] /sys/class/power_supply/BAT0/power_now = 6810 [mW] /sys/class/power_supply/BAT0/status = Discharging /sys/class/power_supply/BAT0/charge_start_threshold = 75 [%] /sys/class/power_supply/BAT0/charge_stop_threshold = 80 [%] tpacpi-bat.BAT0.forceDischarge = 0 Charge = 61.8 [%] Capacity = 94.4 [%]