ChangeSet 1.1371.759.31, 2004/04/26 16:10:49-07:00, mdharm-usb@one-eyed-alien.net

[PATCH] USB: usb-storage driver changes for 2.6.x [3/4]

This patch adds some clear-halt calls if a GetMaxLUN fails.  Apparently,
some devices (like certain early-rev Zip100s) stall their bulk pipes if
they receive a GetMaxLUN.


 drivers/usb/storage/transport.c |   11 +++++++++++
 1 files changed, 11 insertions(+)


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Fri May 14 15:32:22 2004
+++ b/drivers/usb/storage/transport.c	Fri May 14 15:32:22 2004
@@ -908,6 +908,17 @@
 				 USB_RECIP_INTERFACE,
 				 0, us->ifnum, us->iobuf, 1, HZ);
 
+	/* 
+	 * Some devices (i.e. Iomega Zip100) need this -- apparently
+	 * the bulk pipes get STALLed when the GetMaxLUN request is
+	 * processed.   This is, in theory, harmless to all other devices
+	 * (regardless of if they stall or not).
+	 */
+	if (result < 0) {
+		usb_stor_clear_halt(us, us->recv_bulk_pipe);
+		usb_stor_clear_halt(us, us->send_bulk_pipe);
+	}
+
 	US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", 
 		  result, us->iobuf[0]);
 
