X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=main.c;h=f34007ceba4857480b386775d16babef11157d71;hp=5dcee2cd25d680709ae5506ee66efa6dadefe75f;hb=0b34fecd023e6b2d2fd70e67c6c4f59bb06e299b;hpb=8d52f788755a9666e7053c2d411fec069f5afc4c diff --git a/main.c b/main.c index 5dcee2c..f34007c 100644 --- a/main.c +++ b/main.c @@ -36,7 +36,7 @@ gchar *opt_output_file = NULL; gchar *opt_drv = NULL; gchar *opt_config = NULL; static gchar *opt_probes = NULL; -gchar *opt_probe_group = NULL; +gchar *opt_channel_group = NULL; gchar *opt_triggers = NULL; gchar *opt_pds = NULL; #ifdef HAVE_SRD @@ -73,8 +73,8 @@ static GOptionEntry optargs[] = { "Output format", NULL}, {"probes", 'p', 0, G_OPTION_ARG_STRING, &opt_probes, "Probes to use", NULL}, - {"probe-group", 'g', 0, G_OPTION_ARG_STRING, &opt_probe_group, - "Probe groups", NULL}, + {"channel-group", 'g', 0, G_OPTION_ARG_STRING, &opt_channel_group, + "Channel groups", NULL}, {"triggers", 't', 0, G_OPTION_ARG_STRING, &opt_triggers, "Trigger configuration", NULL}, {"wait-trigger", 'w', 0, G_OPTION_ARG_NONE, &opt_wait_trigger, @@ -129,26 +129,27 @@ static void logger(const gchar *log_domain, GLogLevelFlags log_level, } -int select_probes(struct sr_dev_inst *sdi) +int select_channels(struct sr_dev_inst *sdi) { - struct sr_probe *probe; - GSList *selected_probes, *l; - - if (!opt_probes) - return SR_OK; - - if (!(selected_probes = parse_probestring(sdi, opt_probes))) - return SR_ERR; - - for (l = sdi->probes; l; l = l->next) { - probe = l->data; - if (g_slist_find(selected_probes, probe)) - probe->enabled = TRUE; - else - probe->enabled = FALSE; + struct sr_channel *ch; + GSList *selected_channels, *l; + + if (opt_probes) { + if (!(selected_channels = parse_channelstring(sdi, opt_probes))) + return SR_ERR; + + for (l = sdi->channels; l; l = l->next) { + ch = l->data; + if (g_slist_find(selected_channels, ch)) + ch->enabled = TRUE; + else + ch->enabled = FALSE; + } + g_slist_free(selected_channels); } - g_slist_free(selected_probes); - +#ifdef HAVE_SRD + map_pd_probes(sdi); +#endif return SR_OK; }