Move a hack about the fully charged level from g-p-m

This commit is contained in:
Richard Hughes 2009-07-06 09:13:49 +01:00
parent 37767c77bb
commit bbd289ee81

View file

@ -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;