From: Bert Vermeulen Date: Thu, 9 Jan 2014 12:23:32 +0000 (+0100) Subject: Check device uncompressed memory size before running. X-Git-Tag: sigrok-cli-0.5.0~48 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c7a5cb12421c05c2ab3e54472f93531a239ca12c;p=sigrok-cli.git Check device uncompressed memory size before running. --- diff --git a/session.c b/session.c index a8a647a..6f90085 100644 --- 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.");