hal/hald/linux2 pmu.c,1.11,1.12

David Zeuthen david at freedesktop.org
Fri Jul 29 10:47:14 PDT 2005


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv18045/hald/linux2

Modified Files:
	pmu.c 
Log Message:
2005-07-29  David Zeuthen  <davidz at redhat.com>

        Patch from Richard Hughes <richard at hughsie.com>.

        * hald/linux2/pmu.c (battery_refresh): Call
        util_compute_percentage_charge so we can populate
        battery.charge_level.percentage.



Index: pmu.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/pmu.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pmu.c	11 May 2005 17:46:32 -0000	1.11
+++ pmu.c	29 Jul 2005 17:47:12 -0000	1.12
@@ -68,6 +68,7 @@
 {
 	const char *path;
 	int flags;
+	int current, last_full;
 
 	path = hal_device_property_get_string (d, "linux.pmu_path");
 	if (path == NULL)
@@ -113,16 +114,25 @@
 		else
 			hal_device_property_set_int (d, "battery.charge_level.rate", -current);
 
+		current = hal_device_property_get_int (d, "battery.charge_level.current");
+		last_full = hal_device_property_get_int (d, "battery.charge_level.last_full");
+
 		/* TODO: could read some pmu file? */
 		hal_device_property_set_int (d, "battery.remaining_time", 
 					     util_compute_time_remaining (
 						     d->udi,
 						     hal_device_property_get_int (d, "battery.charge_level.rate"),
-						     hal_device_property_get_int (d, "battery.charge_level.current"),
-						     hal_device_property_get_int (d, "battery.charge_level.last_full"),
+						     current,
+						     last_full,
 						     hal_device_property_get_bool (d, "battery.rechargeable.is_discharging"),
 						     hal_device_property_get_bool (d, "battery.rechargeable.is_charging")));
 
+		hal_device_property_set_int (d, "battery.charge_level.percentage", 
+				  	     util_compute_percentage_charge (
+						     d->udi,
+						     current,
+						     last_full));
+
 		device_property_atomic_update_end ();
 	} else {
 		device_property_atomic_update_begin ();




More information about the hal-commit mailing list