Bug 449997 - Battery charge limit is not supported on laptops that have charge_control_end_threshold, but not charge_control_start_threshold
Summary: Battery charge limit is not supported on laptops that have charge_control_end...
Status: RESOLVED FIXED
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-11 09:20 UTC by aeneid
Modified: 2022-03-26 10:21 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24.1


Attachments
output of ls -Flavh /sys/class/power_supply/BAT0/ (1.40 KB, text/plain)
2022-02-11 09:20 UTC, aeneid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aeneid 2022-02-11 09:20:57 UTC
Created attachment 146574 [details]
output of ls -Flavh /sys/class/power_supply/BAT0/

SUMMARY
The option  to set the battery charge limit does not show up on my Asus Vivobook laptop.

I suspect that the MR:
 "Support new charge_control_*_threshold" - https://invent.kde.org/plasma/powerdevil/-/merge_requests/70)"

Did not account for the case where "charge_control_start_threshold" does not exist, as outlined in this comment:
https://invent.kde.org/plasma/powerdevil/-/merge_requests/22#note_110418


STEPS TO REPRODUCE
1. In the terminal run "systemsettings"
2. Navigate to Power Management > Advanced Power Settings

OBSERVED RESULT
The charged limit settings are not shown.

The terminal logs:
Warning from helper: Failed to open "/sys/class/power_supply/BAT0/charge_control_start_threshold" for reading
Warning from helper: Failed to open "/sys/class/power_supply/BAT0/charge_start_threshold" for reading
Warning from helper: Failed to open "/sys/class/power_supply/BAT0/charge_stop_threshold" for reading
org.kde.powerdevil.chargethresholdhelper.getthreshold failed "Charge thresholds not supported"

EXPECTED RESULT
The charge limit settings should be supported and shown.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Kernel Version: 5.13.0-28-generic (64-bit)

ADDITIONAL INFORMATION
- Using the command line to set the charge threshold works as expected.
- Probably related bug: bug 440297
Comment 1 Nate Graham 2022-02-11 21:09:20 UTC
Seems quite likely. Would you be interested in submitting a merge request to fix this? Seems like it shouldn't be too hard to do, and I can help guide you through the process.
Comment 2 Bug Janitor Service 2022-02-12 09:40:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/77
Comment 3 Buovjaga 2022-02-13 15:33:11 UTC
(In reply to aeneid from comment #0)
> STEPS TO REPRODUCE
> 1. In the terminal run "systemsettings"

Correction: "systemsettings5"

> 2. Navigate to Power Management > Advanced Power Settings
> 
> OBSERVED RESULT
> The charged limit settings are not shown.
> 
> The terminal logs:
> Warning from helper: Failed to open
> "/sys/class/power_supply/BAT0/charge_control_start_threshold" for reading
> Warning from helper: Failed to open
> "/sys/class/power_supply/BAT0/charge_start_threshold" for reading
> Warning from helper: Failed to open
> "/sys/class/power_supply/BAT0/charge_stop_threshold" for reading
> org.kde.powerdevil.chargethresholdhelper.getthreshold failed "Charge
> thresholds not supported"

I repro this with a KDE Slimbook and Plasma 5.24. Looking forward to the merged fix :)
Comment 4 Nate Graham 2022-02-14 21:15:42 UTC
Git commit f7b1f2f182ab97aab1590ad47804c1dd7f04ef1f by Nate Graham, on behalf of Méven Car.
Committed on 14/02/2022 at 21:15.
Pushed by ngraham into branch 'master'.

Support hardware with only one charging threshold, not both

getthreshold will return -1 for unsupported thresholds.

setthreshold will tollerate receving no value or -1 to ignore setting a
threshold.
FIXED-IN: 5.24.1

M  +24   -15   daemon/chargethresholdhelper.cpp
M  +2    -2    daemon/powerdevilcore.cpp
M  +11   -10   kcmodule/global/GeneralPage.cpp

https://invent.kde.org/plasma/powerdevil/commit/f7b1f2f182ab97aab1590ad47804c1dd7f04ef1f
Comment 5 Nate Graham 2022-02-14 21:18:08 UTC
Git commit 29154c13a186f5d13191db4bca1984ba2a21b839 by Nate Graham, on behalf of Méven Car.
Committed on 14/02/2022 at 21:18.
Pushed by ngraham into branch 'Plasma/5.24'.

Support hardware with only one charging threshold, not both

getthreshold will return -1 for unsupported thresholds.

setthreshold will tollerate receving no value or -1 to ignore setting a
threshold.
FIXED-IN: 5.24.1


(cherry picked from commit f7b1f2f182ab97aab1590ad47804c1dd7f04ef1f)

M  +24   -15   daemon/chargethresholdhelper.cpp
M  +2    -2    daemon/powerdevilcore.cpp
M  +11   -10   kcmodule/global/GeneralPage.cpp

https://invent.kde.org/plasma/powerdevil/commit/29154c13a186f5d13191db4bca1984ba2a21b839
Comment 6 Buovjaga 2022-03-26 10:21:59 UTC
(In reply to Buovjaga from comment #3)
> I repro this with a KDE Slimbook and Plasma 5.24. Looking forward to the
> merged fix :)

I discovered that Slimbook and other TongFang-based laptops lack kernel support for charging limits: https://slimbook.es/en/forum/tag/amd/question/5384-pro-x-amd-set-max-battery-charge-percentage