usb_signalling: fix SOP detection after an error condition
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sun, 29 Nov 2015 23:35:11 +0000 (00:35 +0100)
committerStefan Brüns <stefan.bruens@rwth-aachen.de>
Sun, 29 Nov 2015 23:35:11 +0000 (00:35 +0100)
If the oldsym is not set to 'J' before entering IDLE state, the SOP
detection will never trigger

decoders/usb_signalling/pd.py

index 6233c3eb6462967f2d6bf6a03b512f7919ff5c8f..4dfde832236351309aff3cb844430a3e2e4e506a 100644 (file)
@@ -272,6 +272,7 @@ class Decoder(srd.Decoder):
         elif sym == 'LS_J':
             self.signalling = 'low-speed'
             self.update_bitrate()
+        self.oldsym = 'J'
         self.state = 'IDLE'
 
     def decode(self, ss, es, data):
@@ -302,8 +303,9 @@ class Decoder(srd.Decoder):
                     self.get_bit(sym)
                 elif self.state == 'GET EOP':
                     self.get_eop(sym)
+                self.oldpins = pins
             elif self.state == 'WAIT IDLE':
-                if self.oldpins == pins:
+                if tuple(pins) == (0, 0):
                     continue
                 if self.samplenum - self.samplenum_lastedge > 1:
                     sym = symbols[self.options['signalling']][tuple(pins)]