Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2007 09:12:22 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 131461 for review
Message-ID:  <200712230912.lBN9CMSP053585@repoman.freebsd.org>

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

Change 131461 by hselasky@hselasky_laptop001 on 2007/12/23 09:11:41

	
	o Add some more debug prints printing
	  out the different cases in the
	  "usbd_callback_wrapper()".
	
	o Clear "manual_status" when the
	  end of the control transfer has been
	  reached in USB device side mode.

Affected files ...

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

Differences ...

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

@@ -2246,6 +2246,8 @@
 			/* check first recurse flag */
 			if (!xfer->flags_int.recursed_1) {
 
+				PRINTFN(2, ("case 2 not recursed\n"));
+
 				mtx_unlock(xfer->usb_mtx);
 				mtx_assert(xfer->usb_mtx, MA_NOTOWNED);
 
@@ -2259,11 +2261,15 @@
 			         * Reversal, LOR
 			         */
 				dropped_usb_mtx = 1;
+			} else {
+				PRINTFN(2, ("case 2 recursed\n"));
 			}
 		} else {
 			if (context == USBD_CONTEXT_CALLBACK) {
 				/* case 4 */
 
+				PRINTFN(2, ("case 4\n"));
+
 				/*
 				 * During possible unlocked periods,
 				 * the USB transfer can have been
@@ -2283,6 +2289,8 @@
 			} else {
 				/* case 1 or case 3 */
 
+				PRINTFN(2, ("case 1\n"));
+
 				/*
 				 * By clearing the "usb_thread"
 				 * variable we are signalling that a
@@ -2305,6 +2313,8 @@
 		 * 5) HW interrupt done callback or other source.
 		 */
 
+		PRINTFN(2, ("case 5\n"));
+
 		/*
 	         * We have to postpone the callback due to the fact we
 	         * will have a Lock Order Reversal, LOR, if we try to
@@ -3035,7 +3045,6 @@
 	/* reset frame stuff */
 
 	xfer->frlengths[0] = 0;
-	xfer->frlengths[1] = 0;
 
 	usbd_set_frame_offset(xfer, 0, 0);
 	usbd_set_frame_offset(xfer, sizeof(req), 1);
@@ -3064,6 +3073,10 @@
 	wValue = UGETW(req.wValue);
 	wIndex = UGETW(req.wIndex);
 
+	PRINTFN(2, ("req 0x%02x 0x%02x 0x%04x 0x%04x "
+	    "off=0x%x rem=0x%x\n", req.bmRequestType,
+	    req.bRequest, wValue, wIndex, off, rem));
+
 	/* demultiplex the control request */
 
 	switch (req.bmRequestType) {
@@ -3311,6 +3324,10 @@
 			usbd_copy_in(xfer->frbuffers + 1, 0, ptr, max_len);
 		}
 		xfer->frlengths[1] = max_len;
+	} else {
+		/* the end is reached, send status */
+		xfer->flags.manual_status = 0;
+		xfer->frlengths[1] = 0;
 	}
 	return (0);			/* success */
 



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