CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: jmcneill Date: Thu Jul 5 19:46:58 UTC 2018 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Print USB_SPEED_SUPER_PLUS capability if present To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.35 src/usr.sbin/usbdevs/usbdevs.c:1.36 --- src/usr.sbin/usbdevs/usbdevs.c:1.35 Wed Sep 7 08:09:59 2016 +++ src/usr.sbin/usbdevs/usbdevs.c Thu Jul 5 19:46:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $ */ +/* $NetBSD: usbdevs.c,v 1.36 2018/07/05 19:46:58 jmcneill Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $"); +__RCSID("$NetBSD: usbdevs.c,v 1.36 2018/07/05 19:46:58 jmcneill Exp $"); #endif #include @@ -222,6 +222,7 @@ usbdev(int f, int a, int rec) case USB_SPEED_FULL: printf("full speed, "); break; case USB_SPEED_HIGH: printf("high speed, "); break; case USB_SPEED_SUPER: printf("super speed, "); break; + case USB_SPEED_SUPER_PLUS: printf("super speed+, "); break; default: break; } if (di.udi_power)
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: skrll Date: Wed Sep 7 08:10:00 UTC 2016 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Fix previous... handle hub ports To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.34 src/usr.sbin/usbdevs/usbdevs.c:1.35 --- src/usr.sbin/usbdevs/usbdevs.c:1.34 Wed Sep 7 08:05:02 2016 +++ src/usr.sbin/usbdevs/usbdevs.c Wed Sep 7 08:09:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $ */ +/* $NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $"); +__RCSID("$NetBSD: usbdevs.c,v 1.35 2016/09/07 08:09:59 skrll Exp $"); #endif #include @@ -205,7 +205,7 @@ static void usbdev(int f, int a, int rec) { struct usb_device_info di; - int e, p, i; + int e, i; di.udi_addr = a; e = ioctl(f, USB_DEVICEINFO, ); @@ -261,7 +261,10 @@ usbdev(int f, int a, int rec) } if (!rec) return; - for (p = 0; p < di.udi_nports && p < __arraycount(di.udi_ports); p++) { + + unsigned int nports = di.udi_nports; + + for (unsigned int p = 0; p < nports && p < __arraycount(di.udi_ports); p++) { int s = di.udi_ports[p]; if (s >= USB_MAX_DEVICES) { if (verbose) {
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: skrll Date: Wed Sep 7 08:05:02 UTC 2016 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Don't read beyond the end of the array when given a overly large number of ports on a hub. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.33 src/usr.sbin/usbdevs/usbdevs.c:1.34 --- src/usr.sbin/usbdevs/usbdevs.c:1.33 Fri Sep 2 05:59:04 2016 +++ src/usr.sbin/usbdevs/usbdevs.c Wed Sep 7 08:05:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $ */ +/* $NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $"); +__RCSID("$NetBSD: usbdevs.c,v 1.34 2016/09/07 08:05:02 skrll Exp $"); #endif #include @@ -261,7 +261,7 @@ usbdev(int f, int a, int rec) } if (!rec) return; - for (p = 0; p < di.udi_nports; p++) { + for (p = 0; p < di.udi_nports && p < __arraycount(di.udi_ports); p++) { int s = di.udi_ports[p]; if (s >= USB_MAX_DEVICES) { if (verbose) {
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: skrll Date: Fri Sep 2 05:59:05 UTC 2016 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Add __RCDIS To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.32 src/usr.sbin/usbdevs/usbdevs.c:1.33 --- src/usr.sbin/usbdevs/usbdevs.c:1.32 Sun Jun 26 07:10:24 2016 +++ src/usr.sbin/usbdevs/usbdevs.c Fri Sep 2 05:59:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.32 2016/06/26 07:10:24 mlelstv Exp $ */ +/* $NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -29,6 +29,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include +#ifndef lint +__RCSID("$NetBSD: usbdevs.c,v 1.33 2016/09/02 05:59:04 skrll Exp $"); +#endif + #include #include #include
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: mlelstv Date: Sun Jun 26 07:10:24 UTC 2016 Modified Files: src/usr.sbin/usbdevs: usbdevs.8 usbdevs.c Log Message: Print release also in hex. Print device class information if -v is used twice. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/usbdevs/usbdevs.8 cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.8 diff -u src/usr.sbin/usbdevs/usbdevs.8:1.9 src/usr.sbin/usbdevs/usbdevs.8:1.10 --- src/usr.sbin/usbdevs/usbdevs.8:1.9 Mon Aug 15 14:31:24 2011 +++ src/usr.sbin/usbdevs/usbdevs.8 Sun Jun 26 07:10:24 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: usbdevs.8,v 1.9 2011/08/15 14:31:24 wiz Exp $ +.\" $NetBSD: usbdevs.8,v 1.10 2016/06/26 07:10:24 mlelstv Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -53,7 +53,7 @@ Show the device drivers associated with .It Fl f Ar dev Only print information for the given USB controller. .It Fl v -Be verbose. +Be verbose, more information is given if used twice. .El .Sh FILES .Bl -tag -width Pa Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.31 src/usr.sbin/usbdevs/usbdevs.c:1.32 --- src/usr.sbin/usbdevs/usbdevs.c:1.31 Tue Aug 12 13:40:07 2014 +++ src/usr.sbin/usbdevs/usbdevs.c Sun Jun 26 07:10:24 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.31 2014/08/12 13:40:07 skrll Exp $ */ +/* $NetBSD: usbdevs.c,v 1.32 2016/06/26 07:10:24 mlelstv Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -47,7 +47,13 @@ static int verbose = 0; static int showdevs = 0; +struct stringtable { + int row, col; + const char *string; +}; + __dead static void usage(void); +static void getstrings(const struct stringtable *, int, int, const char **, const char **); static void usbdev(int f, int a, int rec); static void usbdump(int f); static void dumpone(char *name, int f, int addr); @@ -92,6 +98,104 @@ u2t(const char *utf8str, char *termstr) strcpy(termstr, "(invalid)"); } +struct stringtable class_strings[] = { + { UICLASS_UNSPEC, -1, "Unspecified" }, + + { UICLASS_AUDIO, -1, "Audio" }, + { UICLASS_AUDIO, UISUBCLASS_AUDIOCONTROL, "Audio Control" }, + { UICLASS_AUDIO, UISUBCLASS_AUDIOSTREAM, "Audio Streaming" }, + { UICLASS_AUDIO, UISUBCLASS_MIDISTREAM, "MIDI Streaming" }, + + { UICLASS_CDC, -1, "Communications and CDC Control" }, + { UICLASS_CDC, UISUBCLASS_DIRECT_LINE_CONTROL_MODEL, "Direct Line" }, + { UICLASS_CDC, UISUBCLASS_ABSTRACT_CONTROL_MODEL, "Abstract" }, + { UICLASS_CDC, UISUBCLASS_TELEPHONE_CONTROL_MODEL, "Telephone" }, + { UICLASS_CDC, UISUBCLASS_MULTICHANNEL_CONTROL_MODEL, "Multichannel" }, + { UICLASS_CDC, UISUBCLASS_CAPI_CONTROLMODEL, "CAPI" }, + { UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, "Ethernet Networking" }, + { UICLASS_CDC, UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL, "ATM Networking" }, + + { UICLASS_HID, -1, "Human Interface Device" }, + { UICLASS_HID, UISUBCLASS_BOOT, "Boot" }, + + { UICLASS_PHYSICAL,-1, "Physical" }, + + { UICLASS_IMAGE, -1, "Image" }, + + { UICLASS_PRINTER, -1, "Printer" }, + { UICLASS_PRINTER, UISUBCLASS_PRINTER, "Printer" }, + + { UICLASS_MASS,-1, "Mass Storage" }, + { UICLASS_MASS,UISUBCLASS_RBC, "RBC" }, + { UICLASS_MASS,UISUBCLASS_SFF8020I, "SFF8020I" }, + { UICLASS_MASS,UISUBCLASS_QIC157, "QIC157" }, + { UICLASS_MASS,UISUBCLASS_UFI, "UFI" }, + { UICLASS_MASS,UISUBCLASS_SFF8070I, "SFF8070I" }, + { UICLASS_MASS,UISUBCLASS_SCSI, "SCSI" }, + { UICLASS_MASS,UISUBCLASS_SCSI, "SCSI" }, + + { UICLASS_HUB, -1, "Hub" }, + { UICLASS_HUB, UISUBCLASS_HUB, "Hub" }, + + { UICLASS_CDC_DATA,-1, "CDC-Data" }, + { UICLASS_CDC_DATA,UISUBCLASS_DATA, "Data" }, + + { UICLASS_SMARTCARD, -1, "Smart Card" }, + + { UICLASS_SECURITY,-1, "Content Security" }, + + { UICLASS_VIDEO, -1, "Video" }, + { UICLASS_VIDEO, UISUBCLASS_VIDEOCONTROL, "Video Control" }, + { UICLASS_VIDEO, UISUBCLASS_VIDEOSTREAMING, "Video Streaming" }, + { UICLASS_VIDEO, UISUBCLASS_VIDEOCOLLECTION, "Video Collection" }, + +#ifdef notyet + { UICLASS_HEALTHCARE, -1, "Personal Healthcare" }, + { UICLASS_AVDEVICE,-1, "Audio/Video Device" }, + { UICLASS_BILLBOARD, -1, "Billboard" }, +#endif + + { UICLASS_DIAGNOSTIC, -1, "Diagnostic" }, + { UICLASS_WIRELESS,-1, "Wireless" }, + { UICLASS_WIRELESS,UISUBCLASS_RF, "Radio Frequency" }, + +#ifdef notyet + { UICLASS_MISC,-1, "Miscellaneous" }, +#endif + + { UICLASS_APPL_SPEC, -1, "Application Specific" }, + { UICLASS_APPL_SPEC, UISUBCLASS_FIRMWARE_DOWNLOAD, "Firmware Download" }, + { UICLASS_APPL_SPEC, UISUBCLASS_IRDA,
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: skrll Date: Tue Aug 12 13:40:07 UTC 2014 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Report super speed devices. From Takahiro HAYASHI. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.30 src/usr.sbin/usbdevs/usbdevs.c:1.31 --- src/usr.sbin/usbdevs/usbdevs.c:1.30 Sat Sep 14 14:07:56 2013 +++ src/usr.sbin/usbdevs/usbdevs.c Tue Aug 12 13:40:07 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.30 2013/09/14 14:07:56 jakllsch Exp $ */ +/* $NetBSD: usbdevs.c,v 1.31 2014/08/12 13:40:07 skrll Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -112,6 +112,7 @@ usbdev(int f, int a, int rec) case USB_SPEED_LOW: printf(low speed, ); break; case USB_SPEED_FULL: printf(full speed, ); break; case USB_SPEED_HIGH: printf(high speed, ); break; + case USB_SPEED_SUPER: printf(super speed, ); break; default: break; } if (di.udi_power)
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: jakllsch Date: Sat Sep 14 14:07:56 UTC 2013 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Try to dump device at address 0. Allows dumping of xhci(4) root hub. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.29 src/usr.sbin/usbdevs/usbdevs.c:1.30 --- src/usr.sbin/usbdevs/usbdevs.c:1.29 Mon Jul 8 14:47:18 2013 +++ src/usr.sbin/usbdevs/usbdevs.c Sat Sep 14 14:07:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.29 2013/07/08 14:47:18 jakllsch Exp $ */ +/* $NetBSD: usbdevs.c,v 1.30 2013/09/14 14:07:56 jakllsch Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -174,7 +174,7 @@ usbdump(int f) { int a; - for (a = 1; a USB_MAX_DEVICES; a++) { + for (a = 0; a USB_MAX_DEVICES; a++) { if (!done[a]) usbdev(f, a, 1); } @@ -187,7 +187,7 @@ dumpone(char *name, int f, int addr) printf(Controller %s:\n, name); indent = 0; memset(done, 0, sizeof done); - if (addr) + if (addr = 0) usbdev(f, addr, 0); else usbdump(f); @@ -199,7 +199,7 @@ main(int argc, char **argv) int ch, i, f; char buf[50]; char *dev = NULL; - int addr = 0; + int addr = -1; int ncont; while ((ch = getopt(argc, argv, a:df:v?)) != -1) {
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: jakllsch Date: Mon Jul 8 14:47:18 UTC 2013 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Use symbolic constants EXIT_SUCCESS, EXIT_FAILURE, and NULL where appropriate. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.28 src/usr.sbin/usbdevs/usbdevs.c:1.29 --- src/usr.sbin/usbdevs/usbdevs.c:1.28 Tue Aug 30 20:51:29 2011 +++ src/usr.sbin/usbdevs/usbdevs.c Mon Jul 8 14:47:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.28 2011/08/30 20:51:29 joerg Exp $ */ +/* $NetBSD: usbdevs.c,v 1.29 2013/07/08 14:47:18 jakllsch Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ usage(void) fprintf(stderr, usage: %s [-dv] [-a addr] [-f dev]\n, getprogname()); - exit(1); + exit(EXIT_FAILURE); } static char done[USB_MAX_DEVICES]; @@ -198,7 +198,7 @@ main(int argc, char **argv) { int ch, i, f; char buf[50]; - char *dev = 0; + char *dev = NULL; int addr = 0; int ncont; @@ -224,7 +224,7 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (dev == 0) { + if (dev == NULL) { for (ncont = 0, i = 0; i 10; i++) { snprintf(buf, sizeof(buf), %s%d, USBDEV, i); f = open(buf, O_RDONLY); @@ -248,5 +248,5 @@ main(int argc, char **argv) else err(1, %s, dev); } - exit(0); + exit(EXIT_SUCCESS); }
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: joerg Date: Tue Aug 30 20:51:29 UTC 2011 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.27 src/usr.sbin/usbdevs/usbdevs.c:1.28 --- src/usr.sbin/usbdevs/usbdevs.c:1.27 Mon Aug 15 14:31:58 2011 +++ src/usr.sbin/usbdevs/usbdevs.c Tue Aug 30 20:51:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.27 2011/08/15 14:31:58 wiz Exp $ */ +/* $NetBSD: usbdevs.c,v 1.28 2011/08/30 20:51:29 joerg Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -44,17 +44,16 @@ #define USBDEV /dev/usb -int verbose = 0; -int showdevs = 0; +static int verbose = 0; +static int showdevs = 0; -void usage(void); -void usbdev(int f, int a, int rec); -void usbdump(int f); -void dumpone(char *name, int f, int addr); -int main(int, char **); +__dead static void usage(void); +static void usbdev(int f, int a, int rec); +static void usbdump(int f); +static void dumpone(char *name, int f, int addr); -void -usage() +static void +usage(void) { fprintf(stderr, usage: %s [-dv] [-a addr] [-f dev]\n, @@ -62,10 +61,10 @@ exit(1); } -char done[USB_MAX_DEVICES]; -int indent; +static char done[USB_MAX_DEVICES]; +static int indent; #define MAXLEN USB_MAX_ENCODED_STRING_LEN /* assume can't grow over UTF-8 */ -char vendor[MAXLEN], product[MAXLEN], serial[MAXLEN]; +static char vendor[MAXLEN], product[MAXLEN], serial[MAXLEN]; static void u2t(const char *utf8str, char *termstr) @@ -93,7 +92,7 @@ strcpy(termstr, (invalid)); } -void +static void usbdev(int f, int a, int rec) { struct usb_device_info di; @@ -170,7 +169,7 @@ } } -void +static void usbdump(int f) { int a; @@ -181,7 +180,7 @@ } } -void +static void dumpone(char *name, int f, int addr) { if (verbose)
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: tnn Date: Mon Aug 15 14:20:08 UTC 2011 Modified Files: src/usr.sbin/usbdevs: usbdevs.8 Log Message: Use proper capitalization. Reported on IRC. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/usbdevs/usbdevs.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.8 diff -u src/usr.sbin/usbdevs/usbdevs.8:1.7 src/usr.sbin/usbdevs/usbdevs.8:1.8 --- src/usr.sbin/usbdevs/usbdevs.8:1.7 Wed Apr 30 13:11:03 2008 +++ src/usr.sbin/usbdevs/usbdevs.8 Mon Aug 15 14:20:08 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: usbdevs.8,v 1.7 2008/04/30 13:11:03 martin Exp $ +.\ $NetBSD: usbdevs.8,v 1.8 2011/08/15 14:20:08 tnn Exp $ .\ .\ Copyright (c) 1999 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -27,7 +27,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd October 15, 2000 +.Dd August 15, 2011 .Dt USBDEVS 8 .Os .Sh NAME @@ -48,11 +48,11 @@ The options are as follows: .Bl -tag -width Fl .It Fl a Ar addr -only print information about the device at the given address. +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 -only print information for the given USB controller. +Only print information for the given USB controller. .It Fl v Be verbose. .El
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: wiz Date: Mon Aug 15 14:31:24 UTC 2011 Modified Files: src/usr.sbin/usbdevs: usbdevs.8 Log Message: Sort options in SYNOPSIS. From Snader_LB. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/usbdevs/usbdevs.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.8 diff -u src/usr.sbin/usbdevs/usbdevs.8:1.8 src/usr.sbin/usbdevs/usbdevs.8:1.9 --- src/usr.sbin/usbdevs/usbdevs.8:1.8 Mon Aug 15 14:20:08 2011 +++ src/usr.sbin/usbdevs/usbdevs.8 Mon Aug 15 14:31:24 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: usbdevs.8,v 1.8 2011/08/15 14:20:08 tnn Exp $ +.\ $NetBSD: usbdevs.8,v 1.9 2011/08/15 14:31:24 wiz Exp $ .\ .\ Copyright (c) 1999 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -35,10 +35,9 @@ .Nd show USB devices connected to the system .Sh SYNOPSIS .Nm +.Op Fl dv .Op Fl a Ar addr -.Op Fl d .Op Fl f Ar dev -.Op Fl v .Sh DESCRIPTION .Nm prints a listing of all USB devices connected to the system
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: wiz Date: Mon Aug 15 14:31:58 UTC 2011 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: Sync usage with SYNOPSIS. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.26 src/usr.sbin/usbdevs/usbdevs.c:1.27 --- src/usr.sbin/usbdevs/usbdevs.c:1.26 Tue Feb 2 16:25:30 2010 +++ src/usr.sbin/usbdevs/usbdevs.c Mon Aug 15 14:31:58 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.26 2010/02/02 16:25:30 drochner Exp $ */ +/* $NetBSD: usbdevs.c,v 1.27 2011/08/15 14:31:58 wiz Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ usage() { - fprintf(stderr, usage: %s [-a addr] [-d] [-f dev] [-v]\n, + fprintf(stderr, usage: %s [-dv] [-a addr] [-f dev]\n, getprogname()); exit(1); }
CVS commit: src/usr.sbin/usbdevs
Module Name:src Committed By: drochner Date: Tue Feb 2 16:25:31 UTC 2010 Modified Files: src/usr.sbin/usbdevs: usbdevs.c Log Message: The structure returned by USB_DEVICEINFO has the vendor/device strings UTF-8 encoded now. We can't simply print this to a terminal, so convert it to the current codeset first. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/usbdevs/usbdevs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/usbdevs/usbdevs.c diff -u src/usr.sbin/usbdevs/usbdevs.c:1.25 src/usr.sbin/usbdevs/usbdevs.c:1.26 --- src/usr.sbin/usbdevs/usbdevs.c:1.25 Mon Apr 28 20:24:17 2008 +++ src/usr.sbin/usbdevs/usbdevs.c Tue Feb 2 16:25:30 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdevs.c,v 1.25 2008/04/28 20:24:17 martin Exp $ */ +/* $NetBSD: usbdevs.c,v 1.26 2010/02/02 16:25:30 drochner Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,6 +37,9 @@ #include unistd.h #include err.h #include errno.h +#include locale.h +#include langinfo.h +#include iconv.h #include dev/usb/usb.h #define USBDEV /dev/usb @@ -61,6 +64,34 @@ char done[USB_MAX_DEVICES]; int indent; +#define MAXLEN USB_MAX_ENCODED_STRING_LEN /* assume can't grow over UTF-8 */ +char vendor[MAXLEN], product[MAXLEN], serial[MAXLEN]; + +static void +u2t(const char *utf8str, char *termstr) +{ + static iconv_t ic; + static int iconv_inited = 0; + size_t insz, outsz, icres; + + if (!iconv_inited) { + setlocale(LC_ALL, ); + ic = iconv_open(nl_langinfo(CODESET), UTF-8); + if (ic == (iconv_t)-1) + ic = iconv_open(ASCII, UTF-8); /* g.c.d. */ + iconv_inited = 1; + } + if (ic != (iconv_t)-1) { + insz = strlen(utf8str); + outsz = MAXLEN - 1; + icres = iconv(ic, utf8str, insz, termstr, outsz); + if (icres != (size_t)-1) { + *termstr = '\0'; + return; + } + } + strcpy(termstr, (invalid)); +} void usbdev(int f, int a, int rec) @@ -93,14 +124,17 @@ else printf(unconfigured, ); } + u2t(di.udi_product, product); + u2t(di.udi_vendor, vendor); + u2t(di.udi_serial, serial); if (verbose) { printf(%s(0x%04x), %s(0x%04x), rev %s, - di.udi_product, di.udi_productNo, - di.udi_vendor, di.udi_vendorNo, di.udi_release); + product, di.udi_productNo, + vendor, di.udi_vendorNo, di.udi_release); if (di.udi_serial[0]) - printf(, serial %s, di.udi_serial); + printf(, serial %s, serial); } else - printf(%s, %s, di.udi_product, di.udi_vendor); + printf(%s, %s, product, vendor); printf(\n); if (showdevs) { for (i = 0; i USB_MAX_DEVNAMES; i++)