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 <alex@alexhornung.com>
This commit is contained in:
Alex Hornung 2013-01-30 21:21:22 +00:00 committed by Martin Pitt
parent b59d9848d4
commit cff4f578e5

View file

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