On Sun, Feb 10, 2008 at 10:55:14PM -0500, Alan Stern wrote: > On Sun, 10 Feb 2008, Peter Rasmussen wrote: > > > I mean, I do have trouble decoding these lines: > > > > usb-storage: Command INQUIRY (6 bytes) > > usb-storage: 12 00 00 00 24 00 > > usb-storage: Bulk Command S 0x43425355 T 0x1 L 36 F 128 Trg 0 LUN 0 CL 6 > > > > But then, what do I know :-) > > Well, sure... That log output was never meant for casual users like > yourself. It's debugging information, meant for use by developers. > That's one reason why it doesn't appear unless you enable > CONFIG_USB_STORAGE_DEBUG.
So... every so often this does come up. People want to understand. So,
for the sake of the list archives, here's a quick decoder:
> > usb-storage: Command INQUIRY (6 bytes)
> > usb-storage: 12 00 00 00 24 00
This is the beginning of a command. The SCSI mid-layer passes us an
struct scsi_request, which contains an array of command bytes (up to 16).
Only some of the bytes are valid (indicated by a field in the structure).
The command decodes to INQUIRY. You only get that if you have the SCSI
debug tables (which have the text names for all the commands) compiled in.
The command indicates that 6 bytes of the command array are valid.
The next line are the command bytes in question. If you grab a copy of the
SCSI specification, you can decode these directly.
Next:
> > usb-storage: Bulk Command S 0x43425355 T 0x1 L 36 F 128 Trg 0 LUN 0 CL 6
USB Storage basically breaks everything down into 3 phases: command, data
(optional), and status. There are a few ways to pack these phases onto the
wire; the most common is officially called "Bulk-only".
In the bulk-only transport, commands are sent to the device in a particular
structure. This line breaks out the fields of that structure.
Specifically, these are:
S - Signature
T - Tag
L - Requested transfer length
F - flags
Trg - Target number
LUN - Logical Unit Number
CL - command length
Some of these fields are constant. The rest are derived in some way from
the struct scsi_request.
Anyway, that's the 'executive summary'. If you want to see data flowing
back-and-forth from your device, the debug gives you a pretty good
low-level view of how that flow is controlled, but not the data itself.
usb-storage never actually dumps out the data blocks being exchanged, only
the transport framing and packing of those exchanges.
Matt
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
What, are you one of those Microsoft-bashing Linux freaks?
-- Customer to Greg
User Friendly, 2/10/1999
pgpiGyUpZM8Hx.pgp
Description: PGP signature
