]> sigrok.org Git - libsigrokdecode.git/blame - decoders/usb_request/__init__.py
usb_request: USB transaction decoder and PCAP generator
[libsigrokdecode.git] / decoders / usb_request / __init__.py
CommitLineData
bd0e7d2e
SB
1##
2## This file is part of the libsigrokdecode project.
3##
4## Copyright (C) 2015 Stefan Brüns <stefan.bruens@rwth-aachen.de>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
20
21'''
22This decoder stacks on top of the 'usb_packet' PD and decodes the USB
23(low-speed and full-speed) transactions.
24
25Transactions and requests are tracked per device address and endpoint.
26
27Tracking of CONTROL requests is quite accurate, as these always start with
28a SETUP token and are completed by an IN or OUT transaction, the status
29packet. All transactions during the DATA stage are combined.
30
31For BULK and INTERRUPT requests, each transaction starts with an IN or OUT
32request, and is considered completed after the first transaction containing
33data has been ACKed. Normally a request is only completed after a short or
34zero length packet, but this would require knowledge about the max packet
35size of an endpoint.
36
37All INTERRUPT requests are treated as BULK requests, as on the link layer
38both are identical.
39
40The PCAP binary output contains 'SUBMIT' and 'COMPLETE' records. For
41CONTROL request, the SUBMIT contains the SETUP request, the data is
42either contained in the SUBMIT (Host-to-Device) or the COMPLETE
43(Device-to-Host) record.
44
45Details:
46https://en.wikipedia.org/wiki/USB
47http://www.usb.org/developers/docs/
48'''
49
50from .pd import Decoder