upower/upower-0.9.15-use_percentage_when_noly_energy_full_is_unavailable.patch

17 lines
649 B
Diff

diff -Nru upower-0.9.15.orig/src/linux/up-device-supply.c upower-0.9.15/src/linux/up-device-supply.c
--- upower-0.9.15.orig/src/linux/up-device-supply.c 2011-12-03 14:09:57.000000000 +0100
+++ upower-0.9.15/src/linux/up-device-supply.c 2012-02-28 18:23:46.392531386 +0100
@@ -694,10 +694,8 @@
percentage = 100.0f;
}
- /* device is a peripheral and not providing power to the computer */
- if (energy < 0.01f &&
- energy_rate < 0.01f &&
- energy_full < 0.01f) {
+ /* device is not reporting charge or energy, try to read the percentage */
+ if (energy_full < 0.01f) {
percentage = sysfs_get_double (native_path, "capacity");
}