hal: Branch 'master'

Richard Hughes hughsient at kemper.freedesktop.org
Wed Jun 6 06:24:32 PDT 2007


 tools/hal-setup-keymap.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

New commits:
diff-tree 3455b5104bddca13e7ed5e7ec04e6fc4e8b5ac2e (from 8670a01517bb33d046cfb6416de13c411e6a3f6c)
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jun 6 14:22:05 2007 +0100

    make hal-setup-keymap.c use strerr rather than stdout
    
    Make the printfs in hal-setup-keymap.c use strerr rather than stdout
    so we can see them in the debug output.

diff --git a/tools/hal-setup-keymap.c b/tools/hal-setup-keymap.c
index e9a6473..c5be5f6 100644
--- a/tools/hal-setup-keymap.c
+++ b/tools/hal-setup-keymap.c
@@ -47,8 +47,8 @@ evdev_open (const char *dev)
 	/* requires root privs */
 	fd = open (dev, O_RDWR);
 	if (fd < 0) {
-		printf ("hal-setup-keymap: failed to open('%s'): %s\n",
-			dev, strerror (errno));
+		fprintf (stderr, "hal-setup-keymap: failed to open('%s'): %s\n",
+			 dev, strerror (errno));
 		return -1;
 	}
 
@@ -66,8 +66,8 @@ evdev_set_keycode (int fd, int scancode,
 
 	ret = ioctl (fd, EVIOCSKEYCODE, codes);
 	if (ret < 0) {
-		printf ("hal-setup-keymap: failed to set scancode %x to keycode %d: %s",
-			scancode, keycode, strerror(errno));
+		fprintf (stderr, "hal-setup-keymap: failed to set scancode %x to keycode %d: %s",
+			 scancode, keycode, strerror(errno));
 		return -1;
 	}
 
@@ -90,12 +90,12 @@ main (int argc, char **argv)
 
 	udi = getenv ("UDI");
 	if (udi == NULL) {
-		printf ("hal-setup-keymap: Failed to get UDI");
+		fprintf (stderr, "hal-setup-keymap: Failed to get UDI");
 		return 1;
 	}
 	dbus_error_init (&error);
 	if ((ctx = libhal_ctx_init_direct (&error)) == NULL) {
-		printf ("hal-setup-keymap: Unable to initialise libhal context: %s", error.message);
+		fprintf (stderr, "hal-setup-keymap: Unable to initialise libhal context: %s", error.message);
 		return 1;
 	}
 
@@ -108,21 +108,21 @@ main (int argc, char **argv)
 	dbus_error_init (&error);
 	keymap_list = libhal_device_get_property_strlist (ctx, udi, "input.keymap.data", &error);
 	if (dbus_error_is_set (&error) == TRUE) {
-		printf ("hal-setup-keymap: Failed to get keymap list: '%s'", error.message);
+		fprintf (stderr, "hal-setup-keymap: Failed to get keymap list: '%s'", error.message);
 		return 1;
 	}
 
 	/* get the device */
 	device = libhal_device_get_property_string (ctx, udi, "input.device", &error);
 	if (dbus_error_is_set (&error) == TRUE) {
-		printf ("hal-setup-keymap: Failed to get input device list: '%s'", error.message);
+		fprintf (stderr, "hal-setup-keymap: Failed to get input device list: '%s'", error.message);
 		return 1;
 	}
 
 	/* get a file descriptor to the device */
 	fd = evdev_open (device);
 	if (fd < 0) {
-		printf ("hal-setup-keymap: Could not open device");
+		fprintf (stderr, "hal-setup-keymap: Could not open device");
 		return 1;
 	}
 
@@ -134,14 +134,14 @@ main (int argc, char **argv)
 			name = lookup_key (keyname, strlen(keyname));
 			if (name != NULL) {
 				keycode = name->id;
-				printf ("hal-setup-keymap: parsed %s to (%x, %i)",
-					keymap_list[i], scancode, keycode);
+				fprintf (stderr, "hal-setup-keymap: parsed %s to (%x, %i)",
+					 keymap_list[i], scancode, keycode);
 				evdev_set_keycode (fd, scancode, keycode);
 			} else {
-				printf ("hal-setup-keymap: failed to find key '%s'", keyname);
+				fprintf (stderr, "hal-setup-keymap: failed to find key '%s'", keyname);
 			}
 		} else {
-			printf ("hal-setup-keymap: Failed to parse %s", keymap_list[i]);
+			fprintf (stderr, "hal-setup-keymap: Failed to parse %s", keymap_list[i]);
 		}
 	} while (keymap_list[i++] != NULL);
 


More information about the hal-commit mailing list