hal/hald/linux2 acpi.c,1.43,1.44

Ryan Lortie desrt at freedesktop.org
Sun Dec 11 00:51:25 PST 2005


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

Modified Files:
	acpi.c 
Log Message:
2005-12-11  Ryan Lortie  <desrt at desrt.ca>

        * hald/linux2/acpi.c (battery_refresh_poll):  Force 'rate' to be zero
        in the case that the battery is neither charging nor discharging.
        This workaround is required for some buggy ACPI implementations.



Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- acpi.c	2 Dec 2005 17:11:00 -0000	1.43
+++ acpi.c	11 Dec 2005 08:51:23 -0000	1.44
@@ -90,6 +90,8 @@
 	int voltage;
 	int remaining_time;
 	int remaining_percentage;
+	gboolean charging;
+	gboolean discharging;
 
 	path = hal_device_property_get_string (d, "linux.acpi_path");
 	if (path == NULL)
@@ -183,6 +185,18 @@
 		normalised_rate = 0;
 
 	/*
+	 * Some laptops report a rate even when not charging or discharging.
+	 * If not charging and not discharging force rate to be zero.
+         *
+         * http://bugzilla.gnome.org/show_bug.cgi?id=323186
+	 */
+	charging = hal_device_property_get_bool (d, "battery.rechargeable.is_charging");
+	discharging = hal_device_property_get_bool (d, "battery.rechargeable.is_discharging");
+
+	if (!charging && !discharging)
+		normalised_rate = 0;
+
+	/*
 	 * Some laptops report current charge much larger than
 	 * full charge when at 100%.  Clamp back down to 100%.
 	 */




More information about the hal-commit mailing list