scsi: handle bad inquiry responses
PATCH 26/33 scsi: handle bad inquiry responses
From: Alan Stern <[email protected]>
Quoted 1 line
From Meelis's USB device: It contains the device's response to an INQUIRY
command.
Quoted 1 line
ffff8100795e84c01469131296 C Bi:006:02 0 36 = 00800001 0000000047454e4552494320 555342204449534b20444556 49434520
The fifth byte of the response is 0, meaning that all bytes past the fifth are invalid. This is kind of an odd thing to do; it says the device hasn't really sent any vendor or product information at all. That's why you've been seeing garbage.
The Vendor string starts at byte position 8, the Product string at position 16, and the Revision string at position 32 (not captured by usbmon). Translating the bytes from hex to ASCII gives:
Vendor: GENERIC
Product: USB DISK DEVICE
These certainly _seem_ valid, albeit not very specific. Perhaps the device's USB firmware was never customized for any OEM and the default state is marked invalid.
There's a comment about this in the source code, asking what should be done if the INQUIRY response is too short (as it is here). Maybe the best approach would be always to assume the first 36 bytes are valid, even when the device says they aren't. It ought to solve your problem, and it's no worse than what we're doing now.
---
drivers/scsi/scsi_scan.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/scsi/scsi_scan.c renamed from drivers/scsi/scsi_scan.c~scsi-handle-bad-inquiry-responses +13 -0
@@ -654,6 +654,19 @@ static int scsi_probe_lun(struct scsi_de* short INQUIRY), an abort here prevents any further use of the * device, including spin up. * +* On the whole, the best approach seems to be to assume the first +* 36 bytes are valid no matter what the device says. That's +* better than copying < 36 bytes to the inquiry-result buffer +* and displaying garbage for the Vendor, Product, or Revision +* strings. +*/ +if (sdev->inquiry_len <36 ) { +printk (KERN_INFO "scsi scan: INQUIRY result too short (%d)," +" using 36\n" , sdev->inquiry_len); + sdev->inquiry_len =36 ; + } + +/* * Related to the above issue: * * XXX Devices (disk or all?) should be sent a TEST UNIT READY,
_