Bug 502201 - changing charge-thresholds for laptop battery is not reflected in upower
Summary: changing charge-thresholds for laptop battery is not reflected in upower
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (other bugs)
Version First Reported In: 6.3.3
Platform: Fedora RPMs Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-30 12:11 UTC by slartibart70
Modified: 2025-08-14 00:48 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description slartibart70 2025-03-30 12:11:36 UTC
I have limited my laptop battery-charging strategy using systemsettings > powermanagement > advanced power settings
There i have
stop charging at 85%
start charging below 66%

This works as expected, but:
- where can i find the udev(?) rules generated by systemsettings?
- if i run 'upower -i /org/freedesktop/UPower/devices/battery_BAT0' the result reads:
...
    technology:          lithium-polymer
    charge-start-threshold:        75%
    charge-end-threshold:          80%
    charge-threshold-supported:    yes
...

So, 75% instead of 66%? Why?

Any help on this? (no tlp installed, just plain plasma and upower)
Comment 1 slartibart70 2025-03-30 12:15:45 UTC
and, the 
    percentage:          84%
reported by upower is also not aligned with the charge-end-threshold.
Comment 2 Nate Graham 2025-03-31 20:07:34 UTC
Is there a user-facing problem here?
Comment 3 John Kizer 2025-04-10 18:27:09 UTC
Updating status as this is pending a reply from the reporter, thanks!
Comment 4 slartibart70 2025-04-10 18:37:32 UTC
oh, the question was addressed to me?
not sure what you mean with 'user facing problem'
I'm just using the tools the distro provides... upower is printing stats, systemsettings is setting/visualizing stats for battery.... so, any help please?
Comment 5 slartibart70 2025-04-10 18:42:44 UTC
as i already wrote above:
systemsetting battery-settings are winning over the data provided by 'upower -d'
I'm just complaining about the misalignment.

(and, of course, the 'magic' systemsettings does behind the curtain: where is this persisted? udev-rules? sth. else?)
Comment 6 Jakob Petsovits 2025-08-14 00:48:01 UTC
(In reply to slartibart70 from comment #5)
> systemsetting battery-settings are winning over the data provided by 'upower -d'
> I'm just complaining about the misalignment.

This is true, and the reason is that UPower does not read from the battery's own state. It gets its values from 1. an entry in "hwdb" (via system-wide config file) for the particular hardware, or 2. if no particular entry exists, a fallback which is the 75%-80% range that you see. UPower will apply this to the battery, however it doesn't adopt any existing battery settings.

UPower also doesn't (currently) offer an API for desktops to customize the system-wide settings, which is one reason why we can't yet switch to UPower by default as a backend / source of truth for charge limits.

> (and, of course, the 'magic' systemsettings does behind the curtain: where
> is this persisted? udev-rules? sth. else?)

System Settings in its current state has no magic at all, it writes the values straight to the battery/firmware (via kernel file interface) and hopes that they get stored there. If the firmware doesn't persist the thresholds, System Settings forgets everything. This is what UPower promises to solve.

I proposed a change that will give users a config file option to use UPower for charge limits: https://invent.kde.org/plasma/powerdevil/-/merge_requests/574 - a first step in this direction. If this is enabled, users will only have a checkbox for optimized battery charge behavior in System Settings, instead of configurable percentages. In return, UPower will apply battery charge thresholds on every boot, and there won't be any misalignment obviously. For the time being, users who opt into this can only customize thresholds via hwdb config file.