Bug 435931 - Charge limit stops 1% short
Summary: Charge limit stops 1% short
Status: RESOLVED UPSTREAM
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL: https://gitlab.freedesktop.org/upower...
Keywords: usability
Depends on:
Blocks:
 
Reported: 2021-04-19 18:12 UTC by Nate Graham
Modified: 2022-02-14 18:57 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2021-04-19 18:12:24 UTC
If you set a charge limit of 80%, charging actually stops at 79%. This has two effects:

1. The Battery & Brightness applet never enters an inactive state because the charge percentage does not match the limit.

2. If the percentage is shown on the applet, the percentage it stops at doesn't match the limit you set, which is confusing and makes the feature seem broken.

Reproduces for me for any charge limit value except 100%.

Hardware is a Lenovo ThinkPad X1 Yoga (gen 3).
Comment 1 David Edmundson 2021-04-19 23:01:12 UTC
Probably just some rounding being handled differently

Do we know at this point whether it's our side that's wrong or upower

Can you include your:

upower --dump
Comment 2 Nate Graham 2021-04-20 13:12:50 UTC
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Tue 20 Apr 2021 07:06:35 AM MDT (307 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SMP
  model:                5B10W13931
  serial:               2442
  power supply:         yes
  updated:              Tue 20 Apr 2021 07:10:36 AM MDT (66 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               charging
    warning-level:       none
    energy:              46.55 Wh
    energy-empty:        0 Wh
    energy-full:         52.67 Wh
    energy-full-design:  51.01 Wh
    energy-rate:         10.039 W
    voltage:             16.972 V
    time to full:        36.6 minutes
    percentage:          89%
    capacity:            100%
    technology:          lithium-polymer
    icon-name:          'battery-full-charging-symbolic'

Device: /org/freedesktop/UPower/devices/tablet_wacom_battery_0
  native-path:          wacom_battery_0
  model:                Wacom Pen and multitouch sensor
  power supply:         no
  updated:              Tue 20 Apr 2021 07:10:36 AM MDT (66 seconds ago)
  has history:          yes
  has statistics:       yes
  tablet
    warning-level:       none
    percentage:          0%
    icon-name:          'battery-missing-symbolic'

Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
  native-path:          ucsi-source-psy-USBC000:001
  power supply:         yes
  updated:              Tue 20 Apr 2021 07:06:36 AM MDT (306 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              yes
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o002
  native-path:          ucsi-source-psy-USBC000:002
  power supply:         yes
  updated:              Tue 20 Apr 2021 07:06:35 AM MDT (307 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              Tue 20 Apr 2021 07:06:35 AM MDT (307 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               charging
    warning-level:       none
    energy:              46.55 Wh
    energy-full:         52.67 Wh
    energy-rate:         10.039 W
    time to full:        36.6 minutes
    percentage:          89%
    icon-name:          'battery-full-charging-symbolic'

Daemon:
  daemon-version:  0.99.11
  on-battery:      no
  lid-is-closed:   no
  lid-is-present:  yes
  critical-action: Hibernate
Comment 3 David Edmundson 2021-04-20 21:38:24 UTC
I'm assuming this is whilst you had a charge-limit of 90?


    state:               charging
    time to full:        36.6 minutes
    percentage:          89%

Battery stats don't indicate we're doing anything wrong. Please report to upower
Comment 4 Nate Graham 2021-04-21 15:55:24 UTC
OK, reported: https://gitlab.freedesktop.org/upower/upower/-/issues/142
Comment 5 Nate Graham 2022-01-25 17:50:50 UTC
The upower people say it's a kernel bug, so I filed a kernel bug for it: https://bugzilla.kernel.org/show_bug.cgi?id=215531
Comment 6 Bug Janitor Service 2022-02-07 04:00:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1441
Comment 7 Nate Graham 2022-02-14 18:35:56 UTC
Partially fixed in the kernel with https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e96c1197aca628f7d2480a1cc3214912b40b3414; now it's back to UPower to fix, and https://gitlab.freedesktop.org/upower/upower/-/issues/142 has been re-opened.
Comment 8 Nate Graham 2022-02-14 18:55:54 UTC
Git commit 49013bf4a5fd570fe05910f2d145a926410fc140 by Nate Graham.
Committed on 14/02/2022 at 18:55.
Pushed by ngraham into branch 'master'.

applets/battery: adjust show/hide conditions for charge limits

When we are using a charge threshold, the kernel may stop charging
within a percentage point of the actual threshold and this is
considered correct behavior, so we have to handle that. See
https://bugzilla.kernel.org/show_bug.cgi?id=215531.

Also, Upower may give us a status of "Not charging" rather than
"Fully charged", so we need to account for that as well. See
https://gitlab.freedesktop.org/upower/upower/-/issues/142.

M  +14   -1    applets/batterymonitor/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-workspace/commit/49013bf4a5fd570fe05910f2d145a926410fc140
Comment 9 Nate Graham 2022-02-14 18:57:08 UTC
Git commit ef454e9d77fd48c07f810e9ab6cc0c7812f30ce7 by Nate Graham.
Committed on 14/02/2022 at 18:56.
Pushed by ngraham into branch 'Plasma/5.24'.

applets/battery: adjust show/hide conditions for charge limits

When we are using a charge threshold, the kernel may stop charging
within a percentage point of the actual threshold and this is
considered correct behavior, so we have to handle that. See
https://bugzilla.kernel.org/show_bug.cgi?id=215531.

Also, Upower may give us a status of "Not charging" rather than
"Fully charged", so we need to account for that as well. See
https://gitlab.freedesktop.org/upower/upower/-/issues/142.


(cherry picked from commit 49013bf4a5fd570fe05910f2d145a926410fc140)

M  +14   -1    applets/batterymonitor/package/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-workspace/commit/ef454e9d77fd48c07f810e9ab6cc0c7812f30ce7