Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Dec 2009 23:14:53 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r200339 - stable/8/usr.sbin/usbconfig
Message-ID:  <200912092314.nB9NErno043757@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Wed Dec  9 23:14:53 2009
New Revision: 200339
URL: http://svn.freebsd.org/changeset/base/200339

Log:
  MFC r198833
  
   Add more verbose output when dumping the configuration descriptor.

Modified:
  stable/8/usr.sbin/usbconfig/dump.c
Directory Properties:
  stable/8/usr.sbin/usbconfig/   (props changed)

Modified: stable/8/usr.sbin/usbconfig/dump.c
==============================================================================
--- stable/8/usr.sbin/usbconfig/dump.c	Wed Dec  9 23:12:52 2009	(r200338)
+++ stable/8/usr.sbin/usbconfig/dump.c	Wed Dec  9 23:14:53 2009	(r200339)
@@ -100,21 +100,66 @@ dump_field(struct libusb20_device *pdev,
 
 	printf("%s%s = 0x%04x ", plevel, field, value);
 
-	if ((field[0] != 'i') || (field[1] == 'd')) {
-		printf("\n");
-		return;
-	}
-	if (value == 0) {
-		printf(" <no string>\n");
-		return;
+	if (strlen(plevel) == 8) {
+		/* Endpoint Descriptor */
+
+		if (strcmp(field, "bEndpointAddress") == 0) {
+			if (value & 0x80)
+				printf(" <IN>\n");
+			else
+				printf(" <OUT>\n");
+			return;
+		}
+
+		if (strcmp(field, "bmAttributes") == 0) {
+			switch (value & 0x03) {
+			case 0:
+				printf(" <CONTROL>\n");
+				break;
+			case 1:
+				switch (value & 0x0C) {
+				case 0x00:
+					printf(" <ISOCHRONOUS>\n");
+					break;
+				case 0x04:
+					printf(" <ASYNC-ISOCHRONOUS>\n");
+					break;
+				case 0x08:
+					printf(" <ADAPT-ISOCHRONOUS>\n");
+					break;
+				default:
+					printf(" <SYNC-ISOCHRONOUS>\n");
+					break;
+				}
+				break;
+			case 2:
+				printf(" <BULK>\n");
+				break;
+			default:
+				printf(" <INTERRUPT>\n");
+				break;
+			}
+			return;
+		}
 	}
-	if (libusb20_dev_req_string_simple_sync(pdev, value,
-	    temp_string, sizeof(temp_string))) {
-		printf(" <retrieving string failed>\n");
+
+	if ((field[0] == 'i') && (field[1] != 'd')) {
+		/* Indirect String Descriptor */
+		if (value == 0) {
+			printf(" <no string>\n");
+			return;
+		}
+		if (libusb20_dev_req_string_simple_sync(pdev, value,
+		    temp_string, sizeof(temp_string))) {
+			printf(" <retrieving string failed>\n");
+			return;
+		}
+		printf(" <%s>\n", temp_string);
 		return;
 	}
-	printf(" <%s>\n", temp_string);
-	return;
+
+	/* No additional information */
+	printf("\n");
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912092314.nB9NErno043757>