]> sigrok.org Git - libsigrok.git/blobdiff - input/binary.c
sr: change all drivers to use SR_DF_META_LOGIC
[libsigrok.git] / input / binary.c
index 89a6b25bb9cbfb73289df0e53c6b385a2976a007..4d6c42461e64051af849fddf86ecef1a4f513e98 100644 (file)
@@ -67,6 +67,7 @@ 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_logic logic;
        unsigned char buffer[CHUNKSIZE];
        int fd, size, num_probes;
@@ -78,13 +79,18 @@ static int loadfile(struct sr_input *in, const char *filename)
 
        /* send header */
        header.feed_version = 1;
-       header.num_logic_probes = num_probes;
-       header.samplerate = 0;
        gettimeofday(&header.starttime, NULL);
        packet.type = SR_DF_HEADER;
        packet.payload = &header;
        sr_session_send(in->vdev, &packet);
 
+       /* Send metadata about the SR_DF_LOGIC packets to come. */
+       packet.type = SR_DF_META_LOGIC;
+       packet.payload = &meta;
+       meta.samplerate = 0;
+       meta.num_probes = num_probes;
+       sr_session_send(in->vdev, &packet);
+
        /* chop up the input file into chunks and feed it into the session bus */
        packet.type = SR_DF_LOGIC;
        packet.payload = &logic;