Cherry-pick MR for !510.
Some kernel drivers expose charge_types
in addition to start/endcharge thresholds for power supply batteries. A prominent exampleis the dell_laptop
starting with Linux 6.12, which supports(at least some) Dell Latitude laptops.
This commit will attempt to write a charge type on Linux systemsif the battery's charge_types
file exists in sysfs.It will write Standard
as charge type if the configuration asksfor fully charging the laptop, and Custom
for all other chargethreshold values.
The KAuth helper also now supports writing explicitly providedcharge types, however the settings UI does not make use of this yet.
This commit does not (yet) implement reading current or supportedcharge types, because that's not useful without a settings UI.Note that charge threshold settings are only applied when valuesare changed, so any pre-existing charge type (e.g. Fast
) won't betouched without an explicit interaction.
BUG: 497200
(cherry picked from commit 54c51591)
Co-authored-by: Jakob Petsovits jpetso@petsovits.com