]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/srd_usb.py
srd: Drop useless out_ann/out_proto init.
[libsigrokdecode.git] / decoders / srd_usb.py
index 396953291042b283ebb3172622182875264d8e2f..c6e6627c3d4fbd47ee4becda5fd910185825894e 100644 (file)
@@ -40,7 +40,7 @@
 # http://www.usb.org/developers/docs/
 #
 
-import sigrokdecode
+import sigrokdecode as srd
 
 # States
 SE0, J, K, SE1 = 0, 1, 2, 3
@@ -99,7 +99,7 @@ def packet_decode(packet):
 
     return pid + ' ' + data
 
-class Decoder(sigrokdecode.Decoder):
+class Decoder(srd.Decoder):
     id = 'usb'
     name = 'USB'
     desc = 'Universal Serial Bus'
@@ -118,13 +118,12 @@ class Decoder(sigrokdecode.Decoder):
     options = {}
 
     def __init__(self):
-        self.output_protocol = None
-        self.output_annotation = None
+        pass
 
     def start(self, metadata):
         self.rate = metadata['samplerate']
-        # self.output_protocol = self.output_new(2)
-        self.output_annotation = self.output_new(1)
+        # self.out_proto = self.add(srd.SRD_OUTPUT_PROTO, 'usb')
+        self.out_ann = self.add(srd.SRD_OUTPUT_ANN, 'usb')
         if self.rate < 48000000:
             raise Exception("Sample rate not sufficient for USB decoding")
         # Initialise decoder state.
@@ -182,6 +181,6 @@ class Decoder(sigrokdecode.Decoder):
             self.sym = sym
 
         if out != []:
-            # self.put(0, 0, self.output_protocol, out_proto)
-            self.put(0, 0, self.output_annotation, out)
+            # self.put(0, 0, self.out_proto, out_proto)
+            self.put(0, 0, self.out_ann, out)