[upower PATCH 2/2] remove the UP_DEVICE_SUPPLY_CHARGED_THRESHOLD heuristic
Michal Schmidt
mschmidt at redhat.com
Tue Oct 12 05:42:35 PDT 2010
When a full battery starts to discharge, but reports its status as 'Unknown',
it takes a few minutes before g-p-m notices any change.
upowerd guesses the battery is fully charged as long as it has over 90% charge.
I see no reason to delay the reporting of discharging of the battery.
Let's remove this heuristic.
---
src/linux/up-device-supply.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index 3287efb..5feabfa 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -42,7 +42,6 @@
#define UP_DEVICE_SUPPLY_REFRESH_TIMEOUT 30 /* seconds */
#define UP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT 2 /* seconds */
#define UP_DEVICE_SUPPLY_UNKNOWN_RETRIES 30
-#define UP_DEVICE_SUPPLY_CHARGED_THRESHOLD 90.0f /* % */
#define UP_DEVICE_SUPPLY_COLDPLUG_UNITS_CHARGE TRUE
#define UP_DEVICE_SUPPLY_COLDPLUG_UNITS_ENERGY FALSE
@@ -603,13 +602,6 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
percentage = 100.0f;
}
- /* some batteries stop charging much before 100% */
- if (state == UP_DEVICE_STATE_UNKNOWN &&
- percentage > UP_DEVICE_SUPPLY_CHARGED_THRESHOLD) {
- egg_debug ("fixing up unknown %f", percentage);
- state = UP_DEVICE_STATE_FULLY_CHARGED;
- }
-
/* the battery isn't charging or discharging, it's just
* sitting there half full doing nothing: try to guess a state */
if (state == UP_DEVICE_STATE_UNKNOWN) {
More information about the devkit-devel
mailing list