From: Uwe Hermann Date: Wed, 21 Mar 2012 18:28:43 +0000 (+0100) Subject: sr/srd: Small fixes, constifications, doc updates. X-Git-Tag: libsigrokdecode-0.1.0~26 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5a2c4dc462310a8a031abda7e6cbb0532873ec55;p=libsigrokdecode.git sr/srd: Small fixes, constifications, doc updates. --- diff --git a/decoder.c b/decoder.c index d7780d5..0aa1c5f 100644 --- a/decoder.c +++ b/decoder.c @@ -62,7 +62,8 @@ SRD_API struct srd_decoder *srd_decoder_get_by_id(const char *id) return NULL; } -static int get_probes(struct srd_decoder *d, char *attr, GSList **pl) +static int get_probes(const struct srd_decoder *d, const char *attr, + GSList **pl) { PyObject *py_probelist, *py_entry; struct srd_probe *p; diff --git a/decoders/i2cdemux/i2cdemux.py b/decoders/i2cdemux/i2cdemux.py index 4632c8d..6f29649 100644 --- a/decoders/i2cdemux/i2cdemux.py +++ b/decoders/i2cdemux/i2cdemux.py @@ -26,7 +26,7 @@ class Decoder(srd.Decoder): api_version = 1 id = 'i2cdemux' name = 'I2C demux' - longname = 'Generic I2C demultiplexer' + longname = 'I2C demultiplexer' desc = 'TODO.' longdesc = 'TODO.' license = 'gplv2+' diff --git a/decoders/usb/usb.py b/decoders/usb/usb.py index bd402dd..576855f 100644 --- a/decoders/usb/usb.py +++ b/decoders/usb/usb.py @@ -105,14 +105,14 @@ class Decoder(srd.Decoder): pass def start(self, metadata): - self.rate = metadata['samplerate'] + self.samplerate = metadata['samplerate'] # self.out_proto = self.add(srd.OUTPUT_PROTO, 'usb') self.out_ann = self.add(srd.OUTPUT_ANN, 'usb') - if self.rate < 48000000: - raise Exception('Sample rate (%d) not sufficient for USB ' - 'decoding, need at least 48MHz' % self.rate) + if self.samplerate < 48000000: + raise Exception('Samplerate (%d) not sufficient for USB ' + 'decoding, need at least 48MHz' % self.samplerate) # Initialise decoder state. self.sym = 'J' @@ -142,7 +142,7 @@ class Decoder(srd.Decoder): # How many bits since the last transition? if self.packet != '' or self.sym != 'J': - bitcount = int((self.scount - 1) * 12000000 / self.rate) + bitcount = int((self.scount - 1) * 12000000 / self.samplerate) else: bitcount = 0