diff options
author | imp <imp@FreeBSD.org> | 2002-09-20 02:26:58 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2002-09-20 02:26:58 +0000 |
commit | 0cbffe62f832b942fad2decb207dcfbd3a47f69b (patch) | |
tree | fbbb6f70f013fd3dd390e68d7b045bdcd307dd9d /usr.sbin/devinfo | |
parent | a4260bf8f13b36400c592d22d847e493853de5eb (diff) | |
download | FreeBSD-src-0cbffe62f832b942fad2decb207dcfbd3a47f69b.zip FreeBSD-src-0cbffe62f832b942fad2decb207dcfbd3a47f69b.tar.gz |
o Don't print devices that aren't attached unless run with the newly
minted -v flag.
o Print devices that don't return a name as 'unknown' in -v mode.
# Yea! Now I wont think I have 10 different ISA network adapters in my
# laptop.
Diffstat (limited to 'usr.sbin/devinfo')
-rw-r--r-- | usr.sbin/devinfo/devinfo.8 | 6 | ||||
-rw-r--r-- | usr.sbin/devinfo/devinfo.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/devinfo/devinfo.8 b/usr.sbin/devinfo/devinfo.8 index 7ffa6d3..70976db 100644 --- a/usr.sbin/devinfo/devinfo.8 +++ b/usr.sbin/devinfo/devinfo.8 @@ -35,7 +35,7 @@ .Nd print information about system device configuration .Sh SYNOPSIS .Nm -.Op Fl ru +.Op Fl ruv .Sh DESCRIPTION The .Nm @@ -56,6 +56,10 @@ but sorts by resource type rather than by device, allowing to review the set of system resources by usage and available resources. I.e., it lists all the IRQ consumers together. +.It Fl v +Display all devices in the driver tree, not just those that are attached or +busy. +Without this flag, only those devices that have attached are reported. .El .Sh SEE ALSO .Xr systat 1 , diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c index c74de6c..091cd5e 100644 --- a/usr.sbin/devinfo/devinfo.c +++ b/usr.sbin/devinfo/devinfo.c @@ -38,6 +38,7 @@ #include "devinfo.h" int rflag; +int vflag; static void print_resource(struct devinfo_res *); static int print_device_matching_resource(struct devinfo_res *, void *); @@ -136,11 +137,11 @@ print_device(struct devinfo_dev *dev, void *arg) struct indent_arg ia; int i, indent; - if (dev->dd_name[0] != 0) { + if (vflag || (dev->dd_name[0] != 0 && dev->dd_state >= DIS_ATTACHED)) { indent = (int)(intptr_t)arg; for (i = 0; i < indent; i++) printf(" "); - printf("%s\n", dev->dd_name); + printf("%s\n", dev->dd_name[0] ? dev->dd_name : "unknown"); if (rflag) { ia.indent = indent + 4; ia.arg = dev; @@ -191,7 +192,7 @@ main(int argc, char *argv[]) int c, uflag; uflag = 0; - while ((c = getopt(argc, argv, "ru")) != -1) { + while ((c = getopt(argc, argv, "ruv")) != -1) { switch(c) { case 'r': rflag++; @@ -199,8 +200,11 @@ main(int argc, char *argv[]) case 'u': uflag++; break; + case 'v': + vflag++; + break; default: - errx(1, "usage: %s [-ru]", argv[0]); + errx(1, "usage: %s [-ruv]", argv[0]); } } |