]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] PATCH: fix devices which don't support EVPD
authorMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Wed, 21 Aug 2002 06:52:42 +0000 (23:52 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 21 Aug 2002 06:52:42 +0000 (23:52 -0700)
Apparently, some new 2.5 scsi code tries to get the vital product data
pages using the INQUIRY command.  Unfortunately, most USB devices do not
support this.

The following patch intercepts all EVPD requests and responds with the
per-spec response of "Illegal Request: Invalid field in CDB".

drivers/usb/storage/scsiglue.c
drivers/usb/storage/scsiglue.h
drivers/usb/storage/usb.c

index c2cf254e53831e619a6d3ddd880b15d1317e811f..05afe6af33690224678a116d9e830eb878ce571f 100644 (file)
@@ -380,6 +380,7 @@ Scsi_Host_Template usb_stor_host_template = {
        .emulated =             TRUE
 };
 
+/* For a device that is "Not Ready" */
 unsigned char usb_stor_sense_notready[18] = {
        [0]     = 0x70,                     /* current error */
        [2]     = 0x02,                     /* not ready */
@@ -388,6 +389,14 @@ unsigned char usb_stor_sense_notready[18] = {
        [13]    = 0x03                      /* manual intervention */
 };
 
+/* To Report "Illegal Request: Invalid Field in CDB */
+unsigned char usb_stor_sense_invalidCDB[18] = {
+       [0]     = 0x70,                     /* current error */
+       [2]     = ILLEGAL_REQUEST,          /* Illegal Request = 0x05 */
+       [7]     = 0x0a,                     /* additional length */
+       [12]    = 0x24                      /* Invalid Field in CDB */
+};
+
 #define USB_STOR_SCSI_SENSE_HDRSZ 4
 #define USB_STOR_SCSI_SENSE_10_HDRSZ 8
 
index 13b9f3bec266025f375a998ac9881d342a746a91..efe2ba42644c19e45fb7101579c3a9dd7d4eac2c 100644 (file)
@@ -46,6 +46,7 @@
 #include "hosts.h"
 
 extern unsigned char usb_stor_sense_notready[18];
+extern unsigned char usb_stor_sense_invalidCDB[18];
 extern Scsi_Host_Template usb_stor_host_template;
 extern int usb_stor_scsiSense10to6(Scsi_Cmnd*);
 extern int usb_stor_scsiSense6to10(Scsi_Cmnd*);
index e68801addae4c0f203acc1245bd2a2e12dc2167f..5b3b27ba3d3ab7ff943d1267b56e946b30f9de72 100644 (file)
@@ -392,6 +392,17 @@ static int usb_stor_control_thread(void * __us)
                        us->srb->result = GOOD << 1;
                }
 
+               /* handle requests for EVPD, which most USB devices do
+                * not support */
+               else if((us->srb->cmnd[0] == INQUIRY) &&
+                               (us->srb->cmnd[1] & 0x1)) {
+                               US_DEBUGP("Faking INQUIRY command for EVPD\n");
+                               memcpy(us->srb->sense_buffer, 
+                                      usb_stor_sense_invalidCDB, 
+                                      sizeof(usb_stor_sense_invalidCDB));
+                               us->srb->result = CHECK_CONDITION << 1;
+               }
+
                /* our device has gone - pretend not ready */
                else if (!(us->flags & US_FL_DEV_ATTACHED)) {
                        US_DEBUGP("Request is for removed device\n");