From bd0e7d2e71e7a05b2bb0686a86a75b8fcb92fd54 Mon Sep 17 00:00:00 2001 From: Stefan Brüns Date: Sun, 4 Oct 2015 00:43:38 +0200 Subject: 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. --- decoders/usb_request/__init__.py | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 decoders/usb_request/__init__.py (limited to 'decoders/usb_request/__init__.py') 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 +## +## 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 -- cgit v1.2.3-70-g09d2