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.
This commit is contained in:
Warner Losh 2002-09-20 02:26:58 +00:00
parent 43832002d3
commit 7f156483af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103663
2 changed files with 13 additions and 5 deletions

View File

@ -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 ,

View File

@ -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]);
}
}