hal/hald/linux2/probing probe-input.c, 1.15, 1.16 probe-pc-floppy.c, 1.7, 1.8 probe-printer.c, 1.8, 1.9 probe-serial.c, 1.2, 1.3 probe-smbios.c, 1.10, 1.11 probe-storage.c, 1.22, 1.23 probe-volume.c, 1.26, 1.27 shared.h, 1.4, 1.5

Danny Kukawka dkukawka at kemper.freedesktop.org
Tue May 9 13:34:40 PDT 2006


Update of /cvs/hal/hal/hald/linux2/probing
In directory kemper:/tmp/cvs-serv28920/hald/linux2/probing

Modified Files:
	probe-input.c probe-pc-floppy.c probe-printer.c probe-serial.c 
	probe-smbios.c probe-storage.c probe-volume.c shared.h 
Log Message:
2006-05-09  Danny Kukawka  <danny.kukawka at web.de>

        Added support for --use-syslog option to prober and addons. This
        should allow easy logging complete hal debug information to syslog
        if hald run in daemon mode:

        * hald/hald_runner.c: (add_basic_env): added HALD_USE_SYSLOG to env
        * hald/linux2/probing/shared.h: added support for HALD_USE_SYSLOG

        Replaced in prober and addons old debug code with support for
        --use-syslog instead of log to sterr.

        * hald/linux2/addons/addon-acpi.c: (main):
        * hald/linux2/addons/addon-hid-ups.c: (ups_get_string), (main):
        * hald/linux2/addons/addon-pmu.c: (main):
        * hald/linux2/addons/addon-storage.c: (main):
        * hald/linux2/addons/addon-usb-csr.c: (main):
        * hald/linux2/probing/probe-input.c: (main):
        * hald/linux2/probing/probe-pc-floppy.c: (main):
        * hald/linux2/probing/probe-printer.c: (main):
        * hald/linux2/probing/probe-serial.c: (main):
        * hald/linux2/probing/probe-smbios.c: (main): also fixed set debug
        option before use dbg() the first time
        * hald/linux2/probing/probe-storage.c: (main): replaced printf with
        dbg() and removed some needless debug lines.
        * hald/linux2/probing/probe-volume.c: (main):



Index: probe-input.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-input.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- probe-input.c	8 May 2006 14:47:05 -0000	1.15
+++ probe-input.c	9 May 2006 20:34:38 -0000	1.16
@@ -151,8 +151,7 @@
 	char name[128];
 	struct input_id id;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
+	_set_debug ();
 
 	fd = -1;
 

Index: probe-pc-floppy.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-pc-floppy.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- probe-pc-floppy.c	2 Nov 2005 15:38:14 -0000	1.7
+++ probe-pc-floppy.c	9 May 2006 20:34:38 -0000	1.8
@@ -66,9 +66,7 @@
 	if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL)
 		goto out;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
-	
+	_set_debug ();
 	
 	dbg ("Checking if %s is actually present", device_file);
 	

Index: probe-printer.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-printer.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- probe-printer.c	24 Apr 2006 17:48:57 -0000	1.8
+++ probe-printer.c	9 May 2006 20:34:38 -0000	1.9
@@ -76,9 +76,8 @@
 	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)
 		goto out;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
-
+	_set_debug ();
+	
 	device_file = getenv ("HAL_PROP_PRINTER_DEVICE");
 	if (device_file == NULL)
 		goto out;

Index: probe-serial.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-serial.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- probe-serial.c	2 Nov 2005 15:38:14 -0000	1.2
+++ probe-serial.c	9 May 2006 20:34:38 -0000	1.3
@@ -63,9 +63,7 @@
 	if ((device_file = getenv ("HAL_PROP_SERIAL_DEVICE")) == NULL)
 		goto out;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
-	
+	_set_debug ();
 	
 	dbg ("Checking if %s is actually present", device_file);
 	

Index: probe-smbios.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-smbios.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- probe-smbios.c	9 May 2006 20:31:30 -0000	1.10
+++ probe-smbios.c	9 May 2006 20:34:38 -0000	1.11
@@ -104,15 +104,14 @@
 	/* assume failure */
 	ret = 1;
 
+	_set_debug ();
+	
 	udi = getenv ("UDI");
 	if (udi == NULL) {
 		dbg ("UDI not set");
 		goto out;
 	}
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
-
 	dbus_error_init (&error);
 	if ((ctx = libhal_ctx_init_direct (&error)) == NULL) {
 		dbg ("ctx init failed");

Index: probe-storage.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-storage.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- probe-storage.c	9 May 2006 20:28:00 -0000	1.22
+++ probe-storage.c	9 May 2006 20:34:38 -0000	1.23
@@ -144,8 +144,7 @@
 	if ((drive_type = getenv ("HAL_PROP_STORAGE_DRIVE_TYPE")) == NULL)
 		goto out;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
+	_set_debug ();
 
 	if (argc == 2 && strcmp (argv[1], "--only-check-for-media") == 0)
 		only_check_for_fs = TRUE;

Index: probe-volume.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/probe-volume.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- probe-volume.c	22 Feb 2006 21:27:52 -0000	1.26
+++ probe-volume.c	9 May 2006 20:34:38 -0000	1.27
@@ -327,8 +327,7 @@
 	else
 		is_disc = FALSE;
 
-	if ((getenv ("HALD_VERBOSE")) != NULL)
-		is_verbose = TRUE;
+	_set_debug ();
 
 	dbus_error_init (&error);
 	if ((ctx = libhal_ctx_init_direct (&error)) == NULL)

Index: shared.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/probing/shared.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- shared.h	22 Feb 2006 21:10:06 -0000	1.4
+++ shared.h	9 May 2006 20:34:38 -0000	1.5
@@ -8,11 +8,13 @@
 #include <grp.h>
 
 #include <sys/types.h>
+#include <sys/syslog.h>
 #include <unistd.h>
 #include <pwd.h>
 #include <grp.h>
 
 static dbus_bool_t is_verbose = FALSE;
+static dbus_bool_t use_syslog = FALSE;
 
 static void
 _do_dbg (const char *format, va_list args)
@@ -36,7 +38,10 @@
 	tlocaltime = localtime (&tnow.tv_sec);
 	strftime (tbuf, sizeof (tbuf), "%H:%M:%S", tlocaltime);
 
-	fprintf (stderr, "%d: %s.%03d: %s", pid, tbuf, (int)(tnow.tv_usec/1000), buf);
+	if (use_syslog)
+		syslog (LOG_INFO, "%d: %s.%03d: %s", pid, tbuf, (int)(tnow.tv_usec/1000), buf);
+	else
+		fprintf (stderr, "%d: %s.%03d: %s", pid, tbuf, (int)(tnow.tv_usec/1000), buf);
 
 	va_end (args);
 }
@@ -49,6 +54,16 @@
 	_do_dbg (format, args);
 }
 
+static void
+_set_debug ()
+{
+        if ((getenv ("HALD_VERBOSE")) != NULL)
+                is_verbose = TRUE;
+
+        if ((getenv ("HALD_USE_SYSLOG")) != NULL)
+                use_syslog = TRUE;
+}
+
 #define dbg(format, arg...)							\
 	do {									\
 		_dbg ("%s:%d: " format "\n", __FILE__, __LINE__, ## arg); \




More information about the hal-commit mailing list