From: Uwe Hermann Date: Fri, 14 Mar 2014 20:46:10 +0000 (+0100) Subject: Rename 'probe group' to 'channel group' everywhere. X-Git-Tag: sigrok-cli-0.5.0~19 X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=commitdiff_plain;h=ca50f4b3d69016014c8ab9d7765da68fdb8d796f Rename 'probe group' to 'channel group' everywhere. This is required to adapt to the same rename in libsigrok. The --probe-group command-line option is now called --channel-group (however, the short version -g remains the same as it means "group"). This is an update related to bug #259. --- diff --git a/device.c b/device.c index cfd4566..b8709dc 100644 --- a/device.c +++ b/device.c @@ -24,7 +24,7 @@ extern struct sr_context *sr_ctx; extern gchar *opt_drv; -extern gchar *opt_probe_group; +extern gchar *opt_channel_group; /* Convert driver options hash to GSList of struct sr_config. */ static GSList *hash_to_hwopt(GHashTable *hash) @@ -116,23 +116,23 @@ GSList *device_scan(void) return devices; } -struct sr_probe_group *select_probe_group(struct sr_dev_inst *sdi) +struct sr_channel_group *select_channel_group(struct sr_dev_inst *sdi) { - struct sr_probe_group *pg; + struct sr_channel_group *cg; GSList *l; - if (!opt_probe_group) + if (!opt_channel_group) return NULL; - if (!sdi->probe_groups) { - g_critical("This device does not have any probe groups."); + if (!sdi->channel_groups) { + g_critical("This device does not have any channel groups."); return NULL; } - for (l = sdi->probe_groups; l; l = l->next) { - pg = l->data; - if (!strcasecmp(opt_probe_group, pg->name)) { - return pg; + for (l = sdi->channel_groups; l; l = l->next) { + cg = l->data; + if (!strcasecmp(opt_channel_group, cg->name)) { + return cg; } } diff --git a/doc/sigrok-cli.1 b/doc/sigrok-cli.1 index ce93cd2..400152e 100644 --- a/doc/sigrok-cli.1 +++ b/doc/sigrok-cli.1 @@ -169,11 +169,11 @@ for probes 5 and 6 will be reset to the defaults by the .B "1\-8" probe selection. .TP -.BR "\-g, \-\-probe\-group " -Specify the probe group to operate on. +.BR "\-g, \-\-channel\-group " +Specify the channel group to operate on. -Some devices organize probes into groups, the settings of which can -only be changed as a group. The list of probe groups, if any, is displayed +Some devices organize channels into groups, the settings of which can +only be changed as a group. The list of channel groups, if any, is displayed with the \-\-show command. .TP .BR "\-t, \-\-triggers " diff --git a/main.c b/main.c index 271d28a..41335a7 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, diff --git a/session.c b/session.c index 65c4c60..e05cebc 100644 --- a/session.c +++ b/session.c @@ -506,7 +506,7 @@ int opt_to_gvar(char *key, char *value, struct sr_config *src) int set_dev_options(struct sr_dev_inst *sdi, GHashTable *args) { struct sr_config src; - struct sr_probe_group *pg; + struct sr_channel_group *cg; GHashTableIter iter; gpointer key, value; int ret; @@ -515,8 +515,8 @@ int set_dev_options(struct sr_dev_inst *sdi, GHashTable *args) while (g_hash_table_iter_next(&iter, &key, &value)) { if ((ret = opt_to_gvar(key, value, &src)) != 0) return ret; - pg = select_probe_group(sdi); - ret = sr_config_set(sdi, pg, src.key, src.data); + cg = select_channel_group(sdi); + ret = sr_config_set(sdi, cg, src.key, src.data); if (ret != SR_OK) { g_critical("Failed to set device option '%s'.", (char *)key); return ret; diff --git a/show.c b/show.c index d546376..b8560be 100644 --- a/show.c +++ b/show.c @@ -200,8 +200,8 @@ void show_dev_detail(void) struct sr_dev_inst *sdi; const struct sr_config_info *srci; struct sr_probe *probe; - struct sr_probe_group *probe_group, *pg; - GSList *devices, *pgl, *prl; + struct sr_channel_group *channel_group, *cg; + GSList *devices, *cgl, *prl; GVariant *gvar_opts, *gvar_dict, *gvar_list, *gvar; gsize num_opts, num_elements; double dlow, dhigh, dcur_low, dcur_high; @@ -246,23 +246,23 @@ void show_dev_detail(void) g_variant_unref(gvar_opts); } - /* Selected probes and probe group may affect which options are + /* Selected channels and channel group may affect which options are * returned, or which values for them. */ select_probes(sdi); - probe_group = select_probe_group(sdi); + channel_group = select_channel_group(sdi); - if ((sr_config_list(sdi->driver, sdi, probe_group, SR_CONF_DEVICE_OPTIONS, + if ((sr_config_list(sdi->driver, sdi, channel_group, SR_CONF_DEVICE_OPTIONS, &gvar_opts)) != SR_OK) /* Driver supports no device instance options. */ return; - if (sdi->probe_groups) { - printf("Probe groups:\n"); - for (pgl = sdi->probe_groups; pgl; pgl = pgl->next) { - pg = pgl->data; - printf(" %s: channel%s", pg->name, - g_slist_length(pg->probes) > 1 ? "s" : ""); - for (prl = pg->probes; prl; prl = prl->next) { + if (sdi->channel_groups) { + printf("Channel groups:\n"); + for (cgl = sdi->channel_groups; cgl; cgl = cgl->next) { + cg = cgl->data; + printf(" %s: channel%s", cg->name, + g_slist_length(cg->channels) > 1 ? "s" : ""); + for (prl = cg->channels; prl; prl = prl->next) { probe = prl->data; printf(" %s", probe->name); } @@ -271,11 +271,11 @@ void show_dev_detail(void) } printf("Supported configuration options"); - if (sdi->probe_groups) { - if (!probe_group) - printf(" across all probe groups"); + if (sdi->channel_groups) { + if (!channel_group) + printf(" across all channel groups"); else - printf(" on probe group %s", probe_group->name); + printf(" on channel group %s", channel_group->name); } printf(":\n"); opts = g_variant_get_fixed_array(gvar_opts, &num_opts, sizeof(int32_t)); @@ -284,7 +284,7 @@ void show_dev_detail(void) continue; if (srci->key == SR_CONF_TRIGGER_TYPE) { - if (sr_config_list(sdi->driver, sdi, probe_group, srci->key, + if (sr_config_list(sdi->driver, sdi, channel_group, srci->key, &gvar) != SR_OK) { printf("\n"); continue; @@ -305,7 +305,7 @@ void show_dev_detail(void) * only to those that don't support compression, or * have it turned off by default. The values returned * are the low/high limits. */ - if (sr_config_list(sdi->driver, sdi, probe_group, srci->key, + if (sr_config_list(sdi->driver, sdi, channel_group, srci->key, &gvar) != SR_OK) { continue; } @@ -316,7 +316,7 @@ void show_dev_detail(void) } else if (srci->key == SR_CONF_SAMPLERATE) { /* Supported samplerates */ printf(" %s", srci->id); - if (sr_config_list(sdi->driver, sdi, probe_group, SR_CONF_SAMPLERATE, + if (sr_config_list(sdi->driver, sdi, channel_group, SR_CONF_SAMPLERATE, &gvar_dict) != SR_OK) { printf("\n"); continue; @@ -359,7 +359,7 @@ void show_dev_detail(void) } else if (srci->key == SR_CONF_BUFFERSIZE) { /* Supported buffer sizes */ printf(" %s", srci->id); - if (sr_config_list(sdi->driver, sdi, probe_group, + if (sr_config_list(sdi->driver, sdi, channel_group, SR_CONF_BUFFERSIZE, &gvar_list) != SR_OK) { printf("\n"); continue; @@ -374,7 +374,7 @@ void show_dev_detail(void) } else if (srci->key == SR_CONF_TIMEBASE) { /* Supported time bases */ printf(" %s", srci->id); - if (sr_config_list(sdi->driver, sdi, probe_group, + if (sr_config_list(sdi->driver, sdi, channel_group, SR_CONF_TIMEBASE, &gvar_list) != SR_OK) { printf("\n"); continue; @@ -393,7 +393,7 @@ void show_dev_detail(void) } else if (srci->key == SR_CONF_VDIV) { /* Supported volts/div values */ printf(" %s", srci->id); - if (sr_config_list(sdi->driver, sdi, probe_group, + if (sr_config_list(sdi->driver, sdi, channel_group, SR_CONF_VDIV, &gvar_list) != SR_OK) { printf("\n"); continue; @@ -411,14 +411,14 @@ void show_dev_detail(void) } else if (srci->datatype == SR_T_CHAR) { printf(" %s: ", srci->id); - if (sr_config_get(sdi->driver, sdi, probe_group, srci->key, + if (sr_config_get(sdi->driver, sdi, channel_group, srci->key, &gvar) == SR_OK) { tmp_str = g_strdup(g_variant_get_string(gvar, NULL)); g_variant_unref(gvar); } else tmp_str = NULL; - if (sr_config_list(sdi->driver, sdi, probe_group, srci->key, + if (sr_config_list(sdi->driver, sdi, channel_group, srci->key, &gvar) != SR_OK) { printf("\n"); continue; @@ -439,7 +439,7 @@ void show_dev_detail(void) } else if (srci->datatype == SR_T_UINT64_RANGE) { printf(" %s: ", srci->id); - if (sr_config_list(sdi->driver, sdi, probe_group, srci->key, + if (sr_config_list(sdi->driver, sdi, channel_group, srci->key, &gvar_list) != SR_OK) { printf("\n"); continue; diff --git a/sigrok-cli.h b/sigrok-cli.h index 278eb8f..7a5c3f5 100644 --- a/sigrok-cli.h +++ b/sigrok-cli.h @@ -41,7 +41,7 @@ void show_pd_detail(void); /* device.c */ GSList *device_scan(void); -struct sr_probe_group *select_probe_group(struct sr_dev_inst *sdi); +struct sr_channel_group *select_channel_group(struct sr_dev_inst *sdi); /* session.c */ int setup_output_format(void);