diff options
author | Bert Vermeulen <bert@biot.com> | 2012-01-25 01:49:35 +0100 |
---|---|---|
committer | Bert Vermeulen <bert@biot.com> | 2012-01-25 01:49:35 +0100 |
commit | 2072ae0c89fec6b06cc579a6c584e67e2a59f7ec (patch) | |
tree | 655f04253823e3d180dee6f7615dc03f30fac6ce /type_decoder.c | |
parent | 58572aed02d81e2cc75749c2c4b516538b5ca9b9 (diff) | |
download | libsigrokdecode-2072ae0c89fec6b06cc579a6c584e67e2a59f7ec.tar.gz libsigrokdecode-2072ae0c89fec6b06cc579a6c584e67e2a59f7ec.zip |
srd: properly recurse into PD instances when looking for one.
This fixes the confusion between parallel and linear stacks.
Diffstat (limited to 'type_decoder.c')
-rw-r--r-- | type_decoder.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/type_decoder.c b/type_decoder.c index 1434cf2..6e34dff 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -95,7 +95,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) int output_id; void (*cb)(); - if (!(di = get_di_by_decobject(self))) { + if (!(di = srd_instance_find_by_obj(NULL, self))) { /* Shouldn't happen. */ srd_dbg("srd: put(): self instance not found."); return NULL; @@ -114,8 +114,8 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) } pdo = l->data; - srd_spew("srd: instance %s put %d-%d %s %d", di->instance_id, - start_sample, end_sample, OUTPUT_TYPES[output_id], output_id); + srd_spew("srd: instance %s put %d-%d %s on oid %d", di->instance_id, + start_sample, end_sample, OUTPUT_TYPES[pdo->output_type], output_id); if (!(pdata = g_try_malloc0(sizeof(struct srd_proto_data)))) return NULL; @@ -141,6 +141,8 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) next_di = l->data; /* TODO: is this needed? */ Py_XINCREF(next_di->py_instance); + srd_spew("srd: sending %d-%d to instance %s", + start_sample, end_sample, next_di->instance_id); if (!(py_res = PyObject_CallMethod(next_di->py_instance, "decode", "KKO", start_sample, end_sample, data))) { catch_exception("calling %s decode(): ", next_di->instance_id); @@ -170,7 +172,7 @@ static PyObject *Decoder_add(PyObject *self, PyObject *args) char *proto_id; int output_type, pdo_id; - if (!(di = get_di_by_decobject(self))) { + if (!(di = srd_instance_find_by_obj(NULL, self))) { PyErr_SetString(PyExc_Exception, "decoder instance not found"); return NULL; } |