lkml.org 
[lkml]   [2006]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Q: how to send ATA cmds to USB drive?
Date
> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-12 12:10    [W:0.036 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site