From: Bert Vermeulen Date: Sun, 7 Sep 2014 12:58:16 +0000 (+0200) Subject: Add missing --show pretty-printers. X-Git-Tag: sigrok-cli-0.6.0~69 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dcb420e7b876392ae3bbbaf6a5d41e3d722a7b3a;p=sigrok-cli.git Add missing --show pretty-printers. --- diff --git a/show.c b/show.c index 8b6ee77..13415c4 100644 --- a/show.c +++ b/show.c @@ -446,6 +446,10 @@ void show_dev_detail(void) if (sr_config_list(sdi->driver, sdi, channel_group, srci->key, &gvar) != SR_OK) { + if (tmp_str) { + /* Can't list it, but we have a value to show. */ + printf("%s (current)", tmp_str); + } printf("\n"); continue; } @@ -471,7 +475,7 @@ void show_dev_detail(void) continue; } - if (sr_config_get(sdi->driver, sdi, NULL, srci->key, &gvar) == SR_OK) { + if (sr_config_get(sdi->driver, sdi, channel_group, srci->key, &gvar) == SR_OK) { g_variant_get(gvar, "(tt)", &cur_low, &cur_high); g_variant_unref(gvar); } else { @@ -495,7 +499,7 @@ void show_dev_detail(void) } else if (srci->datatype == SR_T_BOOL) { printf(" %s: ", srci->id); - if (sr_config_get(sdi->driver, sdi, NULL, srci->key, + if (sr_config_get(sdi->driver, sdi, channel_group, srci->key, &gvar) == SR_OK) { if (g_variant_get_boolean(gvar)) printf("on (current), off\n"); @@ -513,7 +517,7 @@ void show_dev_detail(void) continue; } - if (sr_config_get(sdi->driver, sdi, NULL, srci->key, &gvar) == SR_OK) { + if (sr_config_get(sdi->driver, sdi, channel_group, srci->key, &gvar) == SR_OK) { g_variant_get(gvar, "(dd)", &dcur_low, &dcur_high); g_variant_unref(gvar); } else { @@ -535,6 +539,15 @@ void show_dev_detail(void) printf("\n"); g_variant_unref(gvar_list); + } else if (srci->datatype == SR_T_FLOAT) { + printf(" %s: ", srci->id); + if (sr_config_get(sdi->driver, sdi, channel_group, srci->key, + &gvar) == SR_OK) { + printf("%f\n", g_variant_get_double(gvar)); + g_variant_unref(gvar); + } else + printf("on, off\n"); + } else { /* Everything else */