svn commit: r206314 - stable/8/sys/dev/usb/template

Andrew Thompson thompsa at FreeBSD.org
Tue Apr 6 23:26:17 UTC 2010


Author: thompsa
Date: Tue Apr  6 23:26:17 2010
New Revision: 206314
URL: http://svn.freebsd.org/changeset/base/206314

Log:
  MFC r205033
  
   isochronous endpoint descriptors should have two more bytes which are zero by
   default.
  
  Submitted by:	Hans Petter Selasky

Modified:
  stable/8/sys/dev/usb/template/usb_template.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/template/usb_template.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template.c	Tue Apr  6 23:25:53 2010	(r206313)
+++ stable/8/sys/dev/usb/template/usb_template.c	Tue Apr  6 23:26:17 2010	(r206314)
@@ -162,15 +162,23 @@ usb_make_endpoint_desc(struct usb_temp_s
 	const void **rd;
 	uint16_t old_size;
 	uint16_t mps;
-	uint8_t ea = 0;			/* Endpoint Address */
-	uint8_t et = 0;			/* Endpiont Type */
+	uint8_t ea;			/* Endpoint Address */
+	uint8_t et;			/* Endpiont Type */
 
 	/* Reserve memory */
 	old_size = temp->size;
-	temp->size += sizeof(*ed);
 
-	/* Scan all Raw Descriptors first */
+	ea = (ted->bEndpointAddress & (UE_ADDR | UE_DIR_IN | UE_DIR_OUT));
+	et = (ted->bmAttributes & UE_XFERTYPE);
+
+	if (et == UE_ISOCHRONOUS) {
+		/* account for extra byte fields */
+		temp->size += sizeof(*ed) + 2;
+	} else {
+		temp->size += sizeof(*ed);
+	}
 
+	/* Scan all Raw Descriptors first */
 	rd = ted->ppRawDesc;
 	if (rd) {
 		while (*rd) {
@@ -192,8 +200,6 @@ usb_make_endpoint_desc(struct usb_temp_s
 		/* escape for Zero Max Packet Size */
 		mps = 0;
 	}
-	ea = (ted->bEndpointAddress & (UE_ADDR | UE_DIR_IN | UE_DIR_OUT));
-	et = (ted->bmAttributes & UE_XFERTYPE);
 
 	/*
 	 * Fill out the real USB endpoint descriptor
@@ -201,7 +207,10 @@ usb_make_endpoint_desc(struct usb_temp_s
 	 */
 	if (temp->buf) {
 		ed = USB_ADD_BYTES(temp->buf, old_size);
-		ed->bLength = sizeof(*ed);
+		if (et == UE_ISOCHRONOUS)
+			ed->bLength = sizeof(*ed) + 2;
+		else
+			ed->bLength = sizeof(*ed);
 		ed->bDescriptorType = UDESC_ENDPOINT;
 		ed->bEndpointAddress = ea;
 		ed->bmAttributes = ted->bmAttributes;


More information about the svn-src-stable mailing list