svn commit: r209452 - head/sys/dev/sound/usb

Andrew Thompson thompsa at FreeBSD.org
Tue Jun 22 21:16:19 UTC 2010


Author: thompsa
Date: Tue Jun 22 21:16:18 2010
New Revision: 209452
URL: http://svn.freebsd.org/changeset/base/209452

Log:
  - 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
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/sound/usb/uaudioreg.h

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Tue Jun 22 21:14:15 2010	(r209451)
+++ head/sys/dev/sound/usb/uaudio.c	Tue Jun 22 21:16:18 2010	(r209452)
@@ -792,7 +792,8 @@ uaudio_chan_dump_ep_desc(const usb_endpo
 		    ed, ed->bLength, ed->bDescriptorType,
 		    ed->bEndpointAddress, ed->bmAttributes,
 		    UGETW(ed->wMaxPacketSize), ed->bInterval,
-		    ed->bRefresh, ed->bSynchAddress);
+		    UEP_HAS_REFRESH(ed) ? ed->bRefresh : 0,
+		    UEP_HAS_SYNCADDR(ed) ? ed->bSynchAddress : 0);
 	}
 }
 
@@ -817,8 +818,6 @@ uaudio_chan_fill_info_sub(struct uaudio_
 	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 @@ uaudio_chan_fill_info_sub(struct uaudio_
 			}
 		}
 		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 @@ uaudio_chan_fill_info_sub(struct uaudio_
 		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);

Modified: head/sys/dev/sound/usb/uaudioreg.h
==============================================================================
--- head/sys/dev/sound/usb/uaudioreg.h	Tue Jun 22 21:14:15 2010	(r209451)
+++ head/sys/dev/sound/usb/uaudioreg.h	Tue Jun 22 21:16:18 2010	(r209452)
@@ -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;


More information about the svn-src-head mailing list