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:
[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.
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]]])
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
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:
# 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):
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)
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])
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 = [[], []]
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:
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):
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;
}
}
/* 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;
}