diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-08-18 02:31:37 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-08-18 02:31:37 +0200 |
commit | 1aa0c52b4458be4cf6e55b2faf5c602761f5d3a3 (patch) | |
tree | e7784e684be2bf5c1e18ad8e7c00bf2b4994156b /udevinfo.c | |
parent | 554dde8e9a2e1e8bdf2816f04af985b227937c32 (diff) |
udevinfo: allow -a -n <node>
Diffstat (limited to 'udevinfo.c')
-rw-r--r-- | udevinfo.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/udevinfo.c b/udevinfo.c index e0ea5fb4ed..6b7368119f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -376,12 +376,22 @@ int main(int argc, char *argv[], char *envp[]) } break; case ACTION_ATTRIBUTE_WALK: - if (path[0] == '\0') { - fprintf(stderr, "attribute walk on device chain needs path(-p) specified\n"); - rc = 4; - goto exit; - } else + if (path[0] != '\0') { print_device_chain(path); + } else if (name[0] != '\0') { + char devpath[PATH_SIZE]; + + if (udev_db_lookup_name(name, devpath, sizeof(devpath)) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + print_device_chain(devpath); + } else { + fprintf(stderr, "attribute walk needs device path(-p) or node name(-n) specified\n"); + rc = 5; + goto exit; + } break; case ACTION_ROOT: printf("%s\n", udev_root); |