These two patches make the NZ90 memory stick import work correctly as a usb-storage
device under RedHat 8 running kernel 2.4.20-18.8. - and will probably work under 2.4.20-20...
nz90-usb-storage.patch:
- the NZ90 doesn't like seeing prevent/allow medium removal commands, so I've just
stopped sending them. I should probably have a little more smarts here (only skip them
when dealing with an NZ90), but I'm a bit lazy... and the NZ is the only USB storage
device I have...
- on the _very_first_ inquiry command after MS-import has started, the NZ90 returns
Unit Attention, Check condition, Transition from not-ready to ready. This (incorrectly,
IMHO) caused the transport system to lock the device. The patch arranges for the INQUIRY
to always trigger a REQUEST SENSE, reading and clearing the condition, and to ignore
the incorrect error status.
kudzu-clie.patch:
- I ran into a problem with updfstab deleting the fstab entry for /dev/cdrom(!) and
recreating it every time the NZ90 connected/disconnected. This is a fairly minor
bug in kudzus' scsi probe - it assumes (incorrectly) that the first entry in /proc/bus/usb-storage
is always scsi host 0.
Incidentally, you will also want to add:
device clie {
partition 1
match hd sony
}As the first device entry in your /etc/updfstab.conf.default file.
diff -uNr kernel-2.4.20/linux-2.4.20/drivers/usb/storage/protocol.c
kernel-2.4.20.new/linux-2.4.20/drivers/usb/storage/protocol.c
--- kernel-2.4.20/linux-2.4.20/drivers/usb/storage/protocol.c 2002-08-02
18:39:45.000000000 -0600
+++ kernel-2.4.20.new/linux-2.4.20/drivers/usb/storage/protocol.c 2003-08-21
13:56:39.000000000 -0600
@@ -170,7 +170,12 @@
usb_stor_scsiSense6to10(srb);
/* send the command to the transport layer */
- usb_stor_invoke_transport(srb, us);
+
+ if(srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
+ srb->result = GOOD << 1;
+ } else {
+ usb_stor_invoke_transport(srb, us);
+ }
if (srb->result == GOOD << 1) {
/* Fix the MODE_SENSE data if we translated the command */
diff -uNr kernel-2.4.20/linux-2.4.20/drivers/usb/storage/transport.c
kernel-2.4.20.new/linux-2.4.20/drivers/usb/storage/transport.c
--- kernel-2.4.20/linux-2.4.20/drivers/usb/storage/transport.c 2003-08-28
09:26:47.000000000 -0600
+++ kernel-2.4.20.new/linux-2.4.20/drivers/usb/storage/transport.c 2003-08-21
13:58:35.000000000 -0600
@@ -670,6 +670,7 @@
need_auto_sense = 0;
}
}
+ if(srb->cmnd[0] == INQUIRY) need_auto_sense = 1;
/*
* If we have a failure, we're going to do a REQUEST_SENSE
@@ -788,6 +789,10 @@
/* If things are really okay, then let's show that */
if ((srb->sense_buffer[2] & 0xf) == 0x0)
srb->result = GOOD << 1;
+ if ((srb->sense_buffer[2] & 0xf) == 0x6 && srb->sense_buffer[12] ==
0x28 && srb->sense_buffer[13] == 0) {
+ srb->result = GOOD << 1;
+ srb->sense_buffer[0] = 0;
+ }
} else /* if (need_auto_sense) */
srb->result = GOOD << 1;
@@ -836,8 +841,13 @@
/* was this a command-completion interrupt? */
if (us->irqbuf[0] && (us->subclass != US_SC_UFI)) {
- US_DEBUGP("-- not a command-completion IRQ\n");
- return;
+ if(us->irqbuf[0] == 0x28) {
+ /* RAP - look here! */
+ // us->irqbuf[0] = 0; do nothing for now...
+ } else {
+ US_DEBUGP("-- not a command-completion IRQ\n");
+ return;
+ }
}
/* was this a wanted interrupt? */
@@ -964,6 +974,7 @@
if (us->irqdata[0]) {
US_DEBUGP("CBI IRQ data showed reserved bType %d\n",
us->irqdata[0]);
+ if(us->irqdata[0] == 0x28) return(USB_STOR_TRANSPORT_GOOD);
return USB_STOR_TRANSPORT_ERROR;
}
diff -uNr kudzu-0.99.69/scsi.c kudzu-0.99.69.new/scsi.c
--- kudzu-0.99.69/scsi.c 2002-07-11 12:26:45.000000000 -0600
+++ kudzu-0.99.69.new/scsi.c 2003-08-28 10:00:17.000000000 -0600
@@ -290,7 +290,7 @@
*(end + 1) = '\0';
if (*chptr == '0' || !strcasecmp(chptr, "no")) {
- numMissingHosts[numMissing++] = num - 1;
+ numMissingHosts[numMissing++] = atoi(ent->d_name);
}
}
}
