From be760e5965e6f4213b010ff088d6ecc3d3ee066b Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sun, 21 Oct 2018 17:14:59 +0200 Subject: [PATCH] decoder: consider reset() a mandatory decoder method In theory support for PD reset is optional, applications are not required to make use of it. But it's essential to receive correct decoding results when used with the popular Pulseview mainline application. So let's consider the absence of the reset() method fatal. All mainline decoders have it. Out-of-tree decoders are easy to adjust, and very probably should support reset() as well. Thus this change is considered beneficial, and not harmful. --- decoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decoder.c b/decoder.c index 260f636..2eb9a57 100644 --- a/decoder.c +++ b/decoder.c @@ -751,6 +751,11 @@ SRD_API int srd_decoder_load(const char *module_name) /* Check Decoder class for required methods. */ + if (check_method(d->py_dec, module_name, "reset") != SRD_OK) { + fail_txt = "no 'reset()' method"; + goto err_out; + } + if (check_method(d->py_dec, module_name, "start") != SRD_OK) { fail_txt = "no 'start()' method"; goto err_out; -- 2.30.2