Commit 3cc8f6c9 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] PATCH: fix devices which don't support EVPD

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".
parent 33414ac3
......@@ -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
......
......@@ -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*);
......
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment