[PATCH] Test for success in reading file, not failure.

Thadeu Lima de Souza Cascardo cascardo at minaslivre.org
Mon Feb 4 08:16:56 PST 2008


---
 hald/linux/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hald/linux/device.c b/hald/linux/device.c
index e887c3c..d3dbc36 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3054,7 +3054,7 @@ refresh_battery_fast (HalDevice *d)
 	}
 
 	/* CURRENT: we prefer the average if it exists, although present is still pretty good */
-	if (!hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
+	if (hal_util_get_int_from_file (path, "current_avg", &current, 10)) {
 		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
 	} else if (hal_util_get_int_from_file (path, "current_now", &current, 10)) {
 		hal_device_property_set_int (d, "battery.reporting.rate", current / 1000);
-- 
1.5.4


More information about the hal mailing list