aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/usb
diff options
context:
space:
mode:
authorPete Zaitcev <zaitcev@redhat.com>2011-02-04 00:01:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 14:46:57 -0500
commitd25bc4db723a44c097268b466ff74bfba4bcc4f3 (patch)
tree95d78f5ccb66cec86e74a536637710c5f33b75a6 /Documentation/usb
parentac8d67417816fa7c568b24a8f2891eb02e6d0462 (diff)
USB: usbmon: fix-up docs and text API for sparse ISO
This is based on a patch that Alan Stern wrote. It did the same simple thing in both text and binary cases. In the same time, Marton and I fixed the binary side properly, but this leaves the text to be fixed. It is not very important due to low maxium data size of text, but let's add it just for extra correctness. The pseudocode is too much to keep fixed up, and we have real code to be used as examples now, so let's drop it too. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/usb')
-rw-r--r--Documentation/usb/usbmon.txt42
1 files changed, 9 insertions, 33 deletions
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
index 66f92d1194c1..a4efa0462f05 100644
--- a/Documentation/usb/usbmon.txt
+++ b/Documentation/usb/usbmon.txt
@@ -12,6 +12,10 @@ Controller Drivers (HCD). So, if HCD is buggy, the traces reported by
12usbmon may not correspond to bus transactions precisely. This is the same 12usbmon may not correspond to bus transactions precisely. This is the same
13situation as with tcpdump. 13situation as with tcpdump.
14 14
15Two APIs are currently implemented: "text" and "binary". The binary API
16is available through a character device in /dev namespace and is an ABI.
17The text API is deprecated since 2.6.35, but available for convenience.
18
15* How to use usbmon to collect raw text traces 19* How to use usbmon to collect raw text traces
16 20
17Unlike the packet socket, usbmon has an interface which provides traces 21Unlike the packet socket, usbmon has an interface which provides traces
@@ -162,39 +166,11 @@ Here is the list of words, from left to right:
162 not machine words, but really just a byte stream split into words to make 166 not machine words, but really just a byte stream split into words to make
163 it easier to read. Thus, the last word may contain from one to four bytes. 167 it easier to read. Thus, the last word may contain from one to four bytes.
164 The length of collected data is limited and can be less than the data length 168 The length of collected data is limited and can be less than the data length
165 report in Data Length word. 169 reported in the Data Length word. In the case of an Isochronous input (Zi)
166 170 completion where the received data is sparse in the buffer, the length of
167Here is an example of code to read the data stream in a well known programming 171 the collected data can be greater than the Data Length value (because Data
168language: 172 Length counts only the bytes that were received whereas the Data words
169 173 contain the entire transfer buffer).
170class ParsedLine {
171 int data_len; /* Available length of data */
172 byte data[];
173
174 void parseData(StringTokenizer st) {
175 int availwords = st.countTokens();
176 data = new byte[availwords * 4];
177 data_len = 0;
178 while (st.hasMoreTokens()) {
179 String data_str = st.nextToken();
180 int len = data_str.length() / 2;
181 int i;
182 int b; // byte is signed, apparently?! XXX
183 for (i = 0; i < len; i++) {
184 // data[data_len] = Byte.parseByte(
185 // data_str.substring(i*2, i*2 + 2),
186 // 16);
187 b = Integer.parseInt(
188 data_str.substring(i*2, i*2 + 2),
189 16);
190 if (b >= 128)
191 b *= -1;
192 data[data_len] = (byte) b;
193 data_len++;
194 }
195 }
196 }
197}
198 174
199Examples: 175Examples:
200 176