From: Stefan BrĂ¼ns Date: Sat, 22 Jul 2017 18:17:10 +0000 (+0200) Subject: usb_request: Remove code duplication, save end sample in central location X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b677e536891fc19d949217023df622e30531220c;p=libsigrokdecode.git usb_request: Remove code duplication, save end sample in central location --- diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py index 76e015b..1bd2878 100644 --- a/decoders/usb_request/pd.py +++ b/decoders/usb_request/pd.py @@ -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: