PERFORCE change 133944 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Jan 23 13:09:41 PST 2008


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

Change 133944 by hselasky at hselasky_laptop001 on 2008/01/23 21:09:08

	
	Make the USB status stage delay tunable through "hw.usb.ss_delay".
	This sysctl is used for advanced USB device testing.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_requests.c#17 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#109 edit

Differences ...

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

@@ -432,7 +432,8 @@
 	USETW(req.wLength, 0);
 
 	/* Setting the address should not take more than 1 second ! */
-	return (usbd_do_request_flags(udev, mtx, &req, NULL, 0, NULL, 1000));
+	return (usbd_do_request_flags(udev, mtx, &req, NULL,
+	    USBD_DELAY_STATUS_STAGE, NULL, 1000));
 }
 
 /*------------------------------------------------------------------------*

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

@@ -3570,6 +3570,13 @@
 	return;
 }
 
+#ifdef USB_DEBUG
+static int usb_ss_delay = 0;
+
+SYSCTL_INT(_hw_usb, OID_AUTO, ss_delay, CTLFLAG_RW,
+    &usb_ss_delay, 0, "USB status stage delay");
+#endif
+
 /*------------------------------------------------------------------------*
  *	usbd_do_request_flags and usbd_do_request
  *
@@ -3702,12 +3709,18 @@
 		} else {
 			if (xfer->frlengths[0] == 0) {
 				if (xfer->flags.manual_status) {
-					/*
-					 * Delay 70 milliseconds
-					 * before doing the status
-					 * stage:
-					 */
-					usbd_pause_mtx(xfer->priv_mtx, 70);
+#ifdef USB_DEBUG
+					int temp;
+
+					temp = usb_ss_delay;
+					if (temp > 5000) {
+						temp = 5000;
+					}
+					if (temp > 0) {
+						usbd_pause_mtx(
+						    xfer->priv_mtx, temp);
+					}
+#endif
 					xfer->flags.manual_status = 0;
 				} else {
 					break;


More information about the p4-projects mailing list