From: mpi Date: Thu, 12 Jul 2018 07:58:23 +0000 (+0000) Subject: Instead of having a button for printing the driver(s) attached to a USB X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=48ef77341fedbbef958f32957eef2efbf11434e8;p=openbsd Instead of having a button for printing the driver(s) attached to a USB device, do it when invoked with '-v'. While here recycle '-d' to specify a specific device node, like pcidump(8) does. ok jca@, sthen@ --- diff --git a/usr.sbin/usbdevs/usbdevs.8 b/usr.sbin/usbdevs/usbdevs.8 index 405f56dbb6d..f17787fcc5c 100644 --- a/usr.sbin/usbdevs/usbdevs.8 +++ b/usr.sbin/usbdevs/usbdevs.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: usbdevs.8,v 1.11 2018/07/08 20:04:44 schwarze Exp $ +.\" $OpenBSD: usbdevs.8,v 1.12 2018/07/12 07:58:23 mpi Exp $ .\" $NetBSD: usbdevs.8,v 1.5 2000/10/15 12:44:11 bjh21 Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: July 8 2018 $ +.Dd $Mdocdate: July 12 2018 $ .Dt USBDEVS 8 .Os .Sh NAME @@ -36,22 +36,19 @@ .Nd show USB devices connected to the system .Sh SYNOPSIS .Nm -.Op Fl dv +.Op Fl v .Op Fl a Ar addr -.Op Fl f Ar dev +.Op Fl d Ar usbdev .Sh DESCRIPTION .Nm prints a listing of all USB devices connected to the system with some information about each device. -The indentation of each line indicates its distance from the root. .Pp The options are as follows: .Bl -tag -width Fl .It Fl a Ar addr Only print information about the device at the given address. -.It Fl d -Show the device drivers associated with each device. -.It Fl f Ar dev +.It Fl d Ar usbdev Only print information for the given USB controller. .It Fl v Be verbose. diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c index eddd5a3a0b1..1af7465c379 100644 --- a/usr.sbin/usbdevs/usbdevs.c +++ b/usr.sbin/usbdevs/usbdevs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.c,v 1.28 2018/07/10 09:18:36 mpi Exp $ */ +/* $OpenBSD: usbdevs.c,v 1.29 2018/07/12 07:58:23 mpi Exp $ */ /* $NetBSD: usbdevs.c,v 1.19 2002/02/21 00:34:31 christos Exp $ */ /* @@ -51,7 +51,6 @@ #define USBDEV "/dev/usb" int verbose = 0; -int showdevs = 0; void usage(void); void usbdev(int f, uint8_t); @@ -64,7 +63,7 @@ extern char *__progname; void usage(void) { - fprintf(stderr, "usage: %s [-dv] [-a addr] [-f dev]\n", __progname); + fprintf(stderr, "usage: %s [-v] [-a addr] [-d usbdev]\n", __progname); exit(1); } @@ -124,7 +123,7 @@ usbdev(int f, uint8_t addr) } printf("\n"); - if (showdevs) { + if (verbose) { for (i = 0; i < USB_MAX_DEVNAMES; i++) if (di.udi_devnames[i][0]) printf("\t driver: %s\n", di.udi_devnames[i]); @@ -238,7 +237,7 @@ main(int argc, char **argv) int addr = 0; int ncont; - while ((ch = getopt(argc, argv, "a:df:v?")) != -1) { + while ((ch = getopt(argc, argv, "a:d:v?")) != -1) { switch (ch) { case 'a': addr = strtonum(optarg, 1, USB_MAX_DEVICES, &errstr); @@ -246,9 +245,6 @@ main(int argc, char **argv) errx(1, "addr %s", errstr); break; case 'd': - showdevs = 1; - break; - case 'f': dev = optarg; break; case 'v':