X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=decoders%2Fusb_signalling%2Fpd.py;h=8b98b7e6233686e94b6b369eca50d4cfe8a449b2;hp=35ffce6b70128580f7c61117899be9416d379866;hb=da9bcbd9f45b0153465c55ec726a0d76f6d7f01e;hpb=c515eed7ef7a04a42b5b34abd308e08d6942835e diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py index 35ffce6..8b98b7e 100644 --- a/decoders/usb_signalling/pd.py +++ b/decoders/usb_signalling/pd.py @@ -75,21 +75,25 @@ class Decoder(srd.Decoder): license = 'gplv2+' inputs = ['logic'] outputs = ['usb_signalling'] - probes = [ + probes = ( {'id': 'dp', 'name': 'D+', 'desc': 'USB D+ signal'}, {'id': 'dm', 'name': 'D-', 'desc': 'USB D- signal'}, - ] - optional_probes = [] - options = { - 'signalling': ['Signalling', 'full-speed'], - } - annotations = [ - ['sym', 'Symbol'], - ['sop', 'Start of packet (SOP)'], - ['eop', 'End of packet (EOP)'], - ['bit', 'Bit'], - ['stuffbit', 'Stuff bit'], - ] + ) + options = ( + {'id': 'signalling', 'desc': 'Signalling', + 'default': 'full-speed', 'values': ('full-speed', 'low-speed')}, + ) + annotations = ( + ('sym', 'Symbol'), + ('sop', 'Start of packet (SOP)'), + ('eop', 'End of packet (EOP)'), + ('bit', 'Bit'), + ('stuffbit', 'Stuff bit'), + ) + annotation_rows = ( + ('bits', 'Bits', (1, 2, 3, 4)), + ('symbols', 'Symbols', (0,)), + ) def __init__(self): self.samplerate = None @@ -159,12 +163,14 @@ class Decoder(srd.Decoder): if self.consecutive_ones == 6 and b == '0': # Stuff bit. self.putpb(['STUFF BIT', None]) - self.putb([4, ['SB: %s/%s' % (sym, b)]]) + self.putb([4, ['SB: %s' % b]]) + self.putb([0, ['%s' % sym]]) self.consecutive_ones = 0 else: # Normal bit (not a stuff bit). self.putpb(['BIT', b]) - self.putb([3, ['%s/%s' % (sym, b)]]) + self.putb([3, ['%s' % b]]) + self.putb([0, ['%s' % sym]]) if b == '1': self.consecutive_ones += 1 else: