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

David Zeuthen david at freedesktop.org
Wed Mar 2 13:30:42 PST 2005


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

Modified Files:
	acpi.c 
Log Message:
2005-03-02  David Zeuthen  <davidz at redhat.com>

	* hald/linux2/acpi.c (acpi_poll): New function
	(acpi_synthesize_hotplug_events): Setup timeout every ten seconds to
	poll batteries (since some ACPI implementations don't report back when
	the battery charge level changes)



Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- acpi.c	2 Mar 2005 20:50:23 -0000	1.11
+++ acpi.c	2 Mar 2005 21:30:40 -0000	1.12
@@ -44,6 +44,29 @@
 	ACPI_TYPE_BUTTON
 };
 
+#define ACPI_POLL_INTERVAL 10000
+
+static gboolean
+acpi_poll (gpointer data)
+{
+	GSList *i;
+	GSList *devices;
+
+	devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
+								    "battery.type",
+								    "primary");
+	for (i = devices; i != NULL; i = g_slist_next (i)) {
+		HalDevice *d;
+		
+		d = HAL_DEVICE (i->data);
+		if (hal_device_has_property (d, "linux.acpi_type"))
+			acpi_rescan_device (d);
+	}
+
+	return TRUE;
+}
+
+
 typedef struct ACPIDevHandler_s
 {
 	int acpi_type;
@@ -294,6 +317,11 @@
 	snprintf (path, sizeof (path), "%s/acpi/button/sleep", get_hal_proc_path ());
 	acpi_synthesize (path, ACPI_TYPE_BUTTON);
 
+	/* setup timer for things that we need to poll */
+	g_timeout_add (ACPI_POLL_INTERVAL,
+		       acpi_poll,
+		       NULL);
+
 out:
 	return ret;
 }




More information about the hal-commit mailing list