X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Finput.c;h=18a4b639ed5160e122e046bed5b44a463fe3ed96;hb=e1b115bd4d5ed195b46daf604c35a33c7a760533;hp=5e8f2129676f1f2839953a7c5dd797debbd1fca9;hpb=7d89fd60e5bce5bbb3271a5ecd54c3c6c63dc6bf;p=libsigrok.git diff --git a/src/input/input.c b/src/input/input.c index 5e8f2129..18a4b639 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -62,16 +62,24 @@ extern SR_PRIV struct sr_input_module input_chronovu_la8; extern SR_PRIV struct sr_input_module input_csv; extern SR_PRIV struct sr_input_module input_binary; +extern SR_PRIV struct sr_input_module input_trace32_ad; extern SR_PRIV struct sr_input_module input_vcd; extern SR_PRIV struct sr_input_module input_wav; +extern SR_PRIV struct sr_input_module input_raw_analog; +extern SR_PRIV struct sr_input_module input_logicport; +extern SR_PRIV struct sr_input_module input_null; /* @endcond */ static const struct sr_input_module *input_module_list[] = { &input_binary, &input_chronovu_la8, &input_csv, + &input_trace32_ad, &input_vcd, &input_wav, + &input_raw_analog, + &input_logicport, + &input_null, NULL, }; @@ -242,7 +250,7 @@ SR_API struct sr_input *sr_input_new(const struct sr_input_module *imod, GHashTable *options) { struct sr_input *in; - struct sr_option *mod_opts; + const struct sr_option *mod_opts; const GVariantType *gvt; GHashTable *new_opts; GHashTableIter iter; @@ -555,6 +563,27 @@ SR_API int sr_input_end(const struct sr_input *in) return in->module->end((struct sr_input *)in); } +/** + * Reset the input module's input handling structures. + * + * Causes the input module to reset its internal state so that we can re-send + * the input data from the beginning without having to re-create the entire + * input module. + * + * @since 0.5.0 + */ +SR_API int sr_input_reset(const struct sr_input *in) +{ + if (!in->module->reset) { + sr_spew("Tried to reset %s module but no reset handler found.", + in->module->id); + return SR_OK; + } + + sr_spew("Resetting %s module.", in->module->id); + return in->module->reset((struct sr_input *)in); +} + /** * Free the specified input instance and all associated resources. * @@ -567,8 +596,7 @@ SR_API void sr_input_free(const struct sr_input *in) if (in->module->cleanup) in->module->cleanup((struct sr_input *)in); - if (in->sdi) - sr_dev_inst_free(in->sdi); + sr_dev_inst_free(in->sdi); if (in->buf->len > 64) { /* That seems more than just some sub-unitsize leftover... */ sr_warn("Found %" G_GSIZE_FORMAT