From: Stefan BrĂ¼ns Date: Sun, 29 Nov 2015 23:00:03 +0000 (+0100) Subject: usb_packet: handle errors from usb_signalling X-Git-Tag: libsigrokdecode-0.4.0~23 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=e655c0aa44ac56ff66ad98d30a97cf852bdf7048 usb_packet: handle errors from usb_signalling If a packet had any errors, the usb_signalling PD will not send an EOP but an ERR message. Wait for the next SOP in both cases. --- diff --git a/decoders/usb_packet/pd.py b/decoders/usb_packet/pd.py index 7120d52..3e061c9 100644 --- a/decoders/usb_packet/pd.py +++ b/decoders/usb_packet/pd.py @@ -371,7 +371,7 @@ class Decoder(srd.Decoder): (ptype, pdata) = data # We only care about certain packet types for now. - if ptype not in ('SOP', 'BIT', 'EOP'): + if ptype not in ('SOP', 'BIT', 'EOP', 'ERR'): return # State machine. @@ -383,7 +383,7 @@ class Decoder(srd.Decoder): elif self.state == 'GET BIT': if ptype == 'BIT': self.bits.append([pdata, ss, es]) - elif ptype == 'EOP': + elif ptype == 'EOP' or ptype == 'ERR': self.es_packet = es self.handle_packet() self.packet, self.packet_summary = [], ''