lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 6 Nov 2018 12:34:25 -0800
From:   João Paulo Rechi Vita <jprvita@...il.com>
To:     Pavel Machek <pavel@....cz>
Cc:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        linux-acpi@...r.kernel.org, Daniel Drake <drake@...lessm.com>,
        Sebastian Reichel <sebastian.reichel@...labora.co.uk>,
        LKML <linux-kernel@...r.kernel.org>, linux@...lessm.com,
        João Paulo Rechi Vita <jprvita@...lessm.com>
Subject: Re: [PATCH] ACPI / battery: Fix reporting "Not charging" when
 capacity is 100%

On Mon, Nov 5, 2018 at 1:19 AM Pavel Machek <pavel@....cz> wrote:
>
> 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@...lessm.com>
>
> We have people trying to modify this and it caused regressions in
> MATE, IIRC.
>

Do you have any pointers for further information?

> 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).
>

This will only affect machines where the firmware wrongly reports the
battery state as discharging, which the commit mentioned on this
commit message fixed so we now report it as not charging. From your
comment it does not sound like thinkpads are in this category. In any
case deciding to report battery full for any percentage other than
100% is a policy decision, which is normally left out of the kernel.

>
>
> >        * 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?
>

If you look further down in acpi_battery_get_property, that is how the
capacity property is calculated. Do you have a better suggestion?

--
João Paulo Rechi Vita
http://about.me/jprvita

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ