This patch (developed with assistance from Jan Harkes
<[EMAIL PROTECTED]>) makes the LUN field of a bulk-only transport come
from a known-good source, rather than the likely-good command-byte.  It
also updates the ISD200 driver to work with this change.

Greg, please apply.

Matt

diff -uN --exclude-from=../projects/dontdiff greg-tree/drivers/usb/storage/isd200.c 
staging-area/drivers/usb/storage/isd200.c
--- greg-tree/drivers/usb/storage/isd200.c      Wed Mar 19 08:48:42 2003
+++ staging-area/drivers/usb/storage/isd200.c   Thu Mar 20 07:46:53 2003
@@ -405,11 +405,14 @@
 {
        union ata_cdb ata;
        struct scsi_cmnd srb;
+       struct scsi_device srb_dev;
        struct isd200_info *info = (struct isd200_info *)us->extra;
        int status;
 
        memset(&ata, 0, sizeof(ata));
        memset(&srb, 0, sizeof(srb));
+       memset(&srb_dev, 0, sizeof(srb_dev));
+       srb.device = &srb_dev;
 
        ata.generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
        ata.generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -479,6 +482,7 @@
        }
 
        memcpy(srb.cmnd, &ata, sizeof(ata.generic));
+       srb.cmd_len = sizeof(ata.generic);
        status = usb_stor_Bulk_transport(&srb, us);
        if (status == USB_STOR_TRANSPORT_GOOD)
                status = ISD200_GOOD;
@@ -538,6 +542,7 @@
        /* send the command to the transport layer */
        srb->resid = 0;
        memcpy(srb->cmnd, ataCdb, sizeof(ataCdb->generic));
+       srb->cmd_len = sizeof(ataCdb->generic);
        transferStatus = usb_stor_Bulk_transport(srb, us);
 
        /* if the command gets aborted by the higher layers, we need to
diff -uN --exclude-from=../projects/dontdiff greg-tree/drivers/usb/storage/transport.c 
staging-area/drivers/usb/storage/transport.c
--- greg-tree/drivers/usb/storage/transport.c   Wed Mar 19 08:48:42 2003
+++ staging-area/drivers/usb/storage/transport.c        Thu Mar 20 07:46:54 2003
@@ -900,7 +900,7 @@
        bcb.DataTransferLength = cpu_to_le32(transfer_length);
        bcb.Flags = srb->sc_data_direction == SCSI_DATA_READ ? 1 << 7 : 0;
        bcb.Tag = srb->serial_number;
-       bcb.Lun = srb->cmnd[1] >> 5;
+       bcb.Lun = srb->device->lun;
        if (us->flags & US_FL_SCM_MULT_TARG)
                bcb.Lun |= srb->device->id << 4;
        bcb.Length = srb->cmd_len;

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

It was a new hope.
                                        -- Dust Puppy
User Friendly, 12/25/1998

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to