This fixes a rare protocol bug that's been with us since at least 2.4 days;
please merge.

- Dave
This fixes a longstanding bug in the OHCI driver, inherited from the 2.4
code.  It also fixes a related comment in the EHCI driver, which came when
the EHCI code was first derived from OHCI.  (The EHCI code doesn't have
that bug; the comment was effectively "FIXME add bug".)

The bug: control-IN transfers with no data stages have status stages with
an IN packet (like a control-OUT transfer), instead of using an OUT packet.
See figure 8-37 of the USB spec.  The current code makes trouble with some
peripheral hardware and zero length IN transfers (scarce in the Real World).

Signed-off-by: David Brownell <[EMAIL PROTECTED]>

--- 1.77/drivers/usb/host/ehci-q.c	2005-02-16 15:53:38 -08:00
+++ edited/drivers/usb/host/ehci-q.c	2005-03-02 08:59:20 -08:00
@@ -522,7 +522,7 @@
 	else
 		buf = 0;
 
-	// FIXME this 'buf' check break some zlps...
+	/* for zero length DATA stages, STATUS is always IN */
 	if (!buf || is_input)
 		token |= (1 /* "in" */ << 8);
 	/* else it's already initted to "out" pid (0 << 8) */
--- 1.74/drivers/usb/host/ohci-q.c	2005-01-10 12:51:55 -08:00
+++ edited/drivers/usb/host/ohci-q.c	2005-03-01 13:28:30 -08:00
@@ -662,7 +662,7 @@
 			/* NOTE:  mishandles transfers >8K, some >4K */
 			td_fill (ohci, info, data, data_len, urb, cnt++);
 		}
-		info = is_out
+		info = (is_out || data_len == 0)
 			? TD_CC | TD_DP_IN | TD_T_DATA1
 			: TD_CC | TD_DP_OUT | TD_T_DATA1;
 		td_fill (ohci, info, data, 0, urb, cnt++);

Reply via email to