From: Herbert Rosmanith <kernel@wildsau.enemy.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Q: how to send ATA cmds to USB drive?
Date: Mon, 12 Jun 2006 11:22:15 +0200 (MET DST) [thread overview]
Message-ID: <200606120922.k5C9MFMO011138@wildsau.enemy.org> (raw)
In-Reply-To: <1148469753.4753.4.camel@localhost.localdomain>
> > But now I also have to support USB harddisks from the same company.
> > The USB harddisk uses the same set of ATA commands as the IDE harddisk,
> > well, at least that's what I suppose.
>
> USB storage is a sort of 'pigdin' SCSI. You send SCSI commands to the
> USB storage device but you may find anything too clever breaks.
hm, that depends
on where "too much cleverness" is implemented.
I just noticed that scsi-commands I send to
via SG_IO get modified underway.
the userland program looks like this:
memset(cmd,0,16);
cmd[0]=0x24;
cmd[1]=0x24;
cmd[2]=0x01;
cmd[3]=0x01;
memset(&ioh,0,sizeof(ioh));
ioh.interface_id='S';
ioh.dxfer_direction=SG_DXFER_FROM_DEV;
ioh.dxferp = buf;
ioh.dxfer_len = 8;
ioh.cmdp=cmd;
ioh.cmd_len=16;
ioh.sbp=sbuf;
ioh.mx_sb_len=SG_MAX_SENSE;
ioh.timeout = 2000; // 2 sekunden
ioh.flags = SG_FLAG_DIRECT_IO;
if ((i=ioctl(fd,SG_IO,&ioh))==-1)
die("ioctl");
but what's really sent to the device is:
> usb_stor_Bulk_transport
Bulk Command S 0x43425355 T 0x2a L 8 F 0 Trg 0 LUN 0 CL 16
> usb_stor_bulk_transfer_buf (length=31)
55
53
42
43
2a
00
00
00
08
00
00
00
00
00
10
24
04
01
01
00
00
00
00
00
00
00
00
00
00
00
00
the data really sent is "0x24 0x04 0x01 0x01", which means that 0x20 gets
cleared in byte 2 (for whatever reason).
the specs I have (CY7C68310.pdf from http://www.rockbox.org/twiki/pub/Main/DataSheets/)
say that this field has to be 0x24 for ATACB commands. this is on page12. with the
ATACB, I want to implement TaskFileRead and TaskFileWrite (page 13).
the device is a "Low-Power USB 2.0 ATA/ATPAI Bridge IC".
do you have any idea why the data is modified and how I can prevent this?
kind regards,
herbert rosmanith
next prev parent reply other threads:[~2006-06-12 9:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-24 9:22 Herbert Rosmanith
2006-05-24 11:22 ` Alan Cox
2006-06-12 9:22 ` Herbert Rosmanith [this message]
2006-06-12 10:02 ` Herbert Rosmanith
2006-06-12 10:26 ` Herbert Rosmanith
[not found] <6fXQT-16z-11@gated-at.bofh.it>
2006-05-24 23:15 ` Robert Hancock
2006-05-24 23:33 ` Jeff Garzik
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=200606120922.k5C9MFMO011138@wildsau.enemy.org \
--to=kernel@wildsau.enemy.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/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®