From bbd289ee814231ad0c2c43f169e75fde49f83ae3 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 6 Jul 2009 09:13:49 +0100 Subject: [PATCH] Move a hack about the fully charged level from g-p-m --- src/dkp-device-supply.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/dkp-device-supply.c b/src/dkp-device-supply.c index 9952bf2..cc70e36 100644 --- a/src/dkp-device-supply.c +++ b/src/dkp-device-supply.c @@ -41,6 +41,7 @@ #define DKP_DEVICE_SUPPLY_REFRESH_TIMEOUT 30 /* seconds */ #define DKP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT 2 /* seconds */ #define DKP_DEVICE_SUPPLY_UNKNOWN_RETRIES 30 +#define DKP_DEVICE_SUPPLY_CHARGED_THRESHOLD 95.0f /* % */ struct DkpDeviceSupplyPrivate { @@ -522,6 +523,13 @@ dkp_device_supply_refresh_battery (DkpDeviceSupply *supply) percentage = 100.0f; } + /* some batteries stop charging much before 100% */ + if (state == DKP_DEVICE_STATE_UNKNOWN && + percentage > DKP_DEVICE_SUPPLY_CHARGED_THRESHOLD) { + egg_warning ("fixing up unknown %f", percentage); + state = DKP_DEVICE_STATE_FULLY_CHARGED; + } + /* calculate a quick and dirty time remaining value */ time_to_empty = 0; time_to_full = 0;