]> sigrok.org Git - sigrok-cli.git/commitdiff
support for live status of SR_CONF_DATALOG
authorBert Vermeulen <redacted>
Mon, 11 Mar 2013 15:30:14 +0000 (16:30 +0100)
committerBert Vermeulen <redacted>
Mon, 11 Mar 2013 15:30:14 +0000 (16:30 +0100)
sigrok-cli.c

index e58c51422a817ac37c8e0171c570caaa2bdbfeb2..231572c6767d5c8c71a7ebe484b600b678efbdb6 100644 (file)
@@ -305,7 +305,7 @@ static void show_dev_detail(void)
        GSList *devices;
        uint64_t *integers;
        const int *hwopts, *hwcaps;
-       int cap, num_devices, n, i;
+       int cap, num_devices, *tmp_bool, i;
        char *s, *title;
        const char *charopts, **stropts;
 
@@ -324,6 +324,14 @@ static void show_dev_detail(void)
        sdi = devices->data;
        print_dev_line(sdi);
 
+       /* This properly opens and initializes the device, so we can get
+        * current settings. */
+       sr_session_new();
+       if (sr_session_dev_add(sdi) != SR_OK) {
+               g_critical("Failed to use device.");
+               return;
+       }
+
        if (sr_config_list(sdi->driver, SR_CONF_TRIGGER_TYPE, (const void **)&charopts,
                        sdi) == SR_OK && charopts) {
                printf("Supported triggers: ");
@@ -474,12 +482,22 @@ static void show_dev_detail(void)
                        for (i = 0; stropts[i]; i++)
                                printf("      %s\n", stropts[i]);
 
+               } else if (srci->key == SR_CONF_DATALOG) {
+                       /* Turning on/off internal data logging. */
+                       printf("    %s\t(on/off", srci->id);
+                       if (sr_config_get(sdi->driver, SR_CONF_DATALOG,
+                                               (const void **)&tmp_bool, sdi) == SR_OK) {
+                               printf(", currently %s", *tmp_bool ? "on" : "off");
+                       }
+                       printf(")\n");
                } else {
                        /* Everything else */
                        printf("    %s\n", srci->id);
                }
        }
 
+       sr_session_destroy();
+
 }
 
 static void show_pd_detail(void)