hal/hald/linux2 acpi.c, 1.7, 1.8 apm.c, 1.4, 1.5 blockdev.c, 1.6, 1.7 classdev.c, 1.14, 1.15 coldplug.c, 1.8, 1.9 hotplug.c, 1.11, 1.12 osspec.c, 1.16, 1.17 physdev.c, 1.7, 1.8 pmu.c, 1.4, 1.5

David Zeuthen david at freedesktop.org
Thu Feb 24 08:50:37 PST 2005


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

Modified Files:
	acpi.c apm.c blockdev.c classdev.c coldplug.c hotplug.c 
	osspec.c physdev.c pmu.c 
Log Message:
2005-02-24  David Zeuthen  <davidz at redhat.com>

	* tools/linux/hal_hotplug_map.c: Removed

	* tools/linux/Makefile.am: Remove build rules for hal-hotplug-map

	* hald/linux2/physdev.c: Callouts now take two userdata pointers
	(physdev_callouts_preprobing_done): New function
	(hotplug_event_begin_add_physdev): Run preprobing callouts
	just before real probing (flow continues in the above function)

	* hald/linux2/osspec.c: Callouts now take two userdata pointers

	* hald/linux2/classdev.c: Callouts now take two userdata pointers
	(classdev_callouts_preprobing_done): New function
	(hotplug_event_begin_add_classdev): Run preprobing callouts
	just before real probing (flow continues in the above function)

	* hald/linux2/blockdev.c: Callouts now take two userdata pointers
	(blockdev_callouts_preprobing_storage_done): New function
	(blockdev_callouts_preprobing_volume_done): New function
	(hotplug_event_begin_add_blockdev): Run preprobing callouts just
	before real probing (flow continues in the two above
	functions)

	* hald/linux2/apm.c: Callouts now take two userdata pointers

	* hald/linux2/acpi.c: Callouts now take two userdata pointers

	* hald/util.h: Fix up prototypes for callouts to take two userdata
	pointers. Add hal_util_callout_device_preprobe prototype.

	* hald/util.c: Change callouts to take two userdata pointers
	(hal_util_callout_device_preprobe): New function

	* hald/hald.c (main): Don't call hald_read_conf_file() as this
	is now gone.

	* hald/device_info.h (di_search_and_merge): Tweak prototype for
	di_search_and_merge to take a DeviceInfoType parameter

	* hald/device_info.c (di_search_and_merge): Lookup new environment
	variables

	* hald/run-hald.sh: Use new environment variables for specifying
	fdi file location

	* hald/debug-hald.sh: Use new environment variables for specifying
	fdi file location

	* hald/Makefile.am: Don't link with libselinux and don't install
	callout directories
	(hald_test_SOURCES): Remove hald_conf.[ch]
	(hald_SOURCES): Remove hald_conf.[ch].

	* configure.in: Add notes about how to tweak the hal tarball for a
	particular distribution or OS. Rework the details a bit. Remove the
	hotplug_map rules. Remove selinux bits (for now). Rework what fdi
	file directory Makefile's to generate.

	* hald/hald.conf: Removed

	* hald/hald_conf.[ch]: Removed

	* fdi/Makefile.am (SUBDIRS): Specificy new subdirs

	* fdi/preprobe: New

	* fdi/preprobe/Makefile.am: New

	* fdi/preprobe/10osvendor: New

	* fdi/preprobe/10osvendor/10-ide-drives.fdi: New

	* fdi/preprobe/10osvendor/Makefile.am: New

	* fdi/preprobe/20thirdparty: New

	* fdi/preprobe/20thirdparty/Makefile.am: New

	* fdi/preprobe/30user: New

	* fdi/preprobe/30user/Makefile.am: New

	* fdi/information: New

	* fdi/information/Makefile.am: New

	* fdi/information/10freedesktop: New

	* fdi/information/10freedesktop/Makefile.am: New

	* fdi/information/20thirdparty: New

	* fdi/information/20thirdparty/Makefile.am: New

	* fdi/information/30user: New

	* fdi/information/30user/Makefile.am: New

	* fdi/policy: New

	* fdi/policy/Makefile.am: New

	* fdi/policy/10osvendor: New

	* fdi/policy/10osvendor/10-storage-policy.fdi: New

	* fdi/policy/10osvendor/10-power-mgmt-policy.fdi: New

	* fdi/policy/10osvendor/90-fstab-sync.fdi: New

	* fdi/policy/10osvendor/Makefile.am: New

	* fdi/policy/20thirdparty: New

	* fdi/policy/20thirdparty/Makefile.am: New

	* fdi/policy/30user: New

	* fdi/policy/30user/Makefile.am: New

	* fdi/README: New file to describe the new directory structure



Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- acpi.c	8 Feb 2005 22:36:58 -0000	1.7
+++ acpi.c	24 Feb 2005 16:50:34 -0000	1.8
@@ -319,9 +319,9 @@
 };
 
 static void 
-acpi_callouts_add_done (HalDevice *d, gpointer userdata)
+acpi_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Add callouts completed udi=%s", d->udi));
 
@@ -333,9 +333,9 @@
 }
 
 static void 
-acpi_callouts_remove_done (HalDevice *d, gpointer userdata)
+acpi_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
 
@@ -373,7 +373,8 @@
 			hal_device_store_add (hald_get_tdl (), d);
 
 			/* Merge properties from .fdi files */
-			di_search_and_merge (d);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
 
 			
 			/* Compute UDI */
@@ -384,7 +385,7 @@
 			}
 
 			/* Run callouts */
-			hal_util_callout_device_add (d, acpi_callouts_add_done, end_token);
+			hal_util_callout_device_add (d, acpi_callouts_add_done, end_token, NULL);
 			goto out;
 		}
 	}
@@ -415,7 +416,7 @@
 		handler = acpi_handlers[i];
 		if (handler->acpi_type == acpi_type) {
 			if (handler->remove (d, handler)) {
-				hal_util_callout_device_remove (d, acpi_callouts_remove_done, end_token);
+				hal_util_callout_device_remove (d, acpi_callouts_remove_done, end_token, NULL);
 				goto out2;
 			}
 		}

Index: apm.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/apm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- apm.c	9 Feb 2005 00:56:38 -0000	1.4
+++ apm.c	24 Feb 2005 16:50:35 -0000	1.5
@@ -322,7 +322,8 @@
 			hal_device_store_add (hald_get_tdl (), d);
 
 			/* Merge properties from .fdi files */
-			di_search_and_merge (d);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
 
 			/* TODO: Run callouts */
 			

Index: blockdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/blockdev.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- blockdev.c	23 Feb 2005 18:25:43 -0000	1.6
+++ blockdev.c	24 Feb 2005 16:50:35 -0000	1.7
@@ -57,7 +57,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 #include "../hald_dbus.h"
 
 #include "osspec_linux.h"
@@ -126,9 +125,9 @@
 
 
 static void 
-blockdev_callouts_add_done (HalDevice *d, gpointer userdata)
+blockdev_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Add callouts completed udi=%s", d->udi));
 
@@ -140,9 +139,9 @@
 }
 
 static void 
-blockdev_callouts_remove_done (HalDevice *d, gpointer userdata)
+blockdev_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
 
@@ -290,12 +289,13 @@
 	}
 
 	/* Merge properties from .fdi files */
-	di_search_and_merge (d);
+	di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+	di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
 	
 	/* TODO: Merge persistent properties */
 
 	/* Run callouts */
-	hal_util_callout_device_add (d, blockdev_callouts_add_done, end_token);
+	hal_util_callout_device_add (d, blockdev_callouts_add_done, end_token, NULL);
 
 	/* Yay, got a file system on the main block device...
 	 *
@@ -310,6 +310,84 @@
 	;
 }
 
+static void 
+blockdev_callouts_preprobing_storage_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
+{
+	void *end_token = (void *) userdata1;
+
+	if (hal_device_property_get_bool (d, "info.ignore")) {
+		/* Leave the device here with info.ignore==TRUE so we won't pick up children 
+		 * Also remove category and all capabilities
+		 */
+		hal_device_property_remove (d, "info.category");
+		hal_device_property_remove (d, "info.capabilities");
+		hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
+		hal_device_property_set_string (d, "info.product", "Ignored Device");
+
+		HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+		
+		/* 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);
+		goto out;
+	}
+
+	/* run prober for 
+	 *
+	 *  - drive_id
+	 *  - cdrom drive properties
+	 *  - non-partitioned filesystem on main block device
+	 */
+	
+	/* probe the device */
+	if (hal_util_helper_invoke ("hald-probe-storage", NULL, d, (gpointer) end_token, 
+				    NULL, add_blockdev_probing_helper_done, 
+				    HAL_HELPER_TIMEOUT) == NULL) {
+		hal_device_store_remove (hald_get_tdl (), d);
+		hotplug_event_end (end_token);
+	}
+
+out:
+	;
+}
+
+static void 
+blockdev_callouts_preprobing_volume_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
+{
+	void *end_token = (void *) userdata1;
+
+	if (hal_device_property_get_bool (d, "info.ignore")) {
+		/* Leave the device here with info.ignore==TRUE so we won't pick up children 
+		 * Also remove category and all capabilities
+		 */
+		hal_device_property_remove (d, "info.category");
+		hal_device_property_remove (d, "info.capabilities");
+		hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
+		hal_device_property_set_string (d, "info.product", "Ignored Device");
+
+		HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+		
+		/* 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);
+		goto out;
+	}
+
+	/* probe the device */
+	if (hal_util_helper_invoke ("hald-probe-volume", NULL, d, (gpointer) end_token, 
+				    NULL, add_blockdev_probing_helper_done, 
+				    HAL_HELPER_TIMEOUT) == NULL) {
+		hal_device_store_remove (hald_get_tdl (), d);
+		hotplug_event_end (end_token);
+	}
+
+out:
+	;
+}
 
 
 void
@@ -320,11 +398,16 @@
 	HalDevice *d;
 	unsigned int major, minor;
 	gboolean is_fakevolume;
-	char *sysfs_path_real;
+	char *sysfs_path_real = NULL;
 
 	HAL_INFO (("block_add: sysfs_path=%s dev=%s is_part=%d, parent=0x%08x", 
 		   sysfs_path, device_file, is_partition, parent));
 
+	if (parent != NULL && hal_device_property_get_bool (parent, "info.ignore")) {
+		HAL_INFO (("Ignoring block_add since parent has info.ignore==TRUE"));
+		goto out;
+	}
+
 	if (strcmp (hal_util_get_last_element (sysfs_path), "fakevolume") == 0) {
 		is_fakevolume = TRUE;
 		sysfs_path_real = hal_util_get_parent_path (sysfs_path);
@@ -576,23 +659,14 @@
 		hal_device_property_set_bool (d, "storage.requires_eject", requires_eject);
 		hal_device_property_set_bool (d, "storage.no_partitions_hint", no_partitions_hint);
 
-		/* add to TDL so prober can access it */
+		/* add to TDL so preprobing callouts and prober can access it */
 		hal_device_store_add (hald_get_tdl (), d);
 
-		/* TODO: run prober for 
-		 *
-		 *  - drive_id
-		 *  - cdrom drive properties
-		 *  - non-partitioned filesystem on main block device
-		 */
+		/* Process preprobe fdi files */
+		di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
 
-		/* probe the device */
-		if (hal_util_helper_invoke ("hald-probe-storage", NULL, d, (gpointer) end_token, 
-					    NULL, add_blockdev_probing_helper_done, 
-					    HAL_HELPER_TIMEOUT) == NULL) {
-			hal_device_store_remove (hald_get_tdl (), d);
-			goto error;
-		}
+		/* Run preprobe callouts */
+		hal_util_callout_device_preprobe (d, blockdev_callouts_preprobing_storage_done, end_token, NULL);
 
 	} else {
 		guint sysfs_path_len;
@@ -655,16 +729,14 @@
 			((dbus_uint64_t)(512)) * 
 			((dbus_uint64_t)(hal_device_property_set_int (d, "volume.block_size", 512))));
 
-		/* add to TDL so prober can access it */
+		/* add to TDL so preprobing callouts and prober can access it */
 		hal_device_store_add (hald_get_tdl (), d);
 
-		/* probe the device */
-		if (hal_util_helper_invoke ("hald-probe-volume", NULL, d, (gpointer) end_token, 
-					    NULL, add_blockdev_probing_helper_done, 
-					    HAL_HELPER_TIMEOUT) == NULL) {
-			hal_device_store_remove (hald_get_tdl (), d);
-			goto error;
-		}
+		/* Process preprobe fdi files */
+		di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
+
+		/* Run preprobe callouts */
+		hal_util_callout_device_preprobe (d, blockdev_callouts_preprobing_volume_done, end_token, NULL);
 	}
 
 	g_free (sysfs_path_real);
@@ -675,7 +747,6 @@
 		g_object_unref (d);
 out:
 	hotplug_event_end (end_token);
-
 	g_free (sysfs_path_real);
 }
 
@@ -875,7 +946,7 @@
 			force_unmount (d);
 		}
 
-		hal_util_callout_device_remove (d, blockdev_callouts_remove_done, end_token);
+		hal_util_callout_device_remove (d, blockdev_callouts_remove_done, end_token, NULL);
 	}
 out:
 	;

Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- classdev.c	22 Feb 2005 20:51:30 -0000	1.14
+++ classdev.c	24 Feb 2005 16:50:35 -0000	1.15
@@ -63,7 +63,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 
 #include "osspec_linux.h"
 
@@ -424,7 +423,7 @@
 		hal_device_set_udi (d, udi);
 		hal_device_property_set_string (d, "info.udi", udi);
 	} else if (hal_device_has_capability (d, "printer")) {
-		char *serial;
+		const char *serial;
 
 		serial = hal_device_property_get_string (d, "printer.serial");
 		hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
@@ -525,9 +524,9 @@
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static void 
-classdev_callouts_add_done (HalDevice *d, gpointer userdata)
+classdev_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Add callouts completed udi=%s", d->udi));
 
@@ -539,9 +538,9 @@
 }
 
 static void 
-classdev_callouts_remove_done (HalDevice *d, gpointer userdata)
+classdev_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
 
@@ -556,7 +555,8 @@
 add_classdev_after_probing (HalDevice *d, ClassDevHandler *handler, void *end_token)
 {
 	/* Merge properties from .fdi files */
-	di_search_and_merge (d);
+	di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+	di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
 
 	/* Compute UDI */
 	if (!handler->compute_udi (d)) {
@@ -568,7 +568,7 @@
 	/* TODO: Merge persistent properties */
 
 	/* Run callouts */
-	hal_util_callout_device_add (d, classdev_callouts_add_done, end_token);
+	hal_util_callout_device_add (d, classdev_callouts_add_done, end_token, NULL);
 
 out:
 	;
@@ -604,6 +604,53 @@
 	;
 }
 
+static void 
+classdev_callouts_preprobing_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
+{
+	void *end_token = (void *) userdata1;
+	ClassDevHandler *handler = (ClassDevHandler *) userdata2;
+	const gchar *prober;
+
+	if (hal_device_property_get_bool (d, "info.ignore")) {
+		/* Leave the device here with info.ignore==TRUE so we won't pick up children 
+		 * Also remove category and all capabilities
+		 */
+		hal_device_property_remove (d, "info.category");
+		hal_device_property_remove (d, "info.capabilities");
+		hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
+		hal_device_property_set_string (d, "info.product", "Ignored Device");
+
+		HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+		
+		/* 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);
+		goto out;
+	}
+	
+	if (handler->get_prober != NULL)
+		prober = handler->get_prober (d);
+	else
+		prober = NULL;
+	if (prober != NULL) {
+		/* probe the device */
+		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);
+		}
+		goto out;
+	} else {
+		add_classdev_after_probing (d, handler, end_token);
+		goto out;
+	}
+out:
+	;
+}
+
 void
 hotplug_event_begin_add_classdev (const gchar *subsystem, const gchar *sysfs_path, const gchar *device_file, 
 				  HalDevice *physdev, const gchar *sysfs_path_in_devices, void *end_token)
@@ -612,13 +659,18 @@
 
 	HAL_INFO (("class_add: subsys=%s sysfs_path=%s dev=%s physdev=0x%08x", subsystem, sysfs_path, device_file, physdev));
 
+	if (physdev != NULL && hal_device_property_get_bool (physdev, "info.ignore")) {
+		HAL_INFO (("Ignoring class_add since physdev has info.ignore==TRUE"));
+		hotplug_event_end (end_token);
+		goto out;
+	}
+
 	for (i = 0; classdev_handlers [i] != NULL; i++) {
 		ClassDevHandler *handler;
 
 		handler = classdev_handlers[i];
 		if (strcmp (handler->subsystem, subsystem) == 0) {
 			HalDevice *d;
-			const gchar *prober;
 
 			/* attempt to add the device */
 			d = handler->add (sysfs_path, device_file, physdev, sysfs_path_in_devices);
@@ -637,23 +689,12 @@
 			/* Add to temporary device store */
 			hal_device_store_add (hald_get_tdl (), d);
 
-			if (handler->get_prober != NULL)
-				prober = handler->get_prober (d);
-			else
-				prober = NULL;
-			if (prober != NULL) {
-				/* probe the device */
-				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);
-				}
-				goto out;
-			} else {
-				add_classdev_after_probing (d, handler, end_token);
-				goto out;
-			}				
+			/* Process preprobe fdi files */
+			di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
+
+			/* Run preprobe callouts */
+			hal_util_callout_device_preprobe (d, classdev_callouts_preprobing_done, end_token, handler);
+			goto out;
 		}
 	}
 
@@ -684,7 +725,7 @@
 			if (strcmp (handler->subsystem, subsystem) == 0) {
 				handler->remove (d);
 
-				hal_util_callout_device_remove (d, classdev_callouts_remove_done, end_token);
+				hal_util_callout_device_remove (d, classdev_callouts_remove_done, end_token, NULL);
 				goto out;
 			}
 		}

Index: coldplug.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/coldplug.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- coldplug.c	8 Feb 2005 22:36:58 -0000	1.8
+++ coldplug.c	24 Feb 2005 16:50:35 -0000	1.9
@@ -43,7 +43,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 
 #include "osspec_linux.h"
 

Index: hotplug.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/hotplug.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- hotplug.c	11 Feb 2005 22:01:08 -0000	1.11
+++ hotplug.c	24 Feb 2005 16:50:35 -0000	1.12
@@ -46,7 +46,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 
 #include "osspec_linux.h"
 

Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/osspec.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- osspec.c	23 Feb 2005 03:03:12 -0000	1.16
+++ osspec.c	24 Feb 2005 16:50:35 -0000	1.17
@@ -71,7 +71,6 @@
 #include "../hald.h"
 #include "../hald_dbus.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 
 #include "util.h"
 #include "hotplug.h"
@@ -347,7 +346,7 @@
 }
 
 static void 
-computer_callouts_add_done (HalDevice *d, gpointer userdata)
+computer_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
 	HAL_INFO (("Add callouts completed udi=%s", d->udi));
 
@@ -389,9 +388,10 @@
 	}
 	HAL_INFO (("Done synthesizing events"));
 
-	di_search_and_merge (root);
+	di_search_and_merge (root, DEVICE_INFO_TYPE_INFORMATION);
+	di_search_and_merge (root, DEVICE_INFO_TYPE_POLICY);
 
-	hal_util_callout_device_add (root, computer_callouts_add_done, NULL);	
+	hal_util_callout_device_add (root, computer_callouts_add_done, NULL, NULL);
 
 	/*osspec_probe_done ();*/
 }

Index: physdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/physdev.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- physdev.c	8 Feb 2005 20:11:05 -0000	1.7
+++ physdev.c	24 Feb 2005 16:50:35 -0000	1.8
@@ -46,7 +46,6 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../device_info.h"
-#include "../hald_conf.h"
 
 #include "util.h"
 #include "coldplug.h"
@@ -830,9 +829,9 @@
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static void 
-physdev_callouts_add_done (HalDevice *d, gpointer userdata)
+physdev_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Add callouts completed udi=%s", d->udi));
 
@@ -844,9 +843,9 @@
 }
 
 static void 
-physdev_callouts_remove_done (HalDevice *d, gpointer userdata)
+physdev_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
 {
-	void *end_token = (void *) userdata;
+	void *end_token = (void *) userdata1;
 
 	HAL_INFO (("Remove callouts completed udi=%s", d->udi));
 
@@ -857,6 +856,51 @@
 	hotplug_event_end (end_token);
 }
 
+
+static void 
+physdev_callouts_preprobing_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
+{
+	void *end_token = (void *) userdata1;
+	PhysDevHandler *handler = (PhysDevHandler *) userdata2;
+
+	if (hal_device_property_get_bool (d, "info.ignore")) {
+		/* Leave the device here with info.ignore==TRUE so we won't pick up children 
+		 * Also remove category and all capabilities
+		 */
+		hal_device_property_remove (d, "info.category");
+		hal_device_property_remove (d, "info.capabilities");
+		hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
+		hal_device_property_set_string (d, "info.product", "Ignored Device");
+		
+		HAL_INFO (("Preprobing merged info.ignore==TRUE"));
+		
+		/* 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);
+		goto out;
+	}
+	
+	
+	/* Merge properties from .fdi files */
+	di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+	di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
+	
+	/* Compute UDI */
+	if (!handler->compute_udi (d)) {
+		hal_device_store_remove (hald_get_tdl (), d);
+		hotplug_event_end (end_token);
+		goto out;
+	}
+	
+	/* Run callouts */
+	hal_util_callout_device_add (d, physdev_callouts_add_done, end_token, NULL);
+
+out:
+	;
+}
+
 void
 hotplug_event_begin_add_physdev (const gchar *subsystem, const gchar *sysfs_path, HalDevice *parent, void *end_token)
 {
@@ -864,6 +908,12 @@
 
 	HAL_INFO (("phys_add: subsys=%s sysfs_path=%s, parent=0x%08x", subsystem, sysfs_path, parent));
 
+	if (parent != NULL && hal_device_property_get_bool (parent, "info.ignore")) {
+		HAL_INFO (("Ignoring phys_add since parent has info.ignore==TRUE"));
+		hotplug_event_end (end_token);
+		goto out;
+	}
+
 	for (i = 0; phys_handlers [i] != NULL; i++) {
 		PhysDevHandler *handler;
 
@@ -884,18 +934,11 @@
 			/* Add to temporary device store */
 			hal_device_store_add (hald_get_tdl (), d);
 
-			/* Merge properties from .fdi files */
-			di_search_and_merge (d);
-
-			/* Compute UDI */
-			if (!handler->compute_udi (d)) {
-				hal_device_store_remove (hald_get_tdl (), d);
-				hotplug_event_end (end_token);
-				goto out;
-			}
+			/* Process preprobe fdi files */
+			di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
 
-			/* Run callouts */
-			hal_util_callout_device_add (d, physdev_callouts_add_done, end_token);
+			/* Run preprobe callouts */
+			hal_util_callout_device_preprobe (d, physdev_callouts_preprobing_done, end_token, handler);
 			goto out;
 		}
 	}
@@ -929,7 +972,7 @@
 		if (strcmp (handler->subsystem, subsystem) == 0) {
 			handler->remove (d);
 			
-			hal_util_callout_device_remove (d, physdev_callouts_remove_done, end_token);
+			hal_util_callout_device_remove (d, physdev_callouts_remove_done, end_token, NULL);
 			goto out2;
 		}
 	}

Index: pmu.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/pmu.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pmu.c	9 Feb 2005 00:56:38 -0000	1.4
+++ pmu.c	24 Feb 2005 16:50:35 -0000	1.5
@@ -300,7 +300,8 @@
 			hal_device_store_add (hald_get_tdl (), d);
 
 			/* Merge properties from .fdi files */
-			di_search_and_merge (d);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
 
 			/* TODO: Run callouts */
 			




More information about the hal-commit mailing list