From: Bert Vermeulen Date: Sat, 16 Mar 2013 20:50:35 +0000 (+0100) Subject: lascar-el-usb: push samplerate before data log X-Git-Tag: dsupstream~246 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8e77bc20b92574076683d861687b63b416d3e965;p=libsigrok.git lascar-el-usb: push samplerate before data log --- diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 94018372..634d6f17 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -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;