On Sat, 1 Feb 2014, Steph Nguyen wrote:
> To be clear, here's what I meant by "build" - I'm just pasting the
> relevant bits of the code:
>
> static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct
> us_data *us) {
> ...
> unsigned char *sb = srb->sense_buffer;
> ...
> if ((srb->result != (DID_ERROR << 16) && srb->result != (DID_ABORT <<
> 16)) && ...)
> memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
> ...
> sb[0] = 0x72;
>
> So, unless I'm completely misunderstanding the code, here the command is
> supposed to have completed successfully, isn't it? And the
> sense_buffer[0] is filled with 0x72 when it completes successfully.
That's right. But here the command isn't a SCSI command; it's an ATA
command getting sent over a SCSI transport.
Furthermore, this doesn't happen unless scsi_cmnd->cmnd[2] & 0x20 is
nonzero (part of the "if" condition that you left out), which
apparently is a flag indicating that the command is always supposed to
return sense data, even when it completes normally (the comment calls
it "ck_cond").
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html