summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-06-14 14:16:32 +0100
committerRichard Hughes <richard@hughsie.com>2009-06-14 14:16:32 +0100
commit57615b36390d001abaed349fb9d750cb3e3acaad (patch)
tree4105e0c93600b262193210304db327d5aa6e9ce3
parent408fad75f9c3e57256bb005d8f6f0ee3a5c1f935 (diff)
Mark batteries as empty if they have unknown state and a very low energy
-rw-r--r--src/dkp-supply.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dkp-supply.c b/src/dkp-supply.c
index 9ea76b5..0527aaa 100644
--- a/src/dkp-supply.c
+++ b/src/dkp-supply.c
@@ -411,6 +411,12 @@ dkp_supply_refresh_battery (DkpSupply *supply)
state = DKP_DEVICE_STATE_UNKNOWN;
}
+ /* if empty, and BIOS does not know what to do */
+ if (state == DKP_DEVICE_STATE_UNKNOWN && energy < 0.01) {
+ egg_warning ("Setting %s state empty as unknown and very low", native_path);
+ state = DKP_DEVICE_STATE_EMPTY;
+ }
+
/* reset unknown counter */
if (state != DKP_DEVICE_STATE_UNKNOWN) {
egg_debug ("resetting unknown timeout after %i retries", supply->priv->unknown_retries);