From: Martin Ling Date: Mon, 28 Dec 2015 19:01:57 +0000 (+0000) Subject: srzip: Count only logic channels in "total probes". X-Git-Tag: libsigrok-0.5.0~551 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=828832194f0a32097046fbd5c33edd6eee8c7a60;p=libsigrok.git srzip: Count only logic channels in "total probes". --- diff --git a/src/output/srzip.c b/src/output/srzip.c index 787a2bab..a8e52697 100644 --- a/src/output/srzip.c +++ b/src/output/srzip.c @@ -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);