From: Bert Vermeulen Date: Sun, 13 Apr 2014 18:51:59 +0000 (+0200) Subject: Always get samplerate at the start of acquisition. X-Git-Tag: sigrok-cli-0.5.0~14 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8b65cdcc7db2ea380003fe98d93782e4343b8e70;p=sigrok-cli.git Always get samplerate at the start of acquisition. --- diff --git a/session.c b/session.c index d9b6c79..1e737a6 100644 --- a/session.c +++ b/session.c @@ -154,6 +154,7 @@ void datafeed_in(const struct sr_dev_inst *sdi, static FILE *outfile = NULL; GSList *l; GString *out; + GVariant *gvar; uint64_t end_sample; uint64_t output_len, input_len; uint8_t *output_buf; @@ -197,13 +198,15 @@ void datafeed_in(const struct sr_dev_inst *sdi, } rcvd_samples_logic = rcvd_samples_analog = 0; + if (sr_config_get(sdi->driver, sdi, NULL, SR_CONF_SAMPLERATE, + &gvar) == SR_OK) { + samplerate = g_variant_get_uint64(gvar); + g_variant_unref(gvar); + } + #ifdef HAVE_SRD if (opt_pds) { - GVariant *gvar; - if (sr_config_get(sdi->driver, sdi, NULL, SR_CONF_SAMPLERATE, - &gvar) == SR_OK) { - samplerate = g_variant_get_uint64(gvar); - g_variant_unref(gvar); + if (samplerate) { if (srd_session_metadata_set(srd_sess, SRD_CONF_SAMPLERATE, g_variant_new_uint64(samplerate)) != SRD_OK) { g_critical("Failed to configure decode session.");