X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=show.c;h=5c35bb317c972b0442622ef36245a68fd0ba7d63;hb=0e2f95c489ba93227b20747ea0ed246b51e5bf9e;hp=41474b3decfcc7cdea7cdfd92a15129f68998e39;hpb=917c8f83ba2f01677aec2b37aa2d6ae924171ff9;p=sigrok-cli.git diff --git a/show.c b/show.c index 41474b3..5c35bb3 100644 --- a/show.c +++ b/show.c @@ -404,6 +404,7 @@ void show_dev_detail(void) char *tmp_str, *s, c; const char **stropts; double tmp_flt; + gboolean have_tmp_flt; const double *fltopts; if (parse_driver(opt_drv, &driver_from_opt, NULL)) { @@ -440,7 +441,7 @@ void show_dev_detail(void) * returned, or which values for them. */ select_channels(sdi); - channel_group = select_channel_group(sdi); + channel_group = lookup_channel_group(sdi, NULL); if (!(opts = sr_dev_options(driver, sdi, channel_group))) /* Driver supports no device instance options. */ @@ -725,14 +726,16 @@ void show_dev_detail(void) } else if (srci->datatype == SR_T_FLOAT) { printf(" %s: ", srci->id); tmp_flt = 0.0; + have_tmp_flt = FALSE; if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) { tmp_flt = g_variant_get_double(gvar); + have_tmp_flt = TRUE; g_variant_unref(gvar); } if (maybe_config_list(driver, sdi, channel_group, key, &gvar) != SR_OK) { - if (tmp_flt) { + if (have_tmp_flt) { /* Can't list, but got a value to show. */ printf("%f (current)", tmp_flt); } @@ -745,7 +748,7 @@ void show_dev_detail(void) if (i) printf(", "); printf("%f", fltopts[i]); - if (tmp_flt && fltopts[i] == tmp_flt) + if (have_tmp_flt && fltopts[i] == tmp_flt) printf(" (current)"); } printf("\n");