PERFORCE change 132622 for review

Hans Petter Selasky hselasky at FreeBSD.org
Sun Jan 6 06:14:14 PST 2008


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

Change 132622 by hselasky at hselasky_laptop001 on 2008/01/06 14:13:16

	
	Add generic support for handling alternate setting requests
	in device side mode.

Affected files ...

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

Differences ...

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

@@ -3362,7 +3362,26 @@
 	case UT_WRITE_INTERFACE:
 		switch (req.bRequest) {
 		case UR_SET_INTERFACE:
-			if (iface->alt_index != req.wValue[0]) {
+			if (state == ST_POST_STATUS) {
+				/* we are complete */
+				break;
+			}
+			if (iface->alt_index == req.wValue[0]) {
+				/* no change - nothing to do */
+				break;
+			}
+			error = device_detach(iface->subdev);
+			if (error) {
+				goto tr_stalled;
+			}
+			error = usbd_set_alt_interface_index(udev,
+			    req.wIndex[0], req.wValue[0]);
+			if (error) {
+				goto tr_stalled;
+			}
+			error = usbd_probe_and_attach(udev,
+			    req.wIndex[0]);
+			if (error) {
 				goto tr_stalled;
 			}
 			break;


More information about the p4-projects mailing list