From: Uwe Hermann Date: Fri, 4 Dec 2015 21:11:14 +0000 (+0100) Subject: usb*: Minor cosmetics. X-Git-Tag: libsigrokdecode-0.4.0~18 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=502acfc2c71a2bbc97d4d7597150cd479bead1ee usb*: Minor cosmetics. --- diff --git a/decoders/usb_packet/pd.py b/decoders/usb_packet/pd.py index 8d1de65..c159202 100644 --- a/decoders/usb_packet/pd.py +++ b/decoders/usb_packet/pd.py @@ -358,7 +358,7 @@ class Decoder(srd.Decoder): 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. + pass # Nothing to do, PRE only has SYNC+PID fields. else: pass # TODO: Handle 'SPLIT' and possibly 'Reserved' packets. diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py index 4526e69..61dedb1 100644 --- a/decoders/usb_request/pd.py +++ b/decoders/usb_request/pd.py @@ -270,8 +270,8 @@ class Decoder(srd.Decoder): # Issue PCAP 'SUBMIT' packet. ts = self.ts_from_samplenum(ss) pkt = pcap_usb_pkt(request, ts, True) - self.putb(ss, (0, pkt.record_header())) - self.putb(ss, (0, pkt.packet())) + self.putb(ss, [0, pkt.record_header()]) + self.putb(ss, [0, pkt.packet()]) if request_end == 1: # Write annotation. @@ -288,8 +288,8 @@ class Decoder(srd.Decoder): # Issue PCAP 'COMPLETE' packet. ts = self.ts_from_samplenum(es) pkt = pcap_usb_pkt(request, ts, False) - self.putb(ss, (0, pkt.record_header())) - self.putb(ss, (0, pkt.packet())) + self.putb(ss, [0, pkt.record_header()]) + self.putb(ss, [0, pkt.packet()]) del self.request[(addr, ep)] def decode(self, ss, es, data): @@ -308,9 +308,10 @@ class Decoder(srd.Decoder): return if self.transaction_state == 'TOKEN RECEIVED': transaction_timeout = self.transaction_es - # token length is 35 bits, timeout is 16..18 bit times (USB 2.0 7.1.19.1) + # Token length is 35 bits, timeout is 16..18 bit times + # (USB 2.0 7.1.19.1). transaction_timeout += int((self.transaction_es - self.transaction_ss) / 2) - if (ss > transaction_timeout): + if ss > transaction_timeout: self.transaction_es = transaction_timeout self.handshake = 'timeout' self.handle_transfer() diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py index cea579a..c60075c 100644 --- a/decoders/usb_signalling/pd.py +++ b/decoders/usb_signalling/pd.py @@ -69,10 +69,11 @@ symbols = { (0, 1): 'LS_J', (1, 1): 'SE1', }, -# After a PREamble PID, the bus segment between Host and Hub uses LS signalling -# rate and FS signalling polarity (USB 2.0 spec, 11.8.4: "For both upstream and -# downstream low-speed data, the hub is responsible for inverting the polarity of -# the data before transmitting to/from a low-speed port." + # After a PREamble PID, the bus segment between Host and Hub uses LS + # signalling rate and FS signalling polarity (USB 2.0 spec, 11.8.4: "For + # both upstream and downstream low-speed data, the hub is responsible for + # inverting the polarity of the data before transmitting to/from a + # low-speed port."). 'low-speed-rp': { # (, ): (0, 0): 'SE0', @@ -83,8 +84,8 @@ symbols = { } bitrates = { - 'low-speed': 1500000, # 1.5Mb/s (+/- 1.5%) - 'low-speed-rp': 1500000, # 1.5Mb/s (+/- 1.5%) + 'low-speed': 1500000, # 1.5Mb/s (+/- 1.5%) + 'low-speed-rp': 1500000, # 1.5Mb/s (+/- 1.5%) 'full-speed': 12000000, # 12Mb/s (+/- 0.25%) 'automatic': None } @@ -201,7 +202,7 @@ class Decoder(srd.Decoder): if sym != 'K' or self.oldsym != 'J': return self.consecutive_ones = 0 - self.bits = "" + self.bits = '' self.update_bitrate() self.samplepos = self.samplenum - (self.bitwidth / 2) + 0.5 self.set_new_target_samplenum()