X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=src%2Finput%2Finput.c;h=f99902d317c6b4497f520ac5a19738273f413d6b;hp=f2cc976935147b8396d31f0e086382a987d0efd2;hb=b6b4f03e404e06430eca810ad2bf7ccc84262b6e;hpb=0221cbdde3db6f41fdfd9a483e721a6514ef7f8b diff --git a/src/input/input.c b/src/input/input.c index f2cc9769..f99902d3 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -559,6 +559,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. *