]> sigrok.org Git - sigrok-cli.git/commitdiff
Always get samplerate at the start of acquisition.
authorBert Vermeulen <redacted>
Sun, 13 Apr 2014 18:51:59 +0000 (20:51 +0200)
committerBert Vermeulen <redacted>
Sun, 13 Apr 2014 18:51:59 +0000 (20:51 +0200)
session.c

index d9b6c79209855a7f364f994113564ca2e02c3026..1e737a6c7c154c37233c139c4e5631a2f44370a5 100644 (file)
--- 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.");