]> sigrok.org Git - sigrok-cli.git/commitdiff
Check device uncompressed memory size before running.
authorBert Vermeulen <redacted>
Thu, 9 Jan 2014 12:23:32 +0000 (13:23 +0100)
committerBert Vermeulen <redacted>
Thu, 9 Jan 2014 12:23:32 +0000 (13:23 +0100)
session.c

index a8a647a35079c9a0ad5223319df77b24377523e9..6f900853be27b7d2cc99da10ed9fccf51e43a1ed 100644 (file)
--- a/session.c
+++ b/session.c
@@ -551,6 +551,7 @@ void run_session(void)
        GHashTable *devargs;
        GVariant *gvar;
        struct sr_dev_inst *sdi;
+       uint64_t max_samples;
        int max_probes, i;
        char **triggerlist;
 
@@ -629,6 +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) {
+                       /* The device has no compression, or compression is turned
+                        * off, and publishes its sample memory size. */
+                       max_samples = g_variant_get_uint64(gvar);
+                       if (limit_samples > max_samples) {
+                               g_critical("The device can store only %"PRIu64
+                                               " samples with the current settings.", max_samples);
+                       }
+               }
                gvar = g_variant_new_uint64(limit_samples);
                if (sr_config_set(sdi, NULL, SR_CONF_LIMIT_SAMPLES, gvar) != SR_OK) {
                        g_critical("Failed to configure sample limit.");