hal/hald device_info.c,1.23,1.24

David Zeuthen david at freedesktop.org
Thu Feb 24 11:51:06 PST 2005


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

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

	* fdi/README: Change so this fits better with current packaging
	policies; see this message and thread at
	http://lists.freedesktop.org/archives/hal/2005-February/002217.html

	* fdi/preprobe/*/Makefile.am, fdi/information/*/Makefile.am,
 	fdi/policy/*/Makefile.am: Fix up Makefile.am to install to the
	correct location. Also add 10-ide-drives.fdi to

	* fdi/preprobe/10osvendor/Makefile.am (dist_fdi_DATA): Add 
	10-ide-drives.fdi

	* hald/device_info.c (di_search_and_merge): Use new search
	logic as outlined in fdi/README



Index: device_info.c
===================================================================
RCS file: /cvs/hal/hal/hald/device_info.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- device_info.c	24 Feb 2005 16:50:34 -0000	1.23
+++ device_info.c	24 Feb 2005 19:51:04 -0000	1.24
@@ -1309,7 +1309,7 @@
  *  @param  d                   Device to merge information into
  *  @return                     #TRUE if information was merged
  */
-static int
+static dbus_bool_t
 scan_fdi_files (const char *dir, HalDevice * d)
 {
 	int i;
@@ -1412,7 +1412,11 @@
 	static char *hal_fdi_source_preprobe = NULL;
 	static char *hal_fdi_source_information = NULL;
 	static char *hal_fdi_source_policy = NULL;
-	char *s;
+	dbus_bool_t ret;
+	char *s1;
+	char *s2;
+
+	ret = FALSE;
 
 	if (!have_checked_hal_fdi_source) {
 		hal_fdi_source_preprobe    = getenv ("HAL_FDI_SOURCE_PREPROBE");
@@ -1423,24 +1427,48 @@
 
 	switch (type) {
 	case DEVICE_INFO_TYPE_PREPROBE:
-		s = hal_fdi_source_preprobe != NULL ? hal_fdi_source_preprobe : PACKAGE_SYSCONF_DIR "/hal/preprobe";
+		if (hal_fdi_source_preprobe != NULL) {
+			s1 = hal_fdi_source_preprobe;
+			s2 = NULL;
+		} else {
+			s1 = PACKAGE_DATA_DIR "/hal/fdi/preprobe";
+			s2 = PACKAGE_SYSCONF_DIR "/hal/fdi/preprobe";
+		}
 		break;
 
 	case DEVICE_INFO_TYPE_INFORMATION:
-		s = hal_fdi_source_information != NULL ? hal_fdi_source_information : PACKAGE_DATA_DIR "/hal/fdi";
+		if (hal_fdi_source_preprobe != NULL) {
+			s1 = hal_fdi_source_preprobe;
+			s2 = NULL;
+		} else {
+			s1 = PACKAGE_DATA_DIR "/hal/fdi/information";
+			s2 = PACKAGE_SYSCONF_DIR "/hal/fdi/information";
+		}
 		break;
 
 	case DEVICE_INFO_TYPE_POLICY:
-		s = hal_fdi_source_policy != NULL ? hal_fdi_source_policy : PACKAGE_SYSCONF_DIR "/hal/policy";
+		if (hal_fdi_source_preprobe != NULL) {
+			s1 = hal_fdi_source_preprobe;
+			s2 = NULL;
+		} else {
+			s1 = PACKAGE_DATA_DIR "/hal/fdi/policy";
+			s2 = PACKAGE_SYSCONF_DIR "/hal/fdi/policy";
+		}
 		break;
 
 	default:
+		s1 = NULL;
+		s2 = NULL;
 		HAL_ERROR (("Bogus device information type %d", type));
-		return FALSE;
 		break;
 	}
 
-	return scan_fdi_files (s, d);
+	if (s1 != NULL)
+		ret = scan_fdi_files (s1, d) || ret;
+	if (s2 != NULL)
+		ret = scan_fdi_files (s2, d) || ret;
+
+	return ret;
 }
 
 /** @} */




More information about the hal-commit mailing list