From: Herbert Rosmanith <kernel@wildsau.enemy.org>
To: linux-kernel@vger.kernel.org
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: Q: how to send ATA cmds to USB drive?
Date: Mon, 12 Jun 2006 12:02:41 +0200 (MET DST) [thread overview]
Message-ID: <200606121002.k5CA2gGf011148@wildsau.enemy.org> (raw)
In-Reply-To: <200606120922.k5C9MFMO011138@wildsau.enemy.org>
> the userland program looks like this:
>
> memset(cmd,0,16);
> cmd[0]=0x24;
> cmd[1]=0x24;
> cmd[2]=0x01;
> cmd[3]=0x01;
...
> if ((i=ioctl(fd,SG_IO,&ioh))==-1)
> die("ioctl");
>
...
> the data really sent is "0x24 0x04 0x01 0x01", which means that 0x20 gets
> cleared in byte 2 (for whatever reason).
>
> do you have any idea why the data is modified and how I can prevent this?
ok, got it:
int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
...
/*
* If SCSI-2 or lower, store the LUN value in cmnd.
*/
if (cmd->device->scsi_level <= SCSI_2) {
cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
(cmd->device->lun << 5 & 0xe0);
}
hm. now what .... ? If scsi-2 requires this, and the device is scsi-2 (in fact,
cmd->device->scsi_level equals 3, which means SCSI_2) then the device is a violation
of the scsi-specs. do you have any suggestion how to fix this (beside from commenting
the source)
kind regards,
herbert rosmanith
next prev parent reply other threads:[~2006-06-12 10:08 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
2006-06-12 10:02 ` Herbert Rosmanith [this message]
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=200606121002.k5CA2gGf011148@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®