PERFORCE change 142894 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Jun 4 16:20:17 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=142894

Change 142894 by hselasky at hselasky_laptop001 on 2008/06/04 16:19:51

	
	USB Device Side Mode: Make sure that non-interface specific control
	endpint messages gets broadcasted.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#125 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#125 (text+ko) ====

@@ -3380,6 +3380,7 @@
 	uint16_t wValue;
 	uint16_t wIndex;
 	uint8_t state;
+	uint8_t iface_index;
 	union {
 		uWord	wStatus;
 		uint8_t	buf[2];
@@ -3528,13 +3529,15 @@
 		}
 		break;
 	default:
+		if (state == ST_DATA) {
+			goto tr_bad_context;
+		}
 		if ((req.bmRequestType & 0x1F) == UT_INTERFACE) {
-			if (state == ST_DATA) {
-				goto tr_bad_context;
-			}
-			goto tr_handle_iface_request;
+			iface_index = req.wIndex[0];	/* unicast */
+		} else {
+			iface_index = 0;/* broadcast */
 		}
-		goto tr_stalled;
+		goto tr_handle_iface_request;
 	}
 	goto tr_valid;
 
@@ -3641,7 +3644,7 @@
 	goto tr_valid;
 
 tr_handle_iface_request:
-	iface = usbd_get_iface(udev, req.wIndex[0]);
+	iface = usbd_get_iface(udev, iface_index);
 	if (iface == NULL) {
 		goto tr_stalled;
 	}
@@ -3672,6 +3675,10 @@
 	goto tr_handle_iface_request_builtin;
 
 tr_handle_iface_request_builtin:
+	if ((req.bmRequestType & 0x1F) != UT_INTERFACE) {
+		iface_index++;		/* iterate */
+		goto tr_handle_iface_request;
+	}
 	switch (req.bmRequestType) {
 	case UT_WRITE_INTERFACE:
 		switch (req.bRequest) {
@@ -3722,6 +3729,8 @@
 			goto tr_stalled;
 		}
 		break;
+	default:
+		goto tr_stalled;
 	}
 	goto tr_valid;
 


More information about the p4-projects mailing list