From: Martin Ling Date: Mon, 28 Dec 2015 19:04:28 +0000 (+0000) Subject: srzip: Store total number of analog channels. X-Git-Tag: libsigrok-0.5.0~550 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=eab052996cae14d8901615418e5cdeb03a6e1bd2;p=libsigrok.git srzip: Store total number of analog channels. --- diff --git a/src/output/srzip.c b/src/output/srzip.c index a8e52697..4fefe47b 100644 --- a/src/output/srzip.c +++ b/src/output/srzip.c @@ -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);