]> sigrok.org Git - libsigrok.git/commitdiff
srzip: Store total number of analog channels.
authorMartin Ling <redacted>
Mon, 28 Dec 2015 19:04:28 +0000 (19:04 +0000)
committerUwe Hermann <redacted>
Sun, 13 Mar 2016 23:34:09 +0000 (00:34 +0100)
src/output/srzip.c

index a8e52697ef8db883f6d843eb0045fc87e41d43b9..4fefe47b0e308ccdd9a5ff8e46bfca792866f75c 100644 (file)
@@ -65,7 +65,7 @@ static int zip_create(const struct sr_output *o)
        const char *devgroup;
        char *s, *metabuf;
        gsize metalen;
-       guint logic_channels = 0;
+       guint logic_channels = 0, analog_channels = 0;
 
        outc = o->priv;
 
@@ -106,19 +106,32 @@ static int zip_create(const struct sr_output *o)
 
        for (l = o->sdi->channels; l; l = l->next) {
                ch = l->data;
-               if (ch->type == SR_CHANNEL_LOGIC)
-                       logic_channels++;
+               switch (ch->type) {
+                       case SR_CHANNEL_LOGIC:
+                               logic_channels++;
+                               break;
+                       case SR_CHANNEL_ANALOG:
+                               analog_channels++;
+                               break;
+               }
        }
 
        g_key_file_set_integer(meta, devgroup, "total probes", logic_channels);
+       g_key_file_set_integer(meta, devgroup, "total analog", analog_channels);
 
        for (l = o->sdi->channels; l; l = l->next) {
                ch = l->data;
-               if (ch->enabled && ch->type == SR_CHANNEL_LOGIC) {
-                       s = g_strdup_printf("probe%d", ch->index + 1);
-                       g_key_file_set_string(meta, devgroup, s, ch->name);
-                       g_free(s);
+               switch (ch->type) {
+                       case SR_CHANNEL_LOGIC:
+                               s = g_strdup_printf("probe%d", ch->index + 1);
+                               break;
+                       case SR_CHANNEL_ANALOG:
+                               s = g_strdup_printf("analog%d", ch->index + 1);
+                               break;
                }
+               if (ch->enabled)
+                       g_key_file_set_string(meta, devgroup, s, ch->name);
+               g_free(s);
        }
 
        metabuf = g_key_file_to_data(meta, &metalen, NULL);