diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2015-10-04 00:43:38 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2015-10-06 18:13:15 +0200 |
commit | bd0e7d2e71e7a05b2bb0686a86a75b8fcb92fd54 (patch) | |
tree | 6f2aefd769730aaa190cd137ee3761ef90c17b55 /decoders/usb_request/__init__.py | |
parent | 91a19cb31778ccb6db79c4d4d75d993d974ebae0 (diff) | |
download | libsigrokdecode-bd0e7d2e71e7a05b2bb0686a86a75b8fcb92fd54.tar.gz libsigrokdecode-bd0e7d2e71e7a05b2bb0686a86a75b8fcb92fd54.zip |
usb_request: USB transaction decoder and PCAP generator
The new decoder stacks on top of the usb_packet PD. It adds one new
annotation row, and is able to save the decoded data as PCAP trace.
It has been successfully tested against all traces in sigrok-dumps and
some more traces.
Diffstat (limited to 'decoders/usb_request/__init__.py')
-rw-r--r-- | decoders/usb_request/__init__.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/decoders/usb_request/__init__.py b/decoders/usb_request/__init__.py new file mode 100644 index 0000000..7a156ff --- /dev/null +++ b/decoders/usb_request/__init__.py @@ -0,0 +1,50 @@ +## +## This file is part of the libsigrokdecode project. +## +## Copyright (C) 2015 Stefan Brüns <stefan.bruens@rwth-aachen.de> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +## + +''' +This decoder stacks on top of the 'usb_packet' PD and decodes the USB +(low-speed and full-speed) transactions. + +Transactions and requests are tracked per device address and endpoint. + +Tracking of CONTROL requests is quite accurate, as these always start with +a SETUP token and are completed by an IN or OUT transaction, the status +packet. All transactions during the DATA stage are combined. + +For BULK and INTERRUPT requests, each transaction starts with an IN or OUT +request, and is considered completed after the first transaction containing +data has been ACKed. Normally a request is only completed after a short or +zero length packet, but this would require knowledge about the max packet +size of an endpoint. + +All INTERRUPT requests are treated as BULK requests, as on the link layer +both are identical. + +The PCAP binary output contains 'SUBMIT' and 'COMPLETE' records. For +CONTROL request, the SUBMIT contains the SETUP request, the data is +either contained in the SUBMIT (Host-to-Device) or the COMPLETE +(Device-to-Host) record. + +Details: +https://en.wikipedia.org/wiki/USB +http://www.usb.org/developers/docs/ +''' + +from .pd import Decoder |