srzip: Count only logic channels in "total probes".

This commit is contained in:
Martin Ling 2015-12-28 19:01:57 +00:00 committed by Uwe Hermann
parent 8ccf5ceb17
commit 828832194f
1 changed files with 10 additions and 3 deletions

View File

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