Limit battery charging (no BIOS options available)

I love my new HP Envy with AMD 8840HS, Linux runs extremely smooth/everything works (just the quality of the 5MP webcam is crazy bad, maybe due to the limited support).

But to my surprise, the BIOS does not provide an option to limit battery charging to 80% or, for example if I want to keep it plugged in forever, 60%.

I followed these instructions for UPower to limit charging to 60%:

https://www.baeldung.com/linux/limit-battery-charge-level#2-limiting-battery-charging-1

Which means I checked the name of my battery with UPower -d, it showed BAT1

Then:

sudo nano /etc/udev/rules.d/r_battery.rules and wrote this

SUBSYSTEM==“power_supply”, ENV{POWER_SUPPLY_ONLINE}==“1”, RUN+=“/bin/sh -c ‘echo 60 > /sys/class/power_supply/BAT1/charge_control_end_threshold’”

reloaded the rules, rebooted. With battery at 57% battery, when I connect my USB charger, it charges..

Is there another way to “disable” charging at a certain percentage?

1 Like