From 627c4726c71f95c8ee963d1efe0008c9fc4e3974 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Wed, 30 Jan 2013 21:21:22 +0000 Subject: [PATCH 1/1] linux: device-supply - Fix logic error in coldplug * 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. 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; -- 1.7.10.4