diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-10-02 19:13:44 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-10-11 00:46:03 +0200 |
commit | a56b8fe1439410e88a4fa3888820f693f6f37aba (patch) | |
tree | 2c2f37d07d50165b4a40a7136221ee764bd7c6c9 /decoders/usb_signalling | |
parent | 4e980c20fbb456ca339529762ea7173900521a3c (diff) | |
download | libsigrokdecode-a56b8fe1439410e88a4fa3888820f693f6f37aba.tar.gz libsigrokdecode-a56b8fe1439410e88a4fa3888820f693f6f37aba.zip |
usb_signalling: Document protocol output format.
Also, add missing output for some packet types.
Diffstat (limited to 'decoders/usb_signalling')
-rw-r--r-- | decoders/usb_signalling/pd.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py index df61628..61844f7 100644 --- a/decoders/usb_signalling/pd.py +++ b/decoders/usb_signalling/pd.py @@ -23,6 +23,32 @@ import sigrokdecode as srd +''' +Protocol output format: + +Packet: +[<ptype>, <pdata>] + +<ptype>, <pdata>: + - 'SOP', None + - 'SYM', <sym> + - 'BIT', <bit> + - 'STUFF BIT', None + - 'EOP', None + - 'PACKET', <packet> + +<sym>: + - 'J', 'K', 'SE0', or 'SE1' + +<bit>: + - 0 or 1 + - Note: Symbols like SE0, SE1, and the J that's part of EOP don't yield 'BIT'. + +<packet>: + - A string consisting of '1' and '0' characters, e.g. '11010100'. + - The packet contains only "real" bits, no stuff bits (and no SOF/EOP). +''' + # Low-/full-speed symbols. # Note: Low-speed J and K are inverted compared to the full-speed J and K! symbols = { @@ -139,10 +165,12 @@ class Decoder(srd.Decoder): def handle_bit(self, sym, b): if self.consecutive_ones == 6 and b == '0': # Stuff bit. Don't add to the packet, reset self.consecutive_ones. + self.putpb(['STUFF BIT', None]) self.putb([4, ['SB: %s/%s' % (sym, b)]]) self.consecutive_ones = 0 else: # Normal bit. Add it to the packet, update self.consecutive_ones. + self.putpb(['BIT', b]) self.putb([3, ['%s/%s' % (sym, b)]]) self.packet += b if b == '1': |