# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.600.1.6 -> 1.600.1.7
#	drivers/usb/storage/usb.c	1.35    -> 1.36   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/04	mdharm-usb@one-eyed-alien.net	1.600.1.7
# [PATCH] PATCH: usb-storage: fix software eject
# 
# This patch fixes the recently broken software eject of media.  At least, it
# should.  I'm back to having compile problems again, but the fix should
# be pretty self-evident.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	Thu Sep  5 08:51:26 2002
+++ b/drivers/usb/storage/usb.c	Thu Sep  5 08:51:26 2002
@@ -440,8 +440,14 @@
 		/* Most USB devices can't handle START_STOP.  But we
 		 * need something for media-change, so we'll use TUR
 		 * instead.
+		 *
+		 * We specifically allow this command through if either:
+		 * (a) it's a load/eject command (cmnd[4] & 2)
+		 * (b) it's a multi-target unit (i.e. legacy SCSI adaptor)
 		 */
-		else if (us->srb->cmnd[0] == START_STOP) {
+		else if (us->srb->cmnd[0] == START_STOP &&
+				!(us->srb->cmnd[4] & 2) &&
+				!(us->flags & US_FL_SCM_MULT_TARG)) {
 			unsigned char saved_cdb[16]; /* largest SCSI-III cmd */
 			__u8 old_cmd_len;
 
