hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Fri Jan 12 12:44:59 PST 2007


 hald/freebsd/hf-util.c |    8 ++++----
 hald/hald_dbus.c       |    4 ++--
 hald/linux/acpi.c      |    9 ++++-----
 hald/linux/apm.c       |   12 ++++++------
 hald/linux/device.c    |    8 ++++----
 hald/linux/pmu.c       |   12 ++++++------
 6 files changed, 26 insertions(+), 27 deletions(-)

New commits:
diff-tree 300bc55cab181b3e1437efeb68c62b960b612125 (from e8ab03c7230ff52adb6a8ef77f28e3dfcfda6037)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Fri Jan 12 21:41:55 2007 +0100

    Fix to guarantee that udi get generated before process FDI
    
    This fix change the existing workflow of HAL to guarantee that the UDI of
    a device get generated before start processing the FDI files.
    
    The problem is: in the most cases the udi of a device get generated fist
    after the policy and information FDI files get processed. Because of this
    you can't use FDI rules to match a special device udi (the udi of the
    device is something like '/org/freedesktop/Hal/devices/temp/100' until a
    correct udi get generated) e.g. to spawn a child device because the rule
    get never proccessed again for this device.
    
    To fix this I moved the generation of the udi before the calls to process
    the policy and information fdi-files. The mean also to move some
    hal_util_callout_device_add() calls (to process the FDI files after the
    call).
    
    This was tested for the linux backend and showed no adverse effects. The
    FreeBSD backend was also changed, but could not get tested.

diff --git a/hald/freebsd/hf-util.c b/hald/freebsd/hf-util.c
index ae9e149..b1d2916 100644
--- a/hald/freebsd/hf-util.c
+++ b/hald/freebsd/hf-util.c
@@ -146,15 +146,15 @@ hf_device_add (HalDevice *device)
 
   g_return_if_fail(HAL_IS_DEVICE(device));
 
-  /* process information and policy fdi files */
-  di_search_and_merge(device, DEVICE_INFO_TYPE_INFORMATION);
-  di_search_and_merge(device, DEVICE_INFO_TYPE_POLICY);
-
   /* run add callouts */
   hf_async_init(&async);
   hal_util_callout_device_add(device, hf_device_callout_done_cb, &async, NULL);
   hf_async_wait(&async);
 
+  /* process information and policy fdi files */
+  di_search_and_merge(device, DEVICE_INFO_TYPE_INFORMATION);
+  di_search_and_merge(device, DEVICE_INFO_TYPE_POLICY);
+  
   /* move from temporary to global device store */
   hal_device_store_remove(hald_get_tdl(), device);
   hal_device_store_add(hald_get_gdl(), device);
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 0608660..4c93ea3 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -2727,11 +2727,11 @@ manager_commit_preprobing_done (HalDevic
 		return;
 	}
 
+	hal_util_callout_device_add (d, manager_commit_done, NULL, NULL);
+	
 	/* Merge properties from .fdi files */
 	di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
 	di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
-
-	hal_util_callout_device_add (d, manager_commit_done, NULL, NULL);
 }
 
 
diff --git a/hald/linux/acpi.c b/hald/linux/acpi.c
index a7bae05..65ea78e 100644
--- a/hald/linux/acpi.c
+++ b/hald/linux/acpi.c
@@ -1260,11 +1260,6 @@ hotplug_event_begin_add_acpi (const gcha
 			/* Add to temporary device store */
 			hal_device_store_add (hald_get_tdl (), d);
 
-			/* 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, handler)) {
 				hal_device_store_remove (hald_get_tdl (), d);
@@ -1272,6 +1267,10 @@ hotplug_event_begin_add_acpi (const gcha
 				return;
 			}
 
+			/* Merge properties from .fdi files */
+			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
+			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
+			
 			/* Run callouts */
 			hal_util_callout_device_add (d, acpi_callouts_add_done, end_token, NULL);
 			return;
diff --git a/hald/linux/apm.c b/hald/linux/apm.c
index ae5873a..7e07219 100644
--- a/hald/linux/apm.c
+++ b/hald/linux/apm.c
@@ -418,12 +418,6 @@ hotplug_event_begin_add_apm (const gchar
 
 			/* Add to temporary device store */
 			hal_device_store_add (hald_get_tdl (), d);
-
-			/* Merge properties from .fdi files */
-			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
-			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
-
-			/* TODO: Run callouts */
 			
 			/* Compute UDI */
 			if (!handler->compute_udi (d, handler)) {
@@ -432,6 +426,12 @@ hotplug_event_begin_add_apm (const gchar
 				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);
+			
+			/* TODO: Run callouts */
+			
 			/* Move from temporary to global device store */
 			hal_device_store_remove (hald_get_tdl (), d);
 			hal_device_store_add (hald_get_gdl (), d);
diff --git a/hald/linux/device.c b/hald/linux/device.c
index adeee05..43f5d72 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -2716,10 +2716,6 @@ dev_callouts_remove_done (HalDevice *d, 
 static void 
 add_dev_after_probing (HalDevice *d, DevHandler *handler, void *end_token)
 {
-	/* 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);
@@ -2728,6 +2724,10 @@ add_dev_after_probing (HalDevice *d, Dev
 		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);
+	
 	/* TODO: Merge persistent properties */
 
 	/* Run callouts */
diff --git a/hald/linux/pmu.c b/hald/linux/pmu.c
index 3a174f0..734a1ca 100644
--- a/hald/linux/pmu.c
+++ b/hald/linux/pmu.c
@@ -499,12 +499,6 @@ hotplug_event_begin_add_pmu (const gchar
 			/* Add to temporary device store */
 			hal_device_store_add (hald_get_tdl (), d);
 
-			/* Merge properties from .fdi files */
-			di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
-			di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
-
-			/* TODO: Run callouts */
-			
 			/* Compute UDI */
 			if (!handler->compute_udi (d, handler)) {
 				hal_device_store_remove (hald_get_tdl (), d);
@@ -512,6 +506,12 @@ hotplug_event_begin_add_pmu (const gchar
 				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);
+
+			/* TODO: Run callouts */
+			
 			/* Move from temporary to global device store */
 			hal_device_store_remove (hald_get_tdl (), d);
 			hal_device_store_add (hald_get_gdl (), d);


More information about the hal-commit mailing list