]> sigrok.org Git - libsigrokdecode.git/commitdiff
usb_request: Remove code duplication, save end sample in central location
authorStefan Brüns <redacted>
Sat, 22 Jul 2017 18:17:10 +0000 (20:17 +0200)
committerStefan Brüns <redacted>
Sat, 22 Jul 2017 18:17:10 +0000 (20:17 +0200)
decoders/usb_request/pd.py

index 76e015b93d52fcb9a32d040f0cbb184096b5d5fc..1bd287851f5a90a9b230adbf21ef24d3c2a37da8 100644 (file)
@@ -196,18 +196,17 @@ class Decoder(srd.Decoder):
         request = self.request[(addr,ep)]
 
         if request_end:
+            request['es'] = self.es_transaction
             request['handshake'] = self.handshake
 
         # BULK or INTERRUPT transfer
         if request['type'] in (None, 'BULK IN') and self.transaction_type == 'IN':
             request['type'] = 'BULK IN'
             request['data'] += self.transaction_data
-            request['es'] = self.es_transaction
             self.handle_request(request_started, request_end)
         elif request['type'] in (None, 'BULK OUT') and self.transaction_type == 'OUT':
             request['type'] = 'BULK OUT'
             request['data'] += self.transaction_data
-            request['es'] = self.es_transaction
             self.handle_request(request_started, request_end)
 
         # CONTROL, SETUP stage
@@ -233,11 +232,9 @@ class Decoder(srd.Decoder):
 
         # CONTROL, STATUS stage
         elif request['type'] == 'SETUP IN' and self.transaction_type == 'OUT':
-            request['es'] = self.es_transaction
             self.handle_request(0, request_end)
 
         elif request['type'] == 'SETUP OUT' and self.transaction_type == 'IN':
-            request['es'] = self.es_transaction
             self.handle_request(0, request_end)
 
         else: