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

Alexey Starikovskiy
2009-01-23T19:00:07Z

Hi Richard,

This is probably related to this piece of code (drivers/acpi/battery.c),
similar code exists in drivers/acpi/sbs.c, but it is not relevant to your case:
case POWER_SUPPLY_PROP_STATUS:
if (battery->state & 0x01)
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
else if (battery->state & 0x02)
val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (battery->state == 0)
val->intval = POWER_SUPPLY_STATUS_FULL;
else
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
break;

Actually, state==0 means POWER_SUPPLY_STATUS_NOT_CHARGING, so if that is preferred it could be changed.

Regards,
Alex.

Richard Hughes wrote:
> When I insert the power lead or attach my T61 to the powered dock, the
> battery power supply status goes like this:
>
> 0.00s Discharging
> {dock}
> 0.10s Fully charged
> 1.00s Charging
>
> This causes userspace (in my case gnome-power-manager) to pop up a
> dialog telling me the battery is full, and the icon flickers to fully
> green, then 10% green and charging.
>
> This seems to have existed as long as the power supply class was being
> used by the acpi battery, but we've always relied on a userspace fudge.
>
> This is tested with 2.6.27.9-159.fc10.i686, although I seem to get the
> same thing with git from kernel.org.
>
> Is this a known issue? Does anybody have any insight into what causes
> this? I'm fully willing to test patches or debug this further myself.
>
> Thanks,
>
> Richard.
>
>