]> sigrok.org Git - libsigrok.git/commitdiff
Input/csv: Add reset() function
authorSoeren Apel <redacted>
Mon, 2 May 2016 16:10:55 +0000 (18:10 +0200)
committerUwe Hermann <redacted>
Mon, 9 May 2016 11:02:47 +0000 (13:02 +0200)
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,
 };