ChangeSet 1.1504.2.5, 2003/12/05 11:06:34-08:00, stern@rowland.harvard.edu

[PATCH] USB storage: Command failure codes for sddr09 driver

This patch updates the sdd09 subdriver to make it return Command Failure
with appropriate sense data (rather than Tranport Error) when:

	a MODE-SENSE command requests an unsupported page;

	a CDB includes an unrecognized command code.

This should help prevent confusion and excessive retrying by the SCSI
drivers.


 drivers/usb/storage/sddr09.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
--- a/drivers/usb/storage/sddr09.c	Mon Dec 29 14:26:41 2003
+++ b/drivers/usb/storage/sddr09.c	Mon Dec 29 14:26:41 2003
@@ -1496,7 +1496,9 @@
 			return USB_STOR_TRANSPORT_GOOD;
 		}
 
-		return USB_STOR_TRANSPORT_ERROR;
+		sensekey = 0x05;	/* illegal request */
+		sensecode = 0x24;	/* invalid field in CDB */
+		return USB_STOR_TRANSPORT_FAILED;
 	}
 
 	if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
@@ -1542,8 +1544,10 @@
 
 	if (srb->cmnd[0] != TEST_UNIT_READY &&
 	    srb->cmnd[0] != REQUEST_SENSE) {
+		sensekey = 0x05;	/* illegal request */
+		sensecode = 0x20;	/* invalid command */
 		havefakesense = 1;
-		return USB_STOR_TRANSPORT_ERROR;
+		return USB_STOR_TRANSPORT_FAILED;
 	}
 
 	for (; srb->cmd_len<12; srb->cmd_len++)
