Advice on battery status

Kay Sievers kay.sievers at vrfy.org
Mon Jul 6 03:20:32 PDT 2009


On Mon, Jul 6, 2009 at 10:59, Richard Hughes<hughsient at gmail.com> wrote:
> At the moment DK-p has the following status values:
>
>        DKP_DEVICE_STATE_UNKNOWN,
>        DKP_DEVICE_STATE_CHARGING,
>        DKP_DEVICE_STATE_DISCHARGING,
>        DKP_DEVICE_STATE_EMPTY,
>        DKP_DEVICE_STATE_FULLY_CHARGED,
>
> This limits us with multi-battery setups, where batteries can
> discharge in sequence, rather than bot at once. In this case, one
> battery can be discharging (100%, 99%, 98%) while the other sits at
> (54%, 54%, 54%) and only starts discharging when the first battery is
> depleted.
>
> At the moment, the kernel has state "unknown" state for the second
> battery, but that isn't representative of what's happening. Looking at
> the system power state, the AC adaptor is unplugged, and it's expected
> the second battery will be discharging soon.
>
> Now, in the last release of DKp we just proxied this unknown state to
> the client (g-p-m in this case) which showed a confused icon (!) at
> the unknown battery status. Ideally we want to map this icon to what's
> about to happen, so a battery with a plug icon (with no flash) if the
> system is charging, and a battery without a plug icon or a flash if
> the system is discharging.
>
> Now, in the current git master, if the battery has unknown state, we
> map the status value to the above system state so that the icon and
> graphs (and policy) all do the right thing, but it does feel wrong to
> map a battery state of essentially "doing nothing, but about to
> discharge" to "discharging".
>
> I'm going to suggest adding a new enumerated state of
> DKP_DEVICE_STATE_PENDING_DISCHARGING and
> DKP_DEVICE_STATE_PENDING_CHARGING if you guys think this is a good
> idea. This allows us to add a couple of "case:" entries to
> gnome-power-manager to fix the correct icons, but also not send lies
> to the sesson about what the battery is actually doing.

Is FULL and EMPTY really a state of the device like CHARGING
DISCHARGING? Wouldn't it be two different things what's currently
"done with it" and what's "in there"?

What's done with it:
   CHARGING (not full and on AC)
   DISCHARGING (no AC)
   IDLE, (full battery and AC, or not full and airplane power
connector, or other battery has priority)

What's in there:
    EMPTY and FULL are just special charge levels, not representing the STATE?

Thanks,
Kay


More information about the devkit-devel mailing list