From cff4f578e5375b10cd92e15983b53427faf87147 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Wed, 30 Jan 2013 21:21:22 +0000 Subject: [PATCH] linux: Fix batteries which report current energy but full charge The condition should be for energy_full, not energy, since we aim to find some way of finding energy_full and energy_full_design irrespective of the way we find energy. https://bugs.freedesktop.org/show_bug.cgi?id=60104 Signed-off-by: Alex Hornung --- src/linux/up-device-supply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index 8462673..9dca444 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -574,7 +574,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply) energy_full_design = sysfs_get_double (native_path, "energy_full_design") / 1000000.0; /* convert charge to energy */ - if (energy < 0.01) { + if (energy_full < 0.01) { energy_full = sysfs_get_double (native_path, "charge_full") / 1000000.0; energy_full_design = sysfs_get_double (native_path, "charge_full_design") / 1000000.0; energy_full *= voltage_design;