diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 01:32:47 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-01-14 01:32:47 +0100 |
commit | bbe99ad5311855f2c1e12195ba8632ca8524b654 (patch) | |
tree | c31e7240c7b9447e56050f13fb5331c502b568ad /decoders | |
parent | 0690a587c96796a4ff1aca2813d45e24a4314504 (diff) | |
download | libsigrokdecode-bbe99ad5311855f2c1e12195ba8632ca8524b654.tar.gz libsigrokdecode-bbe99ad5311855f2c1e12195ba8632ca8524b654.zip |
srd: USB: Move pids dict to global level.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/srd_usb.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/decoders/srd_usb.py b/decoders/srd_usb.py index e0ef277..6cf8c2d 100644 --- a/decoders/srd_usb.py +++ b/decoders/srd_usb.py @@ -53,6 +53,20 @@ syms = { (1, 1): SE1, } +# ... +pids = { + '10000111': 'OUT', # Tokens + '10010110': 'IN', + '10100101': 'SOF', + '10110100': 'SETUP', + '11000011': 'DATA0', # Data + '11010010': 'DATA1', + '01001011': 'ACK', # Handshake + '01011010': 'NAK', + '01111000': 'STALL', + '01101001': 'NYET', +} + def bitstr_to_num(bitstr): if not bitstr: return 0 @@ -61,19 +75,6 @@ def bitstr_to_num(bitstr): return int(''.join(l), 2) def packet_decode(packet): - pids = { - '10000111': 'OUT', # Tokens - '10010110': 'IN', - '10100101': 'SOF', - '10110100': 'SETUP', - '11000011': 'DATA0', # Data - '11010010': 'DATA1', - '01001011': 'ACK', # Handshake - '01011010': 'NAK', - '01111000': 'STALL', - '01101001': 'NYET', - } - sync = packet[:8] pid = packet[8:16] pid = pids.get(pid, pid) |