-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: threshold ranges on ThinkPads #97
Comments
Uh... actually, I think I got the threshold backwards. I'm comparing with values on my Asus ROG Strix G15. It only has one value: My Lenovo ThinkPad T14 G1 has two thresholds:
as well as two legacy APIs that are supposedly synchronized with those two. |
Thank you for reporting this. Do you have any idea how |
Yes, I found the way it works in the Device Compatibility section on ThinkPad in the Battery Health Charging GNOME extension documentation. It depends on the direction of the movement of the thresholds: up or down. The threshold closest to the target must be modified first. That's why Battery Health Charging supports 3 profiles and their defaults define 5 percent windows with the sart/end thresholds:
If the thresholds are decreased (e.g. from echo '55' | sudo tee /sys/class/power_supply/BAT0/charge_control_start_threshold
echo '60' | sudo tee /sys/class/power_supply/BAT0/charge_control_end_threshold If the thresholds are increased (e.g. from echo '80' | pkexec tee /sys/class/power_supply/BAT0/charge_control_end_threshold
echo '75' | pkexec tee /sys/class/power_supply/BAT0/charge_control_start_threshold |
OK, I think just set the start value 5 lower than the end, and check which one needs to be set first. |
I learned Go these last few months (I heartily approve of your choice of language 😉), so I'll prepare a pull request with a fix. |
I had a thought about how this could be implemented without breaking changes in the API. We could change the threshold argument to accept a range such that the user could pass a range to the bat threshold 55,60 To maintain backwards compatibility, setting a single value would imply 0 as a lower bound, on devices that have a start threshold setting. # The following are equivalent.
bat threshold 60
bat threshold 0,60 What do you think? |
I don't even see the point of the start threshold, what does it mean? If the charge is below it, charge, if the charge is between start and end: don't charge? In that case it needs to be slightly below the end threshold, and I would not allow it to be set by the user, just always set it 5 below end, before adjusting the end threshold. But if it doesn't charge below the start threshold and only charges above it, then I say: always set it to 0. (I hope it is like that, because then we can ignore the start, and always set it to 0 and don't offer a way to modify it.) |
Right. I am confused now. I took it to mean that it will only charge when the current level is within the range specified by
I also can't decipher how it works from the commit but if that's how it works then we should probably go with preset offset of around 5. I also don't have any strong opinions about whether or not we should expose the full functionality to the user. If we can confirm how it works then either is fine with me. |
Personnally, I don't see the point of the start threshold either. I've been using the Battery Health Charging extension in GNOME for a few months and I never felt the need to customize the thresholds. I use the built-ins 60, 80 and 100, which set 55, 75 and 95 start thresholds on my ThinkPad T14. I would always set the start threshold 5 points below the end threshold. I'm going to do some tests with that start threshold on my ThinkPad T14 because I don't understand what it does either. By the way, I recently wrote over Ubuntu on that ThinkPad with another distro I wanted to try out, and I was suprised to see that the thresholds had persisted after the whole disk erasure. And I still could change them manually. Where could they be stored? In the TPM chip? |
They get reset to 100/0 (no end threshold) when the module loads. When the module never loads again, the value must get stored somewhere in the UEFI/BIOS area. |
Concerning the start threshold, the TLP documentation mentions that it's the level below which charging will begin when connecting the charger. So if we set it to In reality, when I try setting it to I confirm that if I set it to a lower value than the actual charge, charging stops. My battery is at BTW, |
OK, then |
You can try the |
I noticed in the |
You can disregard the requirements of gofumpt or any other tool in the Makefile. For the application, any version >= 1.18 should be fine and you're welcome to bump it to a later version if you need to. |
Computer: Lenovo ThinkPad T14 Gen 1 AMD (manufactured in 2021)
CPU: AMD Ryzen PRO 7 4750U
OS: Ubuntu 24.04
I could not set a battery threshold on my Lenovo ThinkPad T14 Gen1 (while it works on my Asus ROG Strix G15 2021). I got the following error:
with the
debug
flag:When searching on the battery system path, I found the UbuntuHandbook page on setting battery threshold. Trying to set the
end
threshold manually failed as well:$ sudo sh -c "echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold" sh: 1: echo: echo: I/O error
It led me to try manually setting the lower charging threshold to a lower value than the
end
value:sudo sh -c "echo 20 > /sys/class/power_supply/BAT0/charge_control_start_threshold"
Which I unfortunately did before trying to read the current value. :-( I don't know what it was before. Afterwards, I could set the
end
threshold, manually or withbat
.I gather that the
end
threshold must not be lower than thestart
threshold.The text was updated successfully, but these errors were encountered: