hal: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Fri Aug 31 13:59:17 PDT 2007
tools/hal-disable-polling.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
New commits:
diff-tree fcb9ac034c674cbe10cfe89aad5637fee8e55a5d (from d8651578ff433dac884a349382388644a34ea69e)
Author: Doug Goldstein <cardoe at gentoo.org>
Date: Fri Aug 31 14:54:46 2007 -0400
hal-disable-polling symlink support
allows hal-disable-polling to take a device node that's actually a symlink to
real device node and successfully resolve it and use it rather then error out
with device not found.
diff --git a/tools/hal-disable-polling.c b/tools/hal-disable-polling.c
index 44d886c..b47737d 100644
--- a/tools/hal-disable-polling.c
+++ b/tools/hal-disable-polling.c
@@ -76,7 +76,7 @@ int
main (int argc, char *argv[])
{
char *udi = NULL;
- char *device = NULL;
+ char *device = NULL, *real_device;
dbus_bool_t is_version = FALSE;
dbus_bool_t enable_polling = FALSE;
DBusError error;
@@ -178,9 +178,23 @@ main (int argc, char *argv[])
int n;
devices = libhal_manager_find_device_string_match (hal_ctx, "block.device", device, &num_devices, NULL);
- if (devices == NULL) {
- fprintf (stderr, "Cannot find device %s.\n", device);
- return 1;
+ if (devices == NULL || devices[0] == NULL) {
+ real_device = realpath(device, NULL);
+ if (real_device == NULL) {
+ fprintf (stderr, "Cannot find device %s.\n", device);
+ return 1;
+ }
+
+ devices = libhal_manager_find_device_string_match (hal_ctx, "block.device", real_device,
+ &num_devices, NULL);
+
+ if (devices == NULL) {
+ fprintf (stderr, "Cannot find symlinked device %s -> %s.\n", device, real_device);
+ return 1;
+ }
+
+ fprintf (stderr, "Following symlink from %s to %s.\n", device, real_device);
+ free(real_device);
}
for (n = 0; devices[n] != NULL; n++) {
More information about the hal-commit
mailing list