]> sigrok.org Git - libsigrok.git/blobdiff - input/binary.c
Use new SR_DF_META packet.
[libsigrok.git] / input / binary.c
index 6e11cde0844eb5e0562657eafaf9f7511a0e921e..3d4418ca41044077a771afc3898e8940210d22cb 100644 (file)
@@ -100,8 +100,9 @@ static int loadfile(struct sr_input *in, const char *filename)
 {
        struct sr_datafeed_header header;
        struct sr_datafeed_packet packet;
-       struct sr_datafeed_meta_logic meta;
+       struct sr_datafeed_meta meta;
        struct sr_datafeed_logic logic;
+       struct sr_config *src;
        unsigned char buffer[CHUNKSIZE];
        int fd, size, num_probes;
        struct context *ctx;
@@ -120,12 +121,13 @@ static int loadfile(struct sr_input *in, const char *filename)
        packet.payload = &header;
        sr_session_send(in->sdi, &packet);
 
-       /* Send metadata about the SR_DF_LOGIC packets to come. */
-       packet.type = SR_DF_META_LOGIC;
-       packet.payload = &meta;
-       meta.samplerate = ctx->samplerate;
-       meta.num_probes = num_probes;
-       sr_session_send(in->sdi, &packet);
+       if (ctx->samplerate) {
+               packet.type = SR_DF_META;
+               packet.payload = &meta;
+               src = sr_config_make(SR_HWCAP_SAMPLERATE, (const void *)&ctx->samplerate);
+               meta.config = g_slist_append(NULL, src);
+               sr_session_send(in->sdi, &packet);
+       }
 
        /* Chop up the input file into chunks & send it to the session bus. */
        packet.type = SR_DF_LOGIC;