https://github.com/dr3mro/battery_ctrl
I would be honored if you recheck it now.
That's much improved to my taste. After a thorough read I gave it a go on my T430s, after noticing that previous settings in Lenovo's windows utility were not still set, in that the 'high' State in acpiconf -i0 was 100%. (I recall having removed the battery at some time).
I immediately wished you had incorporated the code to show the
existing threshold settings, perhaps with the first and only parameter being 'show'?
So I started with
Code:
root@t430s:~ # battery-ctrl.sh 89 100
start threshold was set to : 89
failed to set stop threshold.
root@t430s:~ # battery-ctrl.sh 89 99
start threshold was set to : 89
stop threshold was set to : 99
root@t430s:~ #
Which confirms that 100 is not a valid stop value, despite it being the initial unmodified value!
Apart from requesting a 'show' function, I suggest checking the acpi_ibm oid
before checking and possibly loading the acpi_call module, in case non ibm|lenovo users run it, and also perhaps posting your code directly to the PR?
It may also make sense to choose a minimum practical value for start, and a minimum range between start and stop?
cheers, Ian
PS I still think committing Kevin Zheng's patch to be the best fix for this, but meanwhile a working utility is very handy. Maybe more people with other model Lenovos will test it?