Re: [PATCH] ACPI / battery: Fix reporting "Not charging" when capacity is 100%

From: Pavel Machek
Date: Sun Nov 11 2018 - 06:30:35 EST


Hi!

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

if (battery->capacity_now >= battery->full_charge_capacity)

?
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature