hal/hald/linux2 Makefile.am, 1.6, 1.7 acpi.c, 1.4, 1.5 apm.c, 1.1, 1.2 blockdev.c, 1.1, 1.2 classdev.c, 1.8, 1.9 coldplug.c, 1.6, 1.7 hotplug.c, 1.7, 1.8 osspec.c, 1.7, 1.8 physdev.c, 1.5, 1.6 pmu.c, 1.1, 1.2 util.c, 1.6, NONE util.h, 1.5, NONE

David Zeuthen david at freedesktop.org
Tue Feb 8 08:44:22 PST 2005


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

Modified Files:
	Makefile.am acpi.c apm.c blockdev.c classdev.c coldplug.c 
	hotplug.c osspec.c physdev.c pmu.c 
Removed Files:
	util.c util.h 
Log Message:
2005-02-08  David Zeuthen  <davidz at redhat.com>

	* hald/run-hald.sh: Update to include a few more paths

	* hald/linux2/addons/Makefile.am: Add build rules for hald-addon-acpi

	* hald/linux2/addons/addon-acpi.c: New file

	* hald/linux2/pmu.c (pmu_synthesize_hotplug_events): Also look for
	computer in the TDL

	* hald/linux2/osspec.c (computer_callouts_add_done): New function
	(osspec_probe): Run callouts for computer

	* hald/linux2/classdev.c (add_classdev_probing_helper_done): Fix up
	for the new helper

	* hald/linux2/apm.c (apm_synthesize_hotplug_events): Also look for
	computer in the TDL

	* hald/linux2/acpi.c (acpi_synthesize_hotplug_events): Also look for
	computer in the TDL
	(acpi_generic_remove): Don't remove the device
	(acpi_callouts_add_done): New function
	(acpi_callouts_remove_done): New function
	(hotplug_event_begin_add_acpi): Run add callouts
	(hotplug_event_begin_remove_acpi): Run remove callouts

	* hald/property.c (hal_property_to_string): Add code for string lists

	* hald/hald.c (addon_terminated): New function
	(gdl_store_changed): Run addons
	(gdl_property_changed): Don't run property.d callouts
	(gdl_capability_added): Don't run capability.d callouts

	* hald/util.h: Move from hald/linux2 since this is generic.
	Export the HalHelperData structure when doing
	hal_util_helper invoke. Add prototypes for hal_util_terminate_
	helper, hal_util_dup_strv_from_g_slist,
	hal_util_callout_device_add, hal_util_callout_device_remove.

	* hald/util.c: Move from hald/linux2 since this is generic.
	(hal_util_terminate_helper): New function
	(hal_util_helper_invoke): Renamed from helper_invoke. Accept
	command line parameters (through g_shell_parse_argv). Accept a
	strv of extra environement to set. Introduce that timeout==0 means
	no timeout.  Return the HalHelperData structure
	(hal_util_dup_strv_from_g_slist): New convenience function; create
	a new NULL-terminated string vector from a GSList of strings.
	(callout_terminated): New function
	(callout_do_next): New function
	(hal_callout_device): New function
	(hal_util_callout_device_add): New function
	(hal_util_callout_device_remove): New function

	* hald/linux2/util.[ch]: Remove

	* hald/callout.[ch]: Remove since this functionality is now in util.[ch]

	* hald/Makefile.am: Add util.[ch]

	* hald/linux2/Makefile.am: Remove util.[ch]



Index: Makefile.am
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am	4 Feb 2005 05:24:25 -0000	1.6
+++ Makefile.am	8 Feb 2005 16:44:20 -0000	1.7
@@ -19,7 +19,6 @@
 	physdev.h		physdev.c			\
 	classdev.h		classdev.c			\
 	blockdev.h		blockdev.c			\
-	util.h			util.c				\
 	acpi.h			acpi.c				\
 	apm.h			apm.c				\
 	pmu.h			pmu.c				\

Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- acpi.c	3 Feb 2005 04:13:46 -0000	1.4
+++ acpi.c	8 Feb 2005 16:44:20 -0000	1.5
@@ -26,7 +26,6 @@
 
 #include <string.h>
 
-#include "../callout.h"
 #include "../device_info.h"
 #include "../logger.h"
 #include "../hald_dbus.h"
@@ -217,7 +216,8 @@
 
 	ret = TRUE;
 
-	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
+	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL &&
+	    (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
 		HAL_ERROR (("No computer object?"));
 		goto out;
 	}
@@ -281,10 +281,6 @@
 static gboolean
 acpi_generic_remove (HalDevice *d, ACPIDevHandler *handler)
 {
-	if (!hal_device_store_remove (hald_get_gdl (), d)) {
-		HAL_WARNING (("Error removing device"));
-	}
-
 	return TRUE;
 }
 
@@ -320,6 +316,37 @@
 	NULL
 };
 
+static void 
+acpi_callouts_add_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Add callouts completed udi=%s", d->udi));
+
+	/* Move from temporary to global device store */
+	hal_device_store_remove (hald_get_tdl (), d);
+	hal_device_store_add (hald_get_gdl (), d);
+
+	hotplug_event_end (end_token);
+}
+
+static void 
+acpi_callouts_remove_done (HalDevice *d, gpointer userdata)
+{
+	void *end_token = (void *) userdata;
+
+	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
+
+	/* Move from temporary to global device store */
+	hal_device_store_remove (hald_get_tdl (), d);
+
+	if (!hal_device_store_remove (hald_get_gdl (), d)) {
+		HAL_WARNING (("Error removing device"));
+	}
+
+	hotplug_event_end (end_token);
+}
+
 void
 hotplug_event_begin_add_acpi (const gchar *acpi_path, int acpi_type, HalDevice *parent, void *end_token)
 {
@@ -349,7 +376,6 @@
 			/* Merge properties from .fdi files */
 			di_search_and_merge (d);
 
-			/* TODO: Run callouts */
 			
 			/* Compute UDI */
 			if (!handler->compute_udi (d, handler)) {
@@ -358,11 +384,8 @@
 				goto out;
 			}
 
-			/* Move from temporary to global device store */
-			hal_device_store_remove (hald_get_tdl (), d);
-			hal_device_store_add (hald_get_gdl (), d);
-			
-			hotplug_event_end (end_token);
+			/* Run callouts */
+			hal_util_callout_device_add (d, acpi_callouts_add_done, end_token);
 			goto out;
 		}
 	}
@@ -393,7 +416,7 @@
 		handler = acpi_handlers[i];
 		if (handler->acpi_type == acpi_type) {
 			if (handler->remove (d, handler)) {
-				hotplug_event_end (end_token);
+				hal_util_callout_device_remove (d, acpi_callouts_remove_done, end_token);
 				goto out2;
 			}
 		}

Index: apm.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/apm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- apm.c	3 Feb 2005 00:24:42 -0000	1.1
+++ apm.c	8 Feb 2005 16:44:20 -0000	1.2
@@ -26,7 +26,6 @@
 
 #include <string.h>
 
-#include "../callout.h"
 #include "../device_info.h"
 #include "../logger.h"
 #include "../hald_dbus.h"
@@ -202,7 +201,8 @@
 
 	ret = TRUE;
 
-	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
+	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL &&
+	    (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
 		HAL_ERROR (("No computer object?"));
 		goto out;
 	}

Index: blockdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/blockdev.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- blockdev.c	18 Jan 2005 19:48:13 -0000	1.1
+++ blockdev.c	8 Feb 2005 16:44:20 -0000	1.2
@@ -45,7 +45,6 @@
 #include "../osspec.h"
 #include "../logger.h"
 #include "../hald.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 

Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- classdev.c	4 Feb 2005 05:24:25 -0000	1.8
+++ classdev.c	8 Feb 2005 16:44:20 -0000	1.9
@@ -62,7 +62,6 @@
 #include "../osspec.h"
 #include "../logger.h"
 #include "../hald.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 
@@ -536,7 +535,8 @@
 }
 
 static void 
-add_classdev_probing_helper_done(HalDevice *d, gboolean timed_out, gint return_code, gpointer data1, gpointer data2)
+add_classdev_probing_helper_done (HalDevice *d, gboolean timed_out, gint return_code, 
+				  gpointer data1, gpointer data2, HalHelperData *helper_data)
 {
 	void *end_token = (void *) data1;
 	ClassDevHandler *handler = (ClassDevHandler *) data2;
@@ -603,7 +603,9 @@
 				prober = NULL;
 			if (prober != NULL) {
 				/* probe the device */
-				if (!helper_invoke (prober, d, (gpointer) end_token, (gpointer) handler, add_classdev_probing_helper_done, HAL_HELPER_TIMEOUT)) {
+				if (hal_util_helper_invoke (prober, NULL, d, (gpointer) end_token, 
+							    (gpointer) handler, add_classdev_probing_helper_done, 
+							    HAL_HELPER_TIMEOUT) == NULL) {
 					hal_device_store_remove (hald_get_tdl (), d);
 					hotplug_event_end (end_token);
 				}

Index: coldplug.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/coldplug.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- coldplug.c	3 Feb 2005 00:21:51 -0000	1.6
+++ coldplug.c	8 Feb 2005 16:44:20 -0000	1.7
@@ -42,7 +42,6 @@
 #include "../osspec.h"
 #include "../logger.h"
 #include "../hald.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 

Index: hotplug.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/hotplug.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- hotplug.c	3 Feb 2005 04:13:46 -0000	1.7
+++ hotplug.c	8 Feb 2005 16:44:20 -0000	1.8
@@ -45,7 +45,6 @@
 #include "../osspec.h"
 #include "../logger.h"
 #include "../hald.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 

Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/osspec.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- osspec.c	3 Feb 2005 04:13:46 -0000	1.7
+++ osspec.c	8 Feb 2005 16:44:20 -0000	1.8
@@ -67,7 +67,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../hald_dbus.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 
@@ -450,6 +449,19 @@
 {
 }
 
+static void 
+computer_callouts_add_done (HalDevice *d, gpointer userdata)
+{
+	HAL_INFO (("Add callouts completed udi=%s", d->udi));
+
+	/* Move from temporary to global device store */
+	hal_device_store_remove (hald_get_tdl (), d);
+	hal_device_store_add (hald_get_gdl (), d);
+
+	/* start processing events */
+	hotplug_event_process_queue ();
+}
+
 void 
 osspec_probe (void)
 {
@@ -462,13 +474,9 @@
 	hal_device_property_set_string (root, "info.udi", "/org/freedesktop/Hal/devices/computer");
 	hal_device_set_udi (root, "/org/freedesktop/Hal/devices/computer");
 
+	/* Let computer be in TDL while synthesizing all other events because some may write to the object */
 	hal_device_store_add (hald_get_tdl (), root);
 
-	di_search_and_merge (root);
-
-	hal_device_store_remove (hald_get_tdl (), root);
-	hal_device_store_add (hald_get_gdl (), root);
-
 	/* will enqueue hotplug events for entire system */
 	HAL_INFO (("Synthesizing sysfs events..."));
 	coldplug_synthesize_events ();
@@ -484,8 +492,9 @@
 	}
 	HAL_INFO (("Done synthesizing events"));
 
-	/* start processing events */
-	hotplug_event_process_queue ();
+	di_search_and_merge (root);
+
+	hal_util_callout_device_add (root, computer_callouts_add_done, NULL);	
 
 	/*osspec_probe_done ();*/
 }

Index: physdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/physdev.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- physdev.c	2 Feb 2005 20:44:25 -0000	1.5
+++ physdev.c	8 Feb 2005 16:44:20 -0000	1.6
@@ -45,7 +45,6 @@
 #include "../osspec.h"
 #include "../logger.h"
 #include "../hald.h"
-#include "../callout.h"
 #include "../device_info.h"
 #include "../hald_conf.h"
 

Index: pmu.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/pmu.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pmu.c	3 Feb 2005 04:13:46 -0000	1.1
+++ pmu.c	8 Feb 2005 16:44:20 -0000	1.2
@@ -26,7 +26,6 @@
 
 #include <string.h>
 
-#include "../callout.h"
 #include "../device_info.h"
 #include "../logger.h"
 #include "../hald_dbus.h"
@@ -153,7 +152,8 @@
 
 	ret = TRUE;
 
-	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
+	if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL &&
+	    (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
 		HAL_ERROR (("No computer object?"));
 		goto out;
 	}

--- util.c DELETED ---

--- util.h DELETED ---




More information about the hal-commit mailing list