X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fusb_packet%2Fpd.py;h=c159202510a6212efff7f611ffdfb31f6e2ea0c9;hb=6e58cefe1056bd17f605e7717c44461d324a953d;hp=89549fa1bc6cff7d030195c8808574cbc2add3ad;hpb=64b45b207121eeb9b0db7f71ba067f23fe7f7ea7;p=libsigrokdecode.git diff --git a/decoders/usb_packet/pd.py b/decoders/usb_packet/pd.py index 89549fa..c159202 100644 --- a/decoders/usb_packet/pd.py +++ b/decoders/usb_packet/pd.py @@ -33,7 +33,9 @@ Packet: - 'ADDR', - 'EP', - 'CRC5', + - 'CRC5 ERROR', - 'CRC16', + - 'CRC16 ERROR', - 'EOP', - 'FRAMENUM', - 'DATABYTE', @@ -111,7 +113,7 @@ pids = { # Special '00111100': ['PRE', 'Host-issued preamble; enables downstream bus traffic to low-speed devices'], - '00111100': ['ERR', 'Split transaction error handshake'], + #'00111100': ['ERR', 'Split transaction error handshake'], '00011110': ['SPLIT', 'HS split transaction token'], '00101101': ['PING', 'HS flow control probe for a bulk/control EP'], '00001111': ['Reserved', 'Reserved PID'], @@ -279,7 +281,7 @@ class Decoder(srd.Decoder): self.packet.append(pid) self.packet_summary += pidname - if pidname in ('OUT', 'IN', 'SOF', 'SETUP', 'PRE', 'PING'): + if pidname in ('OUT', 'IN', 'SOF', 'SETUP', 'PING'): if len(packet) < 32: self.putp([28, ['Invalid packet (shorter than 32 bits)']]) return @@ -355,6 +357,8 @@ class Decoder(srd.Decoder): self.packet.append(crc16) elif pidname in ('ACK', 'NAK', 'STALL', 'NYET', 'ERR'): pass # Nothing to do, these only have SYNC+PID+EOP fields. + elif pidname in ('PRE'): + pass # Nothing to do, PRE only has SYNC+PID fields. else: pass # TODO: Handle 'SPLIT' and possibly 'Reserved' packets. @@ -369,7 +373,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. @@ -381,7 +385,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 = [], ''