lkml.org 
[lkml]   [2018]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ACPI / battery: Fix reporting "Not charging" when capacity is 100%
On Fri 2018-11-02 23:57:32, João Paulo Rechi Vita wrote:
> Commit 19fffc8450d4378580a8f019b195c4617083176f fixed reporting
> "Discharging" on some machines when AC was connected but the battery was
> not charging. But now on these machines the battery status is reported
> as "Not charging" even when the battery is fully charged.
>
> This commit takes the battery capacity into consideration when checking
> if "Not charging" should be returned and "Full" is returned when the
> capacity is 100%.
>
> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>

We have people trying to modify this and it caused regressions in
MATE, IIRC.

Plus, I don't think "100% charge" is right test for "battery full". At
least on thinkpads, there's configuration option, and it is common
_not_ to charge batterry above 95% or so (to increase its lifetime).

Pavel


> * was plugged in and the device thus did not start a new charge cycle.
> */
> if ((battery_ac_is_broken || power_supply_is_system_supplied()) &&
> - battery->rate_now == 0)
> + battery->rate_now == 0) {
> + if (battery->capacity_now && battery->full_charge_capacity &&
> + battery->capacity_now / battery->full_charge_capacity == 1)
> + return POWER_SUPPLY_STATUS_FULL;

Division? Really?

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-11-05 10:20    [W:0.093 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site