On Sat, 1 Feb 2014, Steph Nguyen wrote:

> Hi
> 
> It seems that when sending SCSI commands over USB, the kernel doesn't 
> necessary build a sense response. For instance, when sending REQUEST 
> SENSE over ehci, the scsi_cmnd->sense_buffer is left NULL; if I run the 
> same REQUEST SENSE command over a direct SCSI connect, the kernel builds 
> the scsi_cmnd->sense_buffer.

There's no need for the kernel to build a sense buffer when sending a 
REQUEST SENSE command.  That command always succeeds, so there's no 
reason to ask for sense data which might explain why the command 
failed.

Your question isn't very precise.  How did you "run" a REQUEST SENSE
command?  When using usb-storage under normal conditions, the SCSI
layer doesn't ever send that command.

> So is there a reason why usb-storage doesn't build the sense buffer?

In general, usb-storage doesn't touch scsi_cmnd except to set 
scsi_cmnd->result.  (There are a few exceptions, but this is mostly 
true.)

If the SCSI layer wants to receive sense data, it has to set the 
scsi_cmnd->sense_buffer field itself.  Normally it does so.  For 
example, see what happens when the SCSI layer issues a TEST UNIT READY 
command to usb-storage.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to