Improve the condition which presents the "(current)" decoration when
voltage ranges are listed in --show output. Use an explicit boolean
which is derived from the config getter's return code. Avoid "forcing"
a comparison against a zero value, which can be a valid item in the list
of supported voltages.
This is similar to commit
0171a4a7a49f. See more context (-U10) for the
motivation of the change. Was observed with the kingst-la2016 driver.
char *tmp_str, *s, c;
const char **stropts;
double tmp_flt;
- gboolean have_tmp_flt;
+ gboolean have_tmp_flt, have_curr;
const double *fltopts;
if (parse_driver(opt_drv, &driver_from_opt, NULL)) {
continue;
}
+ have_curr = FALSE;
if (maybe_config_get(driver, sdi, channel_group, key, &gvar) == SR_OK) {
g_variant_get(gvar, "(dd)", &dcur_low, &dcur_high);
g_variant_unref(gvar);
- } else {
- dcur_low = 0;
- dcur_high = 0;
+ have_curr = TRUE;
}
num_elements = g_variant_n_children(gvar_list);
if (i)
printf(", ");
printf("%.1f-%.1f", dlow, dhigh);
+ if (!have_curr)
+ continue;
if (dlow == dcur_low && dhigh == dcur_high)
printf(" (current)");
}