hal/hald/linux2 apm.c,1.15,1.16

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Mar 9 06:59:54 PST 2006


Update of /cvs/hal/hal/hald/linux2
In directory kemper:/tmp/cvs-serv20066/hald/linux2

Modified Files:
	apm.c 
Log Message:
2006-03-09  Danny Kukawka  <danny.kukawka at web.de>

        * hald/linux2/apm.c: (battery_refresh): fixed remaining_time
        property, remove the key if battery is charging because apm don't know
        remaining time on changing. The key is not mandatory, do the same
        as on ACPI if value is unknown.



Index: apm.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/apm.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- apm.c	2 Dec 2005 17:11:01 -0000	1.15
+++ apm.c	9 Mar 2006 14:59:52 -0000	1.16
@@ -200,12 +200,13 @@
 			is_discharging = (i.ac_line_status == FALSE);
 			/* apm returns time in minutes, not seconds */
 			remaining_time = i.battery_time * 60;
-			if (remaining_time < 0)
-				remaining_time = 0; 
 		}
 
-		/* set the time to discharge, or 0 for charging */
-		hal_device_property_set_int (d, "battery.remaining_time", remaining_time);
+		/* set the time on discharge, and remove property on charging because unknown on APM */
+		if (remaining_time > 0)
+			hal_device_property_set_int (d, "battery.remaining_time", remaining_time);
+		else
+			hal_device_property_remove (d, "battery.remaining_time");
 
 		/* set the correct charge states */
 		hal_device_property_set_bool (d, "battery.rechargeable.is_charging", is_charging);




More information about the hal-commit mailing list