ChangeSet 1.985.10.15, 2003/03/25 13:45:34-08:00, mdharm-usb@one-eyed-alien.net [PATCH] usb-storage: LUN and isd200 This patch (developed with assistance from Jan Harkes ) 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. drivers/usb/storage/isd200.c | 5 +++++ drivers/usb/storage/transport.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c --- a/drivers/usb/storage/isd200.c Tue Mar 25 16:45:13 2003 +++ b/drivers/usb/storage/isd200.c Tue Mar 25 16:45:13 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 -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c --- a/drivers/usb/storage/transport.c Tue Mar 25 16:45:13 2003 +++ b/drivers/usb/storage/transport.c Tue Mar 25 16:45:13 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;