summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2018-10-21 17:14:59 +0200
committerGerhard Sittig <gerhard.sittig@gmx.net>2018-10-21 21:26:09 +0200
commitbe760e5965e6f4213b010ff088d6ecc3d3ee066b (patch)
tree0817ecf7ce65fd4e954a85ccd8efa7bb69f983a7
parentd1de22c0b9ef3158f41fab1b8190cd5d5f79771b (diff)
downloadlibsigrokdecode-be760e5965e6f4213b010ff088d6ecc3d3ee066b.tar.gz
libsigrokdecode-be760e5965e6f4213b010ff088d6ecc3d3ee066b.zip
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.
-rw-r--r--decoder.c5
1 files changed, 5 insertions, 0 deletions
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;