Instead of having a button for printing the driver(s) attached to a USB device, do it when invoked with '-v'. This allows me to recycle '-d'.
I'm now using it, like pcidump(8) does, to specify a specific device node. My plan is then to use '-f' to force a device to attach as ugen(4). In that case the output would be: $ usbdevs -v ... addr 02: 04f2:b45d Chicony Electronics Co.,Ltd., Integrated Camera high speed, power 500 mA, config 1, rev 0.29, iSerialNumber 0x0001 driver: ugen0 (forced) ok? Index: usbdevs.8 =================================================================== RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.8,v retrieving revision 1.11 diff -u -p -r1.11 usbdevs.8 --- usbdevs.8 8 Jul 2018 20:04:44 -0000 1.11 +++ usbdevs.8 11 Jul 2018 09:31:39 -0000 @@ -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. Index: usbdevs.c =================================================================== RCS file: /cvs/src/usr.sbin/usbdevs/usbdevs.c,v retrieving revision 1.28 diff -u -p -r1.28 usbdevs.c --- usbdevs.c 10 Jul 2018 09:18:36 -0000 1.28 +++ usbdevs.c 11 Jul 2018 09:30:15 -0000 @@ -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':