hal/hald/linux2/probing probe-input.c,1.8,1.9

David Zeuthen david at freedesktop.org
Tue Aug 23 12:59:47 PDT 2005


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

Modified Files:
	probe-input.c 
Log Message:
2005-08-23  David Zeuthen  <davidz at redhat.com>

        * hald/linux2/probing/probe-input.c (main): Proper debug output
        for input class probe helper. Patch from Pierre Ossman
        <drzeus at drzeus.cx>.



Index: probe-input.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-input.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- probe-input.c	23 Aug 2005 08:26:14 -0000	1.8
+++ probe-input.c	23 Aug 2005 19:59:45 -0000	1.9
@@ -29,6 +29,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -38,6 +40,8 @@
 
 #include "libhal/libhal.h"
 
+#include "shared.h"
+
 #define test_bit(bit, array) (array[(bit) / 8] & (1 << ((bit) % 8)))
 
 static void 
@@ -158,18 +162,23 @@
 	if (device_file == NULL)
 		goto out;
 
-	fprintf(stderr, "*** handling %s\n", device_file);
+	if ((getenv ("HALD_VERBOSE")) != NULL)
+		is_verbose = TRUE;
 
+	dbg ("Doing probe-input for %s (udi=%s)",
+	     device_file, udi);
 
 	fd = open (device_file, O_RDONLY);
-	if (fd < 0)
+	if (fd < 0) {
+		dbg ("Cannot open %s: %s", device_file, strerror (errno));
 		goto out;
+	}
 
 	/* if we don't have a physical device then only accept input buses
 	 * that we now aren't hotpluggable
 	 */
 	if (ioctl (fd, EVIOCGID, &id) < 0) {
-		fprintf(stderr, "ioctl EVIOCGID failed\n");
+		dbg ("Error: EVIOCGID failed: %s\n", strerror(errno));
 		goto out;
 	}
 	physical_device = getenv ("HAL_PROP_INPUT_PHYSICAL_DEVICE");
@@ -186,7 +195,7 @@
 
 	/* only consider devices with the event interface */
 	if (ioctl (fd, EVIOCGNAME(sizeof (name)), name) < 0) {
-		fprintf(stderr, "ioctl EVIOCGNAME failed\n");
+		dbg ("Error: EVIOCGNAME failed: %s\n", strerror(errno));
 		goto out;
 	}
 	if (!libhal_device_set_property_string (ctx, udi, "info.product", name, &error))




More information about the hal-commit mailing list