From: Gerhard Sittig Date: Sun, 21 Oct 2018 15:14:59 +0000 (+0200) Subject: decoder: consider reset() a mandatory decoder method X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=be760e5965e6f4213b010ff088d6ecc3d3ee066b 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. --- 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;