]> sigrok.org Git - libsigrok.git/commitdiff
lascar-el-usb: push samplerate before data log
authorBert Vermeulen <redacted>
Sat, 16 Mar 2013 20:50:35 +0000 (21:50 +0100)
committerBert Vermeulen <redacted>
Sat, 16 Mar 2013 20:52:02 +0000 (21:52 +0100)
hardware/lascar-el-usb/api.c

index 94018372cdbe2f4a288d50e12fbf36928c90e60e..634d6f1745b6ae570bbaeb9aba2322230e71cbdd 100644 (file)
@@ -350,11 +350,14 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                void *cb_data)
 {
        struct sr_datafeed_packet packet;
+       struct sr_datafeed_meta meta;
+       struct sr_config *src;
        struct dev_context *devc;
-       struct drv_context *drvc = di->priv;
+       struct drv_context *drvc;
        struct libusb_transfer *xfer_in, *xfer_out;
        const struct libusb_pollfd **pfd;
        struct timeval tv;
+       uint64_t interval;
        int ret, i;
        unsigned char cmd[3], resp[4], *buf;
 
@@ -363,6 +366,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                return SR_ERR;
        }
 
+       drvc = di->priv;
        devc = sdi->priv;
        devc->cb_data = cb_data;
 
@@ -374,6 +378,14 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        /* Send header packet to the session bus. */
        std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
 
+       interval = (devc->config[0x1c] | (devc->config[0x1d] << 8)) * 1000;
+       packet.type = SR_DF_META;
+       packet.payload = &meta;
+       src = sr_config_make(SR_CONF_SAMPLE_INTERVAL, (const void *)&interval);
+       meta.config = g_slist_append(NULL, src);
+       sr_session_send(devc->cb_data, &packet);
+       g_free(src);
+
        if (devc->logged_samples == 0) {
                /* This ensures the frontend knows the session is done. */
                packet.type = SR_DF_END;