Don't use SR_CONF_MAX_UNCOMPRESSED_SAMPLES.
authorBert Vermeulen <bert@biot.com>
Sun, 19 Jan 2014 16:22:19 +0000 (17:22 +0100)
committerBert Vermeulen <bert@biot.com>
Sun, 19 Jan 2014 16:22:19 +0000 (17:22 +0100)
This uses the new sr_config_list(SR_CONF_LIMIT_SAMPLES) method to
get the same information.

session.c
show.c

index 4a31c42f13803be8572f36e1a121d4945d612458..82efee0729ce214bc4e9dab8cba00b53b00a2c53 100644 (file)
--- a/session.c
+++ b/session.c
@@ -551,7 +551,7 @@ void run_session(void)
        GHashTable *devargs;
        GVariant *gvar;
        struct sr_dev_inst *sdi;
-       uint64_t max_samples;
+       uint64_t min_samples, max_samples;
        int max_probes, i;
        char **triggerlist;
 
@@ -630,12 +630,16 @@ void run_session(void)
                        sr_session_destroy();
                        return;
                }
-               if (sr_config_get(sdi->driver, sdi, NULL,
-                               SR_CONF_MAX_UNCOMPRESSED_SAMPLES, &gvar) == SR_OK) {
+               if (sr_config_list(sdi->driver, sdi, NULL,
+                               SR_CONF_LIMIT_SAMPLES, &gvar) == SR_OK) {
                        /* The device has no compression, or compression is turned
                         * off, and publishes its sample memory size. */
-                       max_samples = g_variant_get_uint64(gvar);
+                       g_variant_get(gvar, "(tt)", &min_samples, &max_samples);
                        g_variant_unref(gvar);
+                       if (limit_samples < min_samples) {
+                               g_critical("The device stores at least %"PRIu64
+                                               " samples with the current settings.", min_samples);
+                       }
                        if (limit_samples > max_samples) {
                                g_critical("The device can store only %"PRIu64
                                                " samples with the current settings.", max_samples);
diff --git a/show.c b/show.c
index 6b2f9853b0fbf9731b0b237117f804fba2bc8ce3..e1a5bad6cbb59981b1028953121c6046a3617c78 100644 (file)
--- a/show.c
+++ b/show.c
@@ -187,7 +187,11 @@ void show_dev_detail(void)
                g_variant_unref(gvar_opts);
        }
 
+       /* Selected probes and probe group may affect which options are
+        * returned, or which values for them. */
+       select_probes(sdi);
        probe_group = select_probe_group(sdi);
+
        if ((sr_config_list(sdi->driver, sdi, probe_group, SR_CONF_DEVICE_OPTIONS,
                        &gvar_opts)) != SR_OK)
                /* Driver supports no device instance options. */
@@ -235,6 +239,21 @@ void show_dev_detail(void)
                        printf("\n");
                        g_variant_unref(gvar);
 
+               } else if (srci->key == SR_CONF_LIMIT_SAMPLES) {
+                       /* If implemented in config_list(), this denotes the
+                        * maximum number of samples a device can send. This
+                        * really applies only to logic analyzers, and then
+                        * only to those that don't support compression, or
+                        * have it turned off by default. The values returned
+                        * are the low/high limits. */
+                       if (sr_config_list(sdi->driver, sdi, probe_group, srci->key,
+                                       &gvar) != SR_OK) {
+                               continue;
+                       }
+                       g_variant_get(gvar, "(tt)", &low, &high);
+                       g_variant_unref(gvar);
+                       printf("    Maximum number of samples: %"PRIu64"\n", high);
+
                } else if (srci->key == SR_CONF_SAMPLERATE) {
                        /* Supported samplerates */
                        printf("    %s", srci->id);