On Sat, 2005-12-03 at 07:00 -0800, Pat LaVarre wrote: > >> I have a USB bridge that's implementing SAT passthru cdbs. We ran > >> into an > >> issue with the usb-storage driver in that when it does auto-sense > >> (because > >> the CK_COND bit is set in the passthru cdb), the driver does a > >> sense with > >> only 18 bytes for the sense buffer. The problem is that SAT > >> passthru wants > >> to return 22 bytes of sense data. The last 4 bytes that don't get > >> returned > >> are fairly important ATA task files registers: lba high hob, lba > >> high, > >> device, and status. > >> > >> For testing purposes I use the patch below, but what's the correct > >> way to > >> deal with this issue? Is there something in the USB spec > >> mandating 18 bytes > >> of sense data, or is the usb-storage simply making a hard-coded > >> assumption? > > > > I believe it's a hard-coded assumption, based on the observation > > that many > > USB devices don't like it if you ask for more or less than 18 > > bytes. Matt > > Dharm can correct this if I'm wrong. > > > > The sense buffer length is yet another quantity that ought to have > > an SG > > passthru but doesn't. > > The spec here is de facto, not de jure. > > De jure, the host should only send SCSI op x03 "Request Sense" > requests that allow the max of xFF (255) sense data bytes in, because > these requests are defined as the obscenity of a read-and-clear > request. A host that instead rudely asks for less than all possible > sense bytes risks irrecoverably discarding sense bytes before the > device reports that they exist, thru the additional length byte. > Hosts have that right only when out-of-band they know enough about > the device to predict what the additional sense length will be. > > De facto, best as I mis/remember, Windows ME/ 98/ 95 asked often for > x0E (14) bytes and Win XP/ 2K/ NT now asks often for x12 (18) bytes. > Furthermore, Windows ignores the additional length byte. > > Consequently, naturally, yes, because of the rudeness of those many > hosts, now many commodity peripheral storage devices choke over a > request for anything other than x12 (18) bytes, and give the host > zero or other noise in the additional sense byte.
FYI when doing the equivalent of SG_IO on Windows to the same bridge, we can get back all 22 sense bytes by specifying that in the passthru structure. So while Windows may internally only want to deal with specific sizes, when user-space asks for a size, it seems to obey it. Tim ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Linux-usb-users@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-users