summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-08-18 02:31:37 +0200
committerKay Sievers <kay.sievers@suse.de>2006-08-18 02:31:37 +0200
commit1aa0c52b4458be4cf6e55b2faf5c602761f5d3a3 (patch)
treee7784e684be2bf5c1e18ad8e7c00bf2b4994156b
parent554dde8e9a2e1e8bdf2816f04af985b227937c32 (diff)
udevinfo: allow -a -n <node>
-rw-r--r--udevinfo.c20
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);