X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=type_decoder.c;h=b04747e8f784716074b46462fbe5faa628cc8fca;hp=314251102da0b8e83836d4eee65bcefaba9f3350;hb=4c58713b0d536f37b8630ebd142185aa56946335;hpb=4f0d192d748e987af43ec5b811a643eb0a8601b2 diff --git a/type_decoder.c b/type_decoder.c index 3142511..b04747e 100644 --- a/type_decoder.c +++ b/type_decoder.c @@ -31,7 +31,7 @@ typedef struct { } srd_Decoder; /* This is only used for nicer srd_dbg() output. */ -static const char *output_type_name(unsigned int idx) +SRD_PRIV const char *output_type_name(unsigned int idx) { static const char names[][16] = { "OUTPUT_ANN", @@ -353,9 +353,13 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) } pdo = l->data; - srd_spew("Instance %s put %" PRIu64 "-%" PRIu64 " %s on oid %d.", - di->inst_id, start_sample, end_sample, - output_type_name(pdo->output_type), output_id); + /* Upon SRD_OUTPUT_PYTHON for stacked PDs, we have a nicer log message later. */ + if (pdo->output_type != SRD_OUTPUT_PYTHON && di->next_di != NULL) { + srd_spew("Instance %s put %" PRIu64 "-%" PRIu64 " %s on " + "oid %d (%s).", di->inst_id, start_sample, end_sample, + output_type_name(pdo->output_type), output_id, + pdo->proto_id); + } pdata.start_sample = start_sample; pdata.end_sample = end_sample; @@ -381,8 +385,11 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) case SRD_OUTPUT_PYTHON: for (l = di->next_di; l; l = l->next) { next_di = l->data; - srd_spew("Sending %" PRIu64 "-%" PRIu64 " to instance %s", - start_sample, end_sample, next_di->inst_id); + srd_spew("Instance %s put %" PRIu64 "-%" PRIu64 " %s " + "on oid %d (%s) to instance %s.", di->inst_id, + start_sample, + end_sample, output_type_name(pdo->output_type), + output_id, pdo->proto_id, next_di->inst_id); if (!(py_res = PyObject_CallMethod( next_di->py_inst, "decode", "KKO", start_sample, end_sample, py_data))) { @@ -514,9 +521,6 @@ static PyObject *Decoder_register(PyObject *self, PyObject *args, return py_new_output_id; } - srd_dbg("Instance %s creating new output type %d for %s.", - di->inst_id, output_type, proto_id); - pdo = g_malloc(sizeof(struct srd_pd_output)); /* pdo_id is just a simple index, nothing is deleted from this list anyway. */ @@ -536,6 +540,10 @@ static PyObject *Decoder_register(PyObject *self, PyObject *args, PyGILState_Release(gstate); + srd_dbg("Instance %s creating new output type %s as oid %d (%s).", + di->inst_id, output_type_name(output_type), pdo->pdo_id, + proto_id); + return py_new_output_id; err: