]> sigrok.org Git - sigrok-cli.git/commitdiff
Add missing --show pretty-printers.
authorBert Vermeulen <redacted>
Sun, 7 Sep 2014 12:58:16 +0000 (14:58 +0200)
committerBert Vermeulen <redacted>
Sun, 7 Sep 2014 12:58:16 +0000 (14:58 +0200)
show.c

diff --git a/show.c b/show.c
index 8b6ee7739f7461c80d9b7f6f2b956687b35d4f5a..13415c46755d646af92c822e87c4d5d49e2a113c 100644 (file)
--- 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 */