PERFORCE change 168375 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Sep 9 18:42:34 UTC 2009


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

Change 168375 by hselasky at hselasky_laptop001 on 2009/09/09 18:42:20

	
	USB CORE:
	 - improve USB do_request code.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_request.c#27 edit

Differences ...

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

@@ -385,6 +385,7 @@
 	usb_ticks_t max_ticks;
 	uint16_t length;
 	uint16_t temp;
+	uint16_t acttemp;
 
 	if (timeout < 50) {
 		/* timeout is too small */
@@ -606,18 +607,19 @@
 		if (err) {
 			break;
 		}
-		/* subtract length of SETUP packet, if any */
+
+		/* get actual length of DATA stage */
 
-		if (xfer->aframes > 0) {
-			xfer->actlen -= usbd_xfer_frame_len(xfer, 0);
+		if (xfer->aframes < 2) {
+			acttemp = 0;
 		} else {
-			xfer->actlen = 0;
+			acttemp = usbd_xfer_frame_len(xfer, 1);
 		}
 
 		/* check for short packet */
 
-		if (temp > xfer->actlen) {
-			temp = xfer->actlen;
+		if (temp > acttemp) {
+			temp = acttemp;
 			length = temp;
 		}
 		if (temp > 0) {


More information about the p4-projects mailing list