From 5bd38bcab8afc7c2d3d043ccf545992428bac024 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Wed, 12 Nov 2014 14:52:44 +0000 Subject: [PATCH] Decode more fields when dumping USB descriptors. - Some minor style changes while at it. Submitted by: Dmitry Luhtionov MFC after: 1 week --- usr.sbin/usbconfig/dump.c | 83 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 4 deletions(-) diff --git a/usr.sbin/usbconfig/dump.c b/usr.sbin/usbconfig/dump.c index 52dd132095dc..df5cde0c546b 100644 --- a/usr.sbin/usbconfig/dump.c +++ b/usr.sbin/usbconfig/dump.c @@ -110,7 +110,6 @@ dump_field(struct libusb20_device *pdev, const char *plevel, printf(" \n"); return; } - if (strcmp(field, "bmAttributes") == 0) { switch (value & 0x03) { case 0: @@ -142,7 +141,6 @@ dump_field(struct libusb20_device *pdev, const char *plevel, return; } } - if ((field[0] == 'i') && (field[1] != 'd')) { /* Indirect String Descriptor */ if (value == 0) { @@ -157,7 +155,84 @@ dump_field(struct libusb20_device *pdev, const char *plevel, printf(" <%s>\n", temp_string); return; } + if (strlen(plevel) == 2 || strlen(plevel) == 6) { + /* Device and Interface Descriptor class codes */ + + if (strcmp(field, "bInterfaceClass") == 0 || + strcmp(field, "bDeviceClass") == 0) { + + switch (value) { + case 0x00: + printf(" \n"); + break; + case 0x01: + printf("