summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorStefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>2019-06-17 20:01:58 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2019-06-20 20:06:03 +0200
commit2662a5902dce3c99ec6a5d68d37df253f38d6fc0 (patch)
treee51b00cbbc56acf9582732a8274cbe77d648b1c4 /decoders
parent37c120b9629d6671273703166cce94a8200d9476 (diff)
downloadlibsigrokdecode-2662a5902dce3c99ec6a5d68d37df253f38d6fc0.tar.gz
libsigrokdecode-2662a5902dce3c99ec6a5d68d37df253f38d6fc0.zip
usb_request: Allow configuration of BULK IN transfer display
From a protocol level, a BULK IN transfer starts when the host starts polling the respective endpoint. For analysis, it is sometimes useful to show when the devices starts to answer the requests. As both are useful for different use cases (the old, default one emphasizes the host behavior, the new one shows the endpoint/device behavior), make the display configurable.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/usb_request/pd.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py
index 71097a1..3f46788 100644
--- a/decoders/usb_request/pd.py
+++ b/decoders/usb_request/pd.py
@@ -120,6 +120,10 @@ class Decoder(srd.Decoder):
license = 'gplv2+'
inputs = ['usb_packet']
outputs = ['usb_request']
+ options = (
+ {'id': 'in_request_start', 'desc': 'Start IN requests on',
+ 'default': 'submit', 'values': ('submit', 'first-ack')},
+ )
tags = ['PC']
annotations = (
('request-setup-read', 'Setup: Device-to-host'),
@@ -180,6 +184,7 @@ class Decoder(srd.Decoder):
def start(self):
self.out_binary = self.register(srd.OUTPUT_BINARY)
self.out_ann = self.register(srd.OUTPUT_ANN)
+ self.in_request_start = self.options['in_request_start']
def handle_transfer(self):
request_started = 0
@@ -197,7 +202,7 @@ class Decoder(srd.Decoder):
if not (addr, ep) in self.request:
self.request[(addr, ep)] = {'setup_data': [], 'data': [],
'type': None, 'ss': self.ss_transaction, 'es': None,
- 'id': self.request_id, 'addr': addr, 'ep': ep}
+ 'ss_data': None, 'id': self.request_id, 'addr': addr, 'ep': ep}
self.request_id += 1
request_started = 1
request = self.request[(addr,ep)]
@@ -209,6 +214,8 @@ class Decoder(srd.Decoder):
# BULK or INTERRUPT transfer
if request['type'] in (None, 'BULK IN') and self.transaction_type == 'IN':
request['type'] = 'BULK IN'
+ if len(request['data']) == 0 and len(self.transaction_data) > 0:
+ request['ss_data'] = self.ss_transaction
request['data'] += self.transaction_data
self.handle_request(request_started, request_end)
elif request['type'] in (None, 'BULK OUT') and self.transaction_type == 'OUT':
@@ -279,7 +286,9 @@ class Decoder(srd.Decoder):
addr = self.transaction_addr
request = self.request[(addr, ep)]
- ss, es = request['ss'], request['es']
+ ss, es, ss_data = request['ss'], request['es'], request['ss_data']
+ if self.in_request_start == 'submit':
+ ss_data = ss
if request_start == 1:
# Issue PCAP 'SUBMIT' packet.
@@ -296,7 +305,7 @@ class Decoder(srd.Decoder):
elif request['type'] == 'SETUP OUT':
self.putr(ss, es, [1, ['SETUP out: %s' % summary]])
elif request['type'] == 'BULK IN':
- self.putr(ss, es, [2, ['BULK in: %s' % summary]])
+ self.putr(ss_data, es, [2, ['BULK in: %s' % summary]])
elif request['type'] == 'BULK OUT':
self.putr(ss, es, [3, ['BULK out: %s' % summary]])