Advice on battery status

Richard Hughes hughsient at gmail.com
Mon Jul 6 01:59:38 PDT 2009


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.

Comments?

Richard.


More information about the devkit-devel mailing list