From 0cbffe62f832b942fad2decb207dcfbd3a47f69b Mon Sep 17 00:00:00 2001 From: imp Date: Fri, 20 Sep 2002 02:26:58 +0000 Subject: 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. --- usr.sbin/devinfo/devinfo.8 | 6 +++++- usr.sbin/devinfo/devinfo.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'usr.sbin/devinfo') 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]); } } -- cgit v1.1