X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=show.c;h=74a50bb88368730753bb1cb0ae08a497d3aa10c5;hp=db643d13304a88ed0e61f5eae21610b6b7e6bc27;hb=8667d3c244533a17839a4ea0e891251ff7f86af7;hpb=20fb52e08416238c60392b410f69856cc7d98650 diff --git a/show.c b/show.c index db643d1..74a50bb 100644 --- a/show.c +++ b/show.c @@ -20,6 +20,7 @@ #include "sigrok-cli.h" #include "config.h" #include +#include extern gint opt_loglevel; extern gchar *opt_pds; @@ -187,7 +188,11 @@ void show_dev_detail(void) g_variant_unref(gvar_opts); } + /* Selected probes and probe group may affect which options are + * returned, or which values for them. */ + select_probes(sdi); probe_group = select_probe_group(sdi); + if ((sr_config_list(sdi->driver, sdi, probe_group, SR_CONF_DEVICE_OPTIONS, &gvar_opts)) != SR_OK) /* Driver supports no device instance options. */ @@ -235,19 +240,20 @@ void show_dev_detail(void) printf("\n"); g_variant_unref(gvar); - } else if (srci->key == SR_CONF_PATTERN_MODE) { - /* Pattern generator modes */ - printf(" %s", srci->id); + } else if (srci->key == SR_CONF_LIMIT_SAMPLES) { + /* If implemented in config_list(), this denotes the + * maximum number of samples a device can send. This + * really applies only to logic analyzers, and then + * 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, - &gvar) == SR_OK) { - printf(" - supported patterns:\n"); - stropts = g_variant_get_strv(gvar, &num_elements); - for (i = 0; i < num_elements; i++) - printf(" %s\n", stropts[i]); - g_variant_unref(gvar); - } else { - printf("\n"); + &gvar) != SR_OK) { + continue; } + g_variant_get(gvar, "(tt)", &low, &high); + g_variant_unref(gvar); + printf(" Maximum number of samples: %"PRIu64"\n", high); } else if (srci->key == SR_CONF_SAMPLERATE) { /* Supported samplerates */ @@ -431,11 +437,12 @@ void show_dev_detail(void) #ifdef HAVE_SRD void show_pd_detail(void) { - GSList *l; + GSList *l, *ll; struct srd_decoder *dec; struct srd_decoder_option *o; char **pdtokens, **pdtok, *optsep, **ann, *val, *doc; struct srd_probe *p; + struct srd_decoder_annotation_row *r; pdtokens = g_strsplit(opt_pds, ",", -1); for (pdtok = pdtokens; *pdtok; pdtok++) { @@ -449,11 +456,23 @@ void show_pd_detail(void) printf("ID: %s\nName: %s\nLong name: %s\nDescription: %s\n", dec->id, dec->name, dec->longname, dec->desc); printf("License: %s\n", dec->license); - printf("Annotations:\n"); + printf("Annotation classes:\n"); if (dec->annotations) { for (l = dec->annotations; l; l = l->next) { ann = l->data; - printf("- %s\n %s\n", ann[0], ann[1]); + printf("- %s: %s\n", ann[0], ann[1]); + } + } else { + printf("None.\n"); + } + printf("Annotation rows:\n"); + if (dec->annotation_rows) { + for (l = dec->annotation_rows; l; l = l->next) { + r = l->data; + printf("- %s (%s): ", r->id, r->desc); + for (ll = r->ann_classes; ll; ll = ll->next) + printf("%d ", GPOINTER_TO_INT(ll->data)); + printf("\n"); } } else { printf("None.\n"); @@ -463,7 +482,7 @@ void show_pd_detail(void) for (l = dec->probes; l; l = l->next) { p = l->data; printf("- %s (%s): %s\n", - p->name, p->id, p->desc); + p->id, p->name, p->desc); } } else { printf("None.\n"); @@ -473,19 +492,22 @@ void show_pd_detail(void) for (l = dec->opt_probes; l; l = l->next) { p = l->data; printf("- %s (%s): %s\n", - p->name, p->id, p->desc); + p->id, p->name, p->desc); } } else { printf("None.\n"); } + printf("Options:\n"); if (dec->options) { - printf("Options:\n"); for (l = dec->options; l; l = l->next) { o = l->data; val = g_variant_print(o->def, FALSE); - printf("- %s: %s (default %s)\n", o->id, o->desc, val); + printf("- %s: %s (default %s)\n", o->id, + o->desc, val); g_free(val); } + } else { + printf("None.\n"); } if ((doc = srd_decoder_doc_get(dec))) { printf("Documentation:\n%s\n",