Skip to content

Commit

Permalink
Rename 'probe group' to 'channel group' everywhere.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
uwehermann committed Mar 25, 2014
1 parent 426d0cd commit ca50f4b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
20 changes: 10 additions & 10 deletions device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
}

Expand Down
8 changes: 4 additions & 4 deletions doc/sigrok-cli.1
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<probe\ group>
Specify the probe group to operate on.
.BR "\-g, \-\-channel\-group "<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 " <triggerlist>
Expand Down
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
50 changes: 25 additions & 25 deletions show.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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));
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sigrok-cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca50f4b

Please sign in to comment.