mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Harkes <jaharkes@cs.cmu.edu>
To: Andrey Panin <pazke@orbita1.ru>
Cc: linux-kernel@vger.kernel.org, linux-usb-users@lists.sourceforge.net
Subject: Re: USB harddrive not working (2.4, 2.5)
Date: Fri, 21 Mar 2003 13:22:30 -0500	[thread overview]
Message-ID: <20030321182230.GA25297@delft.aura.cs.cmu.edu> (raw)
In-Reply-To: <20030319102117.GA689@pazke>

On Wed, Mar 19, 2003 at 01:21:17PM +0300, Andrey Panin wrote:
> Hi,
> 
> ISD200 based hard drive bay doesn't work with 2.4 & 2.5, 
> can someone assist me with it?

This looks like the same problem I was seeing with my Archos. The
initial probes for ATA devices fail and the driver falls back to
'transparent scsi mode', where it passes everything along unchanged.
Probably works fine when an ATAPI device is attached, but not with my
drive.

> usb-storage:    isd200_action(ENUM,0xa0)
> usb-storage: Bulk command S 0x43425355 T 0x0 Trg 0 LUN 1 L 0 F 0 CL 0
> usb-storage: usb_stor_bulk_transfer_buf(): xfer 31 bytes
> usb-storage: Status code 0; transferred 31/31
> usb-storage: -- transfer complete
> usb-storage: Bulk command transfer result=0
> usb-storage: Attempting to get CSW...
> usb-storage: usb_stor_bulk_transfer_buf(): xfer 13 bytes
> usb-storage: Status code -32; transferred 0/13

The isd200 driver is not correctly initializing the srb.cmd_len field,
which is the main reason why things fail. I also noticed that the
usb_stor_bulk functions are interpreting the ATA commands as if they
were scsi, so the packet was sent to the wrong lun, but that might not
really matter much.

Here is a patch agains 2.5.64 that fixes both of these problems for me.
It will probably apply to 2.5.65 as well.

Jan


--- drivers/usb/storage/isd200.c.orig	2003-02-10 15:51:05.000000000 -0500
+++ drivers/usb/storage/isd200.c	2003-03-16 14:24:12.000000000 -0500
@@ -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
--- drivers/usb/storage/transport.c.orig	2003-02-25 23:27:18.000000000 -0500
+++ drivers/usb/storage/transport.c	2003-03-16 13:42:22.000000000 -0500
@@ -893,7 +893,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;


  parent reply	other threads:[~2003-03-21 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-19 10:21 Andrey Panin
2003-03-19 15:28 ` [Linux-usb-users] " Stephen J. Gowdy
2003-03-21 18:22 ` Jan Harkes [this message]
2003-03-24 10:04   ` Andrey Panin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030321182230.GA25297@delft.aura.cs.cmu.edu \
    --to=jaharkes@cs.cmu.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-users@lists.sourceforge.net \
    --cc=pazke@orbita1.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®