X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fxfp%2Fpd.py;h=41aca0dbb4ed3f67d4de5b7d28cd295925bc176d;hb=428e40cb08410595126f245e5379cd3104747937;hp=3d204ad99095db3fc5dcdba6f5923838f95c533f;hpb=845f0d4031780220451037e87885e1ff79670976;p=libsigrokdecode.git diff --git a/decoders/xfp/pd.py b/decoders/xfp/pd.py index 3d204ad..41aca0d 100644 --- a/decoders/xfp/pd.py +++ b/decoders/xfp/pd.py @@ -17,10 +17,7 @@ ## along with this program; if not, see . ## -# XFP protocol decoder - import sigrokdecode as srd -import os MODULE_ID = { 0x01: 'GBIC', @@ -194,7 +191,7 @@ AUX_TYPES = [ ] class Decoder(srd.Decoder): - api_version = 1 + api_version = 2 id = 'xfp' name = 'XFP' longname = '10 Gigabit Small Form Factor Pluggable Module (XFP)' @@ -202,13 +199,10 @@ class Decoder(srd.Decoder): license = 'gplv3+' inputs = ['i2c'] outputs = ['xfp'] - probes = [] - optional_probes = [] - options = {} - annotations = [ - ['XFP field names and values', 'XFP structure field names and values'], - ['XFP fields', 'XFP structure fields'], - ] + annotations = ( + ('fieldnames-and-values', 'XFP structure field names and values'), + ('fields', 'XFP structure fields'), + ) def __init__(self, **kwargs): # Received data items, used as an index into samplenum/data @@ -276,8 +270,8 @@ class Decoder(srd.Decoder): 255: self.maybe_ascii, } - def start(self, metadata): - self.out_ann = self.add(srd.OUTPUT_ANN, 'xfp') + def start(self): + self.out_ann = self.register(srd.OUTPUT_ANN) def decode(self, ss, es, data): cmd, data = data @@ -324,7 +318,7 @@ class Decoder(srd.Decoder): self.annotate("Vendor ID", chr(data[i]), cnt, cnt) # Convert 16-bit two's complement values, with each increment - # representing 1/256C, to degrees Celcius. + # representing 1/256C, to degrees Celsius. def to_temp(self, value): if value & 0x8000: value = -((value ^ 0xffff) + 1) @@ -650,4 +644,3 @@ class Decoder(srd.Decoder): self.annotate("AUX1 monitoring", aux) aux = AUX_TYPES[data[0] & 0x0f] self.annotate("AUX2 monitoring", aux) -