Re: [patch] ACPI battery driver emits POWER_SUPPLY_STATUS_FULL when power lead plugged in

Alexey Starikovskiy
2009-01-25T19:49:54Z

Richard Hughes wrote:
> On Sun, 2009-01-25 at 11:42 -0200, Henrique de Moraes Holschuh wrote:
>> So, the above test will still break on any proper battery subsystem with the
>> high watermark set below 100%, as those systems update full_charge_capacity
>> *only* when the cells really are full (and not because the EC decided to
>> stop the charging before they were full).
>
> This is what I observed when testing my patch.
>
> The attached patch checks the last full and design charge, as this seems
> to work in all cases I have here. In the case of broken batteries or
> broken hardware, we just return UNKNOWN in this "settling" state, which
> is much better for userspace than falling back to full.
>
> With the attached patch userspace gets the right states. In the future,
> maybe we can do some sort of metric over time (watching to see if the
> present charge changes) but for the most part the patch fixes things up
> for userspace.
> else
> val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
This last else should return STATUS_NOT_CHARGING, IMHO. We know this little bit about it.
>
> Please review,
>
> Richard.
>
>