]> sigrok.org Git - libsigrok.git/blobdiff - hardware/fx2lafw/fx2lafw.c
Add and use std_session_send_df_header().
[libsigrok.git] / hardware / fx2lafw / fx2lafw.c
index a0955371a21e105fd129208a03e7c6d4ef264691..1bbb45470bbbd5fb567cd38eab971752ff2f6079 100644 (file)
@@ -118,10 +118,10 @@ static const uint64_t supported_samplerates[] = {
 };
 
 static const struct sr_samplerates samplerates = {
-       0,
-       0,
-       0,
-       supported_samplerates,
+       .low  = 0,
+       .high = 0,
+       .step = 0,
+       .list = supported_samplerates,
 };
 
 SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
@@ -478,11 +478,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
@@ -563,6 +559,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
        struct dev_context *devc;
 
        devc = sdi->priv;
+
        if (devc->usb->devhdl == NULL)
                return SR_ERR;
 
@@ -926,8 +923,6 @@ static unsigned int get_timeout(struct dev_context *devc)
 static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                void *cb_data)
 {
-       struct sr_datafeed_packet packet;
-       struct sr_datafeed_header header;
        struct dev_context *devc;
        struct drv_context *drvc;
        struct libusb_transfer *transfer;
@@ -991,11 +986,8 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                              timeout, receive_data, NULL);
        free(lupfd); /* NOT g_free()! */
 
-       packet.type = SR_DF_HEADER;
-       packet.payload = &header;
-       header.feed_version = 1;
-       gettimeofday(&header.starttime, NULL);
-       sr_session_send(cb_data, &packet);
+       /* Send header packet to the session bus. */
+       std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
 
        if ((ret = command_start_acquisition(devc->usb->devhdl,
                devc->cur_samplerate, devc->sample_wide)) != SR_OK) {