]> sigrok.org Git - libsigrok.git/commitdiff
srzip: Count only logic channels in "total probes".
authorMartin Ling <redacted>
Mon, 28 Dec 2015 19:01:57 +0000 (19:01 +0000)
committerUwe Hermann <redacted>
Sun, 13 Mar 2016 23:34:09 +0000 (00:34 +0100)
src/output/srzip.c

index 787a2bab6f4a0be4c56051d8caa74e8fa97357e0..a8e52697ef8db883f6d843eb0045fc87e41d43b9 100644 (file)
@@ -65,6 +65,7 @@ static int zip_create(const struct sr_output *o)
        const char *devgroup;
        char *s, *metabuf;
        gsize metalen;
+       guint logic_channels = 0;
 
        outc = o->priv;
 
@@ -99,13 +100,18 @@ static int zip_create(const struct sr_output *o)
        devgroup = "device 1";
        g_key_file_set_string(meta, devgroup, "capturefile", "logic-1");
 
-       g_key_file_set_integer(meta, devgroup, "total probes",
-                       g_slist_length(o->sdi->channels));
-
        s = sr_samplerate_string(outc->samplerate);
        g_key_file_set_string(meta, devgroup, "samplerate", s);
        g_free(s);
 
+       for (l = o->sdi->channels; l; l = l->next) {
+               ch = l->data;
+               if (ch->type == SR_CHANNEL_LOGIC)
+                       logic_channels++;
+       }
+
+       g_key_file_set_integer(meta, devgroup, "total probes", logic_channels);
+
        for (l = o->sdi->channels; l; l = l->next) {
                ch = l->data;
                if (ch->enabled && ch->type == SR_CHANNEL_LOGIC) {
@@ -114,6 +120,7 @@ static int zip_create(const struct sr_output *o)
                        g_free(s);
                }
        }
+
        metabuf = g_key_file_to_data(meta, &metalen, NULL);
        g_key_file_free(meta);