Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Feb 2010 16:20:14 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 174976 for review
Message-ID:  <201002221620.o1MGKElW002960@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=174976

Change 174976 by hselasky@hselasky_laptop001 on 2010/02/22 16:20:14

	USB template bugfix:
		- isochronous endpoint descriptors should
		  have two more bytes which are zero by default.
		- patch by HPS @

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/template/usb_template.c#13 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/template/usb_template.c#13 (text+ko) ====

@@ -162,15 +162,23 @@
 	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);
+
+	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 @@
 		/* 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 @@
 	 */
 	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;



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