public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: usb storage traces
@ 2003-12-04 18:30 Alan Stern
  2003-12-04 18:44 ` Matthew Dharm
  2003-12-05  4:31 ` Douglas Gilbert
  0 siblings, 2 replies; 30+ messages in thread
From: Alan Stern @ 2003-12-04 18:30 UTC (permalink / raw)
  To: SCSI development list

Here is a digested version of a log trace contributed by Alex Sanks.  It 
was collected from a generic USB Bulk-only storage device (actually the 
g_file_storage file-backed storage gadget) attached to a host running 
Windows XP SP1.  It agrees quite well with the results of my own tests 
using USB Snoopy on a Windows 2000 host.

In this trace, the number following the command name is the command length
in decimal; following it are the command bytes in hex, then the direction
and transfer length in decimal.


INQUIRY		6: 12 00 00 00 24 00  In 36
Vendor-specific	10: 23 00 00 00 00 00 00 00 fc 00  In 252
	Provokes an Invalid Command error
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18
	Bug in Windows: REQUEST-SENSE is really a 6-byte command

Vendor-specific	10: 23 00 00 00 00 00 00 00 fc 00  In 252
	Retry previous failed command; it still doesn't work
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18
Vendor-specific	10: 23 00 00 00 00 00 00 00 fc 00  In 252
	Another futile retry
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18

READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	Provokes Unit Attention: Reset Occurred
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	This time it works

READ		10: 28 00 00 00 00 00 00 00 01 00  In 512
	Read the first sector
READ		10: 28 00 00 00 00 00 00 00 01 00  In 512
	Windows likes reading the first sector
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	It also likes reading the disk capacity

MODE-SENSE	6: 1a 00 1c 00 c0 00  In 192
	Page 1c is listed as reserved; I don't know what it is;
	provokes Invalid Field in CDB error
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18

MODE-SENSE	6: 1a 00 3f 00 c0 00  In 192
	So page 3f should work if we request 192 bytes!

MODE-SENSE	6: 1a 00 08 00 c0 00  In 192
	And so should page 08!

MODE-SELECT	6: 15 10 00 00 18 00  Out 24
	Although not shown here, a USB Snoopy trace reveals that this
	attempts to set the WCE (write cache enable) bit in page 8;
	here it provokes Invalid Field in CDB error
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18

MODE-SELECT	6: 15 10 00 00 18 00  Out 24
	Retry of previous failed command; it fails again
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18

READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	Windows really likes to get the capacity!
READ		10: 28 00 00 00 00 00 00 00 01 00  In 512
	And it really likes to read the first sector!
READ		10: 28 00 00 00 00 00 00 00 01 00  In 512
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
READ		10: 28 00 00 00 00 00 00 00 01 00  In 512
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	Ommitted: this command was repeated 8 times

TEST-UNIT-READY	6: 00 00 00 00 00 00  
MODE-SENSE	6: 1a 00 00 00 0c 00  In 12
	I don't know what Windows expects to find in page 0;
	but this fails
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18

READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
	Ommitted: this command was repeated 3 times

TEST-UNIT-READY	6: 00 00 00 00 00 00  
MODE-SENSE	6: 1a 00 00 00 0c 00  In 12
	Fails again
REQUEST-SENSE	12: 03 00 00 00 12 00 00 00 00 00 00 00  In 18
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8
READ-CAPACITY	10: 25 00 00 00 00 00 00 00 00 00  In 8


Some of the activity may depend on the contents of the partition table
stored in the first sector.  But it seems clear that, subject to the
unknown function of command x23 and of mode page x1c, we might be able to
work with devices that advertise themselves as Bulk-only by requesting 192
bytes from page x3f and page 8.

Does anybody know what command x23 and mode page x1c do?  Although 
nominally vendor-specific, they must be reasonably standardized if Windows 
can get away with using them on a generic device.

Unfortunately, there's nothing to stop a manufacturer from supplying their
own driver which would avoid reading those pages.  So even an apparently
normal device might react badly to these commands.  However I think it's 
still worth a try.

Alan Stern





^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2003-12-16 17:08 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-04 18:30 usb storage traces Alan Stern
2003-12-04 18:44 ` Matthew Dharm
2003-12-04 20:59   ` Alan Stern
2003-12-04 21:27     ` Matthew Dharm
2003-12-04 21:33     ` Pat LaVarre
2003-12-04 21:34     ` Pat LaVarre
2003-12-04 21:37     ` Pat LaVarre
2003-12-04 21:38     ` Pat LaVarre
2003-12-04 22:24       ` Pat LaVarre
2003-12-04 22:28         ` Pat LaVarre
2003-12-05  3:56         ` Informational Exception mpage [was: usb storage traces] Douglas Gilbert
2003-12-05 15:32           ` Alan Stern
2003-12-05 16:02             ` Pat LaVarre
2003-12-05 15:01         ` usb storage traces Alan Stern
2003-12-05 17:18           ` bCWBCBLength is cb length no when Pat LaVarre
2003-12-05 18:55             ` Alan Stern
2003-12-05 19:29               ` Pat LaVarre
2003-12-05 17:19           ` usb storage traces Pat LaVarre
2003-12-05 18:22             ` Alan Stern
2003-12-05  5:08     ` Patrick Mansfield
2003-12-05 16:01       ` Alan Stern
2003-12-05 16:11         ` Pat LaVarre
2003-12-05 17:14           ` David Brownell
2003-12-05 17:35             ` Pat LaVarre
2003-12-05 18:21               ` Alan Stern
2003-12-05 18:41                 ` Pat LaVarre
2003-12-05 18:24               ` David Brownell
2003-12-16 17:00             ` Randy.Dunlap
2003-12-16 17:07               ` Pat LaVarre
2003-12-05  4:31 ` Douglas Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox