Re: Unit attention in USB storage

Andries.Brouwer@cwi.nl
Tue, 5 Jun 2001 05:39:47 +0200 (MET DST)


>> [things work better when "Unit Attention: not ready to ready transition"
>> is not regarded as an error]

> I suggest trying this with 2.4.5 -- several people report that kernel
> works much better than previous ones with usb-storage.

The details of the behaviour are a bit different, but the essence
is unchanged: with the same .config as the 2.4.3 I reported on,
2.4.5 failed. (With a different one it was successful. It is a
matter of timing.) Again adding the patch:

diff -r -u ../linux-2.4.5/linux/drivers/usb/storage/debug.c linux/drivers/usb/storage/debug.c
--- ../linux-2.4.5/linux/drivers/usb/storage/debug.c Sat Sep 9 01:39:12 2000
+++ linux/drivers/usb/storage/debug.c Tue Jun 5 05:23:46 2001
@@ -302,6 +302,8 @@
case 0x1C00: what="defect list not found"; break;
case 0x2400: what="invalid field in CDB"; break;
case 0x2703: what="associated write protect"; break;
+ case 0x2800: what="not ready to ready transtion (media change?)";
+ break;
case 0x2903: what="bus device reset function occurred"; break;
case 0x2904: what="device internal reset"; break;
case 0x2B00: what="copy can't execute since host can't disconnect";
diff -r -u ../linux-2.4.5/linux/drivers/usb/storage/transport.c linux/drivers/usb/storage/transport.c
--- ../linux-2.4.5/linux/drivers/usb/storage/transport.c Wed Apr 18 20:49:12 2001
+++ linux/drivers/usb/storage/transport.c Tue Jun 5 05:23:13 2001
@@ -793,6 +793,15 @@
/* If things are really okay, then let's show that */
if ((srb->sense_buffer[2] & 0xf) == 0x0)
srb->result = GOOD << 1;
+
+ /* A transition from non-ready to ready sounds OK. */
+ if ((srb->sense_buffer[2] & 0xf) == 0x6 /* unit attention */
+ && srb->sense_buffer[12] == 0x28
+ && srb->sense_buffer[13] == 0 /* not ready -> ready */) {
+ srb->result = GOOD << 1;
+ srb->sense_buffer[0] = 0;
+ }
+
} else /* if (need_auto_sense) */
srb->result = GOOD << 1;

makes things work.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/