diff options
-rw-r--r-- | decoders/eeprom24xx/pd.py | 4 | ||||
-rw-r--r-- | decoders/i2c/pd.py | 2 | ||||
-rw-r--r-- | decoders/i2s/pd.py | 4 | ||||
-rw-r--r-- | decoders/jitter/pd.py | 2 | ||||
-rw-r--r-- | decoders/pwm/pd.py | 2 | ||||
-rw-r--r-- | decoders/spi/pd.py | 4 | ||||
-rw-r--r-- | decoders/uart/pd.py | 4 | ||||
-rw-r--r-- | decoders/usb_power_delivery/pd.py | 2 | ||||
-rw-r--r-- | decoders/usb_request/pd.py | 2 | ||||
-rw-r--r-- | type_decoder.c | 18 |
10 files changed, 22 insertions, 22 deletions
diff --git a/decoders/eeprom24xx/pd.py b/decoders/eeprom24xx/pd.py index 0738c06..928a1f7 100644 --- a/decoders/eeprom24xx/pd.py +++ b/decoders/eeprom24xx/pd.py @@ -165,7 +165,7 @@ class Decoder(srd.Decoder): self.putb([cls, ['%s (%s): %s' % (s, self.addr_and_len(), \ self.hexbytes(self.chip['addr_bytes'])), '%s (%s)' % (s, self.addr_and_len()), s, a, s[0]]]) - self.putbin((0, bytes(self.bytebuf[self.chip['addr_bytes']:]))) + self.putbin([0, bytes(self.bytebuf[self.chip['addr_bytes']:])]) def addr_and_len(self): if self.chip['addr_bytes'] == 1: @@ -215,7 +215,7 @@ class Decoder(srd.Decoder): [8, ['Data', 'D']]) self.putb([11, ['Current address read: %02X' % self.bytebuf[0], 'Current address read', 'Cur addr read', 'CAR', 'C']]) - self.putbin((0, bytes([self.bytebuf[0]]))) + self.putbin([0, bytes([self.bytebuf[0]])]) self.addr_counter += 1 elif self.is_random_access_read: # Random access read: word address, one data byte. diff --git a/decoders/i2c/pd.py b/decoders/i2c/pd.py index ce0d699..2b8b302 100644 --- a/decoders/i2c/pd.py +++ b/decoders/i2c/pd.py @@ -224,7 +224,7 @@ class Decoder(srd.Decoder): self.putp(['BITS', self.bits]) self.putp([cmd, d]) - self.putb((bin_class, bytes([d]))) + self.putb([bin_class, bytes([d])]) for bit in self.bits: self.put(bit[1], bit[2], self.out_ann, [5, ['%d' % bit[0]]]) diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py index ee642d7..eeeea20 100644 --- a/decoders/i2s/pd.py +++ b/decoders/i2s/pd.py @@ -154,7 +154,7 @@ class Decoder(srd.Decoder): if self.ss_block is not None: if not self.wrote_wav_header: - self.put(0, 0, self.out_bin, (0, self.wav_header())) + self.put(0, 0, self.out_bin, [0, self.wav_header()]) self.wrote_wav_header = True self.samplesreceived += 1 @@ -167,7 +167,7 @@ class Decoder(srd.Decoder): self.putpb(['DATA', [c3, self.data]]) self.putb([idx, ['%s: %s' % (c1, v), '%s: %s' % (c2, v), '%s: %s' % (c3, v), c3]]) - self.putbin((0, self.wav_sample(self.data))) + self.putbin([0, self.wav_sample(self.data)]) # Check that the data word was the correct length. if self.wordlength != -1 and self.wordlength != self.bitcount: diff --git a/decoders/jitter/pd.py b/decoders/jitter/pd.py index d572c36..d40c643 100644 --- a/decoders/jitter/pd.py +++ b/decoders/jitter/pd.py @@ -112,7 +112,7 @@ class Decoder(srd.Decoder): # Format the delta to an ASCII float value terminated by a newline. x = str(delta) + '\n' self.put(self.clk_start, self.sig_start, self.out_bin, - (0, x.encode('UTF-8'))) + [0, x.encode('UTF-8')]) # Helper function for missed clock and signal annotations. def putm(self, data): diff --git a/decoders/pwm/pd.py b/decoders/pwm/pd.py index e0203a3..7b10d97 100644 --- a/decoders/pwm/pd.py +++ b/decoders/pwm/pd.py @@ -132,7 +132,7 @@ class Decoder(srd.Decoder): self.putx([0, ['%f%%' % percent]]) # Report the duty cycle in the binary output. - self.putb((0, bytes([int(ratio * 256)]))) + self.putb([0, bytes([int(ratio * 256)])]) # Report the period in units of time. period_t = float(period / self.samplerate) diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index 3040ed2..864bca6 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -165,10 +165,10 @@ class Decoder(srd.Decoder): if self.have_miso: ss, es = self.misobits[-1][1], self.misobits[0][2] - self.put(ss, es, self.out_bin, (0, bytes([so]))) + self.put(ss, es, self.out_bin, [0, bytes([so])]) if self.have_mosi: ss, es = self.mosibits[-1][1], self.mosibits[0][2] - self.put(ss, es, self.out_bin, (1, bytes([si]))) + self.put(ss, es, self.out_bin, [1, bytes([si])]) self.put(ss, es, self.out_python, ['BITS', si_bits, so_bits]) self.put(ss, es, self.out_python, ['DATA', si, so]) diff --git a/decoders/uart/pd.py b/decoders/uart/pd.py index 9b3a6bd..4c37c34 100644 --- a/decoders/uart/pd.py +++ b/decoders/uart/pd.py @@ -284,8 +284,8 @@ class Decoder(srd.Decoder): elif f == 'bin': self.putx(rxtx, [rxtx, [bin(b)[2:].zfill(8)]]) - self.putbin(rxtx, (rxtx, bytes([b]))) - self.putbin(rxtx, (2, bytes([b]))) + self.putbin(rxtx, [rxtx, bytes([b])]) + self.putbin(rxtx, [2, bytes([b])]) self.databits = [[], []] diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py index 034c4a9..da73661 100644 --- a/decoders/usb_power_delivery/pd.py +++ b/decoders/usb_power_delivery/pd.py @@ -524,7 +524,7 @@ class Decoder(srd.Decoder): bitrate = self.samplerate*len(self.bits) / float(es - ss) self.put(es, ss, self.out_bitrate, int(bitrate)) # Raw binary data (BMC decoded) - self.put(es, ss, self.out_binary, (0, bytes(self.bits))) + self.put(es, ss, self.out_binary, [0, bytes(self.bits)]) def decode(self, ss, es, data): if not self.samplerate: diff --git a/decoders/usb_request/pd.py b/decoders/usb_request/pd.py index 61dedb1..fa2e674 100644 --- a/decoders/usb_request/pd.py +++ b/decoders/usb_request/pd.py @@ -242,7 +242,7 @@ class Decoder(srd.Decoder): def write_pcap_header(self): if not self.wrote_pcap_header: - self.put(0, 0, self.out_bin, (0, self.pcap_global_header())) + self.put(0, 0, self.out_bin, [0, self.pcap_global_header()]) self.wrote_pcap_header = True def request_summary(self, request): diff --git a/type_decoder.c b/type_decoder.c index ae6b95f..228cd44 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -111,25 +111,25 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj, int bin_class; char *class_name, *buf; - /* Should be a tuple of (binary class, bytes). */ - if (!PyTuple_Check(obj)) { - srd_err("Protocol decoder %s submitted non-tuple for SRD_OUTPUT_BINARY.", + /* Should be a list of [binary class, bytes]. */ + if (!PyList_Check(obj)) { + srd_err("Protocol decoder %s submitted non-list for SRD_OUTPUT_BINARY.", di->decoder->name); return SRD_ERR_PYTHON; } /* Should have 2 elements. */ - if (PyTuple_Size(obj) != 2) { - srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple " + if (PyList_Size(obj) != 2) { + srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list " "with %zd elements instead of 2", di->decoder->name, PyList_Size(obj)); return SRD_ERR_PYTHON; } /* The first element should be an integer. */ - py_tmp = PyTuple_GetItem(obj, 0); + py_tmp = PyList_GetItem(obj, 0); if (!PyLong_Check(py_tmp)) { - srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple, " + srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list, " "but first element was not an integer.", di->decoder->name); return SRD_ERR_PYTHON; } @@ -141,9 +141,9 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj, } /* Second element should be bytes. */ - py_tmp = PyTuple_GetItem(obj, 1); + py_tmp = PyList_GetItem(obj, 1); if (!PyBytes_Check(py_tmp)) { - srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple, " + srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list, " "but second element was not bytes.", di->decoder->name); return SRD_ERR_PYTHON; } |