On Sat, 25 Jun 2005 14:32:59 -0700 Pete Zaitcev wrote: | Make usbmon to print Setup packets of Control transfers. This is useful | when debugging enumeration issues.
Thanks, I was about to add this when you posted it. It works for me, but I'm sure that you tested it. Few minor typo corrections to usbmon.txt below. | This is a change to the trace format which is not fully compatible. | A parser has to look at the data length word now. If that word is | a character like 's', read setup packet before proceeding with data. | I decided not to bump the API tag for this because not many such | parsers exist at this point. | | Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]> | | diff -urp -X dontdiff linux-2.6.12/Documentation/usb/usbmon.txt linux-2.6.12-lem/Documentation/usb/usbmon.txt | --- linux-2.6.12/Documentation/usb/usbmon.txt 2005-06-21 12:57:54.000000000 -0700 | +++ linux-2.6.12-lem/Documentation/usb/usbmon.txt 2005-06-25 14:07:43.000000000 -0700 | @@ -101,6 +101,13 @@ Here is the list of words, from left to | or 3 and 2 positions, correspondingly. | - URB Status. This field makes no sense for submissions, but is present | to help scripts with parsing. In error case, it contains the error code. | + In case of a setup packet, it contains a Setup Tag. If scripts read a number | + in this field, the proceed to read Data Length. Otherwise, they read they | + the setup packet before reading the Data Length. | +- Setup packet, if present, consists of 5 words: one of each for bmRequestType, or: fields | + bRequest, wValue, wIndex, wLength, as specified by the USB Specification 2.0. | + These words are safe to decode if Setup Tag was 's'. Otherwise, the setup or: fields | + packet was present, but not captured, and the fields contain filler. | - Data Length. This is the actual length in the URB. | - Data tag. The usbmon may not always capture data, even if length is nonzero. | Only if tag is '=', the data words are present. | @@ -125,25 +132,31 @@ class ParsedLine { | String data_str = st.nextToken(); | Examples: | | -An input control transfer to get a port status: | +An input control transfer to get a port status. | | -d74ff9a0 2640288196 S Ci:001:00 -115 4 < | -d74ff9a0 2640288202 C Ci:001:00 0 4 = 01010100 | +d5ea89a0 3575914555 S Ci:001:00 s a3 00 0000 0003 0004 4 < | +d5ea89a0 3575914560 C Ci:001:00 0 4 = 01050000 | | An output bulk transfer to send a SCSI command 0x5E in a 31-byte Bulk wrapper | to a storage device at address 5: I chose to use PERL to make the usbmon output a little bit more readable (IMO). Yes, if you look at those lines above long enough, you (and I) can get it. If you (I) look at them occasionally, some help is useful. E.g, compare usbmon output: f09b3a2c 632766030 S Co:001:00 s 23 03 0004 0001 0000 0 f09b3a2c 632786006 C Co:001:00 0 0 f09b3a2c 632846012 S Ci:001:00 s a3 00 0000 0001 0004 4 < f09b3a2c 632846038 C Ci:001:00 0 4 = 03011000 f1f82ce8 632856005 C Ii:001:01 0 1 D f1f82ce8 632856015 S Ii:001:01 -115 2 D f09b3a2c 632866101 S Co:001:00 s 23 01 0014 0001 0000 0 f09b3a2c 632866111 C Co:001:00 0 0 f09b3a2c 632866133 S Ci:000:00 s 80 06 0100 0000 0040 64 < f09b3a2c 632866646 C Ci:000:00 0 8 = 12010002 00000008 f09b3a2c 632866833 S Co:001:00 s 23 03 0004 0001 0000 0 f09b3a2c 632886007 C Co:001:00 0 0 to the (slightly) annotated corresponding usbmondump output and you can see that the usbmon output looks simpler and cleaner. Oops. Oh well, I can clean it up a little by removing the elapsed time output... (but not tonight) If anyone has ideas or suggestions for this, please let me know. Anyway, the usbmondump output adds or changes: a. time is in microseconds format: sss.uuuuuu b. time elapsed since last monitor entry (microseconds) c. setup packet fields are labeled d. length and status are labeled (L=, St=) a. b. c. f09b3a2c 632.76603 +2.7e-05 S Co:001:00 [ReqType:23 Req:03 Val:0004 Indx:0001 Len:0000] L=0 d. f09b3a2c 632.786006 +0.019976 C Co:001:00 St=0 L=0 f09b3a2c 632.846012 +0.060006 S Ci:001:00 [ReqType:a3 Req:00 Val:0000 Indx:0001 Len:0004] L=4 f09b3a2c 632.846038 +2.6e-05 C Ci:001:00 St=0 L=4 = 03011000 f1f82ce8 632.856005 +0.009967 C Ii:001:01 St=0 L=1 D f1f82ce8 632.856015 +1e-05 S Ii:001:01 L=2 D f09b3a2c 632.866101 +0.010086 S Co:001:00 [ReqType:23 Req:01 Val:0014 Indx:0001 Len:0000] L=0 f09b3a2c 632.866111 +1e-05 C Co:001:00 St=0 L=0 f09b3a2c 632.866133 +2.2e-05 S Ci:000:00 [ReqType:80 Req:06 Val:0100 Indx:0000 Len:0040] L=64 f09b3a2c 632.866646 +0.000513 C Ci:000:00 St=0 L=8 = 12010002 00000008 f09b3a2c 632.866833 +0.000187 S Co:001:00 [ReqType:23 Req:03 Val:0004 Indx:0001 Len:0000] L=0 f09b3a2c 632.886007 +0.019174 C Co:001:00 St=0 L=0 The usbmondump.pl script is available at: http://www.xenotime.net/linux/scripts/usbmondump.pl --- ~Randy ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel