diff options
author | João Paulo Rechi Vita <jprvita@endlessm.com> | 2018-11-02 16:05:21 -0700 |
---|---|---|
committer | João Paulo Rechi Vita <jprvita@endlessm.com> | 2018-12-18 17:16:49 -0800 |
commit | 888c9121f090a1128562edb9c06dcd6b564578c7 (patch) | |
tree | acbb035920dfafb13c6defda7187c864a1c902a1 | |
parent | f3f4c6e0b4d05b541a87f09bd93f70a487258884 (diff) | |
download | upower-888c9121f090a1128562edb9c06dcd6b564578c7.tar.gz |
linux: Don't set out_state before state is final
Currently up_device_supply_refresh_battery sets out_state before the
state value is definitive, so the wrong state value is returned to the
caller. Luckily the only caller does not make use of this value at the
moment, so there are no user-visible consequences. Nonetheless this is a
bug, so this commit fixes it.
-rw-r--r-- | src/linux/up-device-supply.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index 000a00f..1644665 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -669,7 +669,6 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, } state = up_device_supply_get_state (native_path); - *out_state = state; /* this is the new value in uW */ energy_rate = fabs (sysfs_get_double (native_path, "power_now") / 1000000.0); @@ -833,6 +832,8 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply, supply->priv->energy_old_first = 0; } + *out_state = state; + g_object_set (device, "energy", energy, "energy-full", energy_full, |