summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2007-06-06 14:22:05 +0100
committerRichard Hughes <richard@hughsie.com>2007-06-06 14:22:05 +0100
commit3455b5104bddca13e7ed5e7ec04e6fc4e8b5ac2e (patch)
treeb4ef62509282f2af28716a4096499928c1448b85
parent8670a01517bb33d046cfb6416de13c411e6a3f6c (diff)
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.
-rw-r--r--tools/hal-setup-keymap.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/hal-setup-keymap.c b/tools/hal-setup-keymap.c
index e9a6473f..c5be5f68 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, int keycode)
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);