Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jun 2010 07:53:57 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 179521 for review
Message-ID:  <201006120753.o5C7rvpE060540@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@179521?ac=10

Change 179521 by hselasky@hselasky_laptop001 on 2010/06/12 07:53:47

	USB audio:
		- fix for USB audio devices which use the 7-byte
		endpoint descriptor instead of the 9-byte one.
		- remove sync-endpoint code, which is currently unused.
		- reported by: Antun Matanovi
		- patch by: hselasky @

Affected files ...

.. //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#69 edit
.. //depot/projects/usb/src/sys/dev/sound/usb/uaudioreg.h#13 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#69 (text+ko) ====

@@ -792,7 +792,8 @@
 		    ed, ed->bLength, ed->bDescriptorType,
 		    ed->bEndpointAddress, ed->bmAttributes,
 		    UGETW(ed->wMaxPacketSize), ed->bInterval,
-		    ed->bRefresh, ed->bSynchAddress);
+		    UEP_HAS_REFRESH(ep) ? ed->bRefresh : 0,
+		    UEP_HAS_SYNCADDR(ep) ? ed->bSynchAddress : 0);
 	}
 }
 
@@ -817,8 +818,6 @@
 	uint16_t alt_index = 0;
 	uint16_t wFormat;
 	uint8_t ep_dir;
-	uint8_t ep_type;
-	uint8_t ep_sync;
 	uint8_t bChannels;
 	uint8_t bBitResolution;
 	uint8_t x;
@@ -896,34 +895,12 @@
 			}
 		}
 		if ((desc->bDescriptorType == UDESC_ENDPOINT) &&
-		    (desc->bLength >= sizeof(*ed1))) {
+		    (desc->bLength >= UEP_MINSIZE)) {
 			if (ed1 == NULL) {
 				ed1 = (void *)desc;
 				if (UE_GET_XFERTYPE(ed1->bmAttributes) != UE_ISOCHRONOUS) {
 					ed1 = NULL;
 				}
-			} else {
-				if (ed2 == NULL) {
-					ed2 = (void *)desc;
-					if (UE_GET_XFERTYPE(ed2->bmAttributes) != UE_ISOCHRONOUS) {
-						ed2 = NULL;
-						continue;
-					}
-					if (ed2->bSynchAddress != 0) {
-						DPRINTFN(11, "invalid endpoint: bSynchAddress != 0\n");
-						ed2 = NULL;
-						continue;
-					}
-					if (ed2->bEndpointAddress != ed1->bSynchAddress) {
-						DPRINTFN(11, "invalid endpoint addresses: "
-						    "ep[0]->bSynchAddress=0x%x "
-						    "ep[1]->bEndpointAddress=0x%x\n",
-						    ed1->bSynchAddress,
-						    ed2->bEndpointAddress);
-						ed2 = NULL;
-						continue;
-					}
-				}
 			}
 		}
 		if ((desc->bDescriptorType == UDESC_CS_ENDPOINT) &&
@@ -936,35 +913,8 @@
 		if (audio_if && asid && asf1d && ed1 && sed) {
 
 			ep_dir = UE_GET_DIR(ed1->bEndpointAddress);
-			ep_type = UE_GET_ISO_TYPE(ed1->bmAttributes);
-			ep_sync = 0;
 
-			if ((sc->sc_uq_au_inp_async) &&
-			    (ep_dir == UE_DIR_IN) && (ep_type == UE_ISO_ADAPT)) {
-				ep_type = UE_ISO_ASYNC;
-			}
-			if ((ep_dir == UE_DIR_IN) && (ep_type == UE_ISO_ADAPT)) {
-				ep_sync = 1;
-			}
-			if ((ep_dir != UE_DIR_IN) && (ep_type == UE_ISO_ASYNC)) {
-				ep_sync = 1;
-			}
-			/* Ignore sync endpoint information until further. */
-#if 0
-			if (ep_sync && (!ed2)) {
-				continue;
-			}
-			/*
-			 * we can't handle endpoints that need a sync pipe
-			 * yet
-			 */
-
-			if (ep_sync) {
-				DPRINTF("skipped sync interface\n");
-				audio_if = 0;
-				continue;
-			}
-#endif
+			/* We ignore sync endpoint information until further. */
 
 			wFormat = UGETW(asid->wFormatTag);
 			bChannels = UAUDIO_MAX_CHAN(asf1d->bNrChannels);

==== //depot/projects/usb/src/sys/dev/sound/usb/uaudioreg.h#13 (text+ko) ====

@@ -47,6 +47,11 @@
 #define	UDESCSUB_AC_PROCESSING	7
 #define	UDESCSUB_AC_EXTENSION	8
 
+/* These macros check if the endpoint descriptor has additional fields */
+#define	UEP_MINSIZE	7
+#define	UEP_HAS_REFRESH(ep)	((ep)->bLength >= 8)
+#define	UEP_HAS_SYNCADDR(ep)	((ep)->bLength >= 9)
+
 /* The first fields are identical to struct usb_endpoint_descriptor */
 typedef struct {
 	uByte	bLength;



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