X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=main.c;h=ff3225fd2b35aee03728911d8efbd1bda71fda24;hp=abacea964830707dbe30a5fc34f0006e078b3731;hb=f9170968a3ebd9a7109312052ad0b9fb805b5090;hpb=26c63758bd4e5676cb6c987668ca46053c5e82bb
diff --git a/main.c b/main.c
index abacea9..ff3225f 100644
--- a/main.c
+++ b/main.c
@@ -17,13 +17,9 @@
* along with this program. If not, see .
*/
-#include "config.h"
-#include
-#include
-#ifdef HAVE_SRD
-#include /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#endif
#include "sigrok-cli.h"
+#include
+#include
struct sr_context *sr_ctx = NULL;
#ifdef HAVE_SRD
@@ -38,8 +34,8 @@ gchar *opt_input_file = NULL;
gchar *opt_output_file = NULL;
gchar *opt_drv = NULL;
gchar *opt_config = NULL;
-static gchar *opt_probes = NULL;
-gchar *opt_probe_group = NULL;
+static gchar *opt_channels = NULL;
+gchar *opt_channel_group = NULL;
gchar *opt_triggers = NULL;
gchar *opt_pds = NULL;
#ifdef HAVE_SRD
@@ -74,10 +70,10 @@ static GOptionEntry optargs[] = {
"Save output to file", NULL},
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &opt_output_format,
"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},
+ {"channels", 'C', 0, G_OPTION_ARG_STRING, &opt_channels,
+ "Channels to use", 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,
@@ -132,26 +128,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_channels) {
+ if (!(selected_channels = parse_channelstring(sdi, opt_channels)))
+ 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_channels(sdi);
+#endif
return SR_OK;
}
@@ -255,9 +252,6 @@ int main(int argc, char **argv)
}
#endif
- if (setup_output_format() != 0)
- goto done;
-
if (opt_version)
show_version();
else if (opt_scan_devs)