]> sigrok.org Git - libsigrok.git/blobdiff - src/input/csv.c
Input/csv: Add reset() function
[libsigrok.git] / src / input / csv.c
index 984a58c7d9753ae1d11869d829ad2e5507e9d686..a8c689443a35430712b05a0099434d7c386e6031 100644 (file)
@@ -768,6 +768,17 @@ static void cleanup(struct sr_input *in)
        g_free(inc->sample_buffer);
 }
 
+static int reset(struct sr_input *in)
+{
+       struct context *inc = in->priv;
+
+       cleanup(in);
+       inc->started = FALSE;
+       g_string_truncate(in->buf, 0);
+
+       return SR_OK;
+}
+
 static struct sr_option options[] = {
        { "single-column", "Single column", "Enable/specify single column", NULL, NULL },
        { "numchannels", "Max channels", "Number of channels", NULL, NULL },
@@ -808,4 +819,5 @@ SR_PRIV struct sr_input_module input_csv = {
        .receive = receive,
        .end = end,
        .cleanup = cleanup,
+       .reset = reset,
 };