]> sigrok.org Git - libsigrok.git/blobdiff - hardware/victor-dmm/api.c
Replace 'probe group' with 'channel group' everywhere.
[libsigrok.git] / hardware / victor-dmm / api.c
index e50e338104b2617f350120b8b4a03ebc58ffd773..4c7cdc2029ba5b1e652d5a1088eccf0744b40966 100644 (file)
@@ -46,11 +46,6 @@ static const int32_t hwcaps[] = {
        SR_CONF_CONTINUOUS,
 };
 
-static int dev_clear(void)
-{
-       return std_dev_clear(di, NULL);
-}
-
 static int init(struct sr_context *sr_ctx)
 {
        return std_init(sr_ctx, di, LOG_PREFIX);
@@ -198,18 +193,22 @@ static int cleanup(void)
                /* Can get called on an unused driver, doesn't matter. */
                return SR_OK;
 
-       ret = dev_clear();
+
+       ret = std_dev_clear(di, NULL);
        g_free(drvc);
        di->priv = NULL;
 
        return ret;
 }
 
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *channel_group)
 {
        struct sr_usb_dev_inst *usb;
        char str[128];
 
+       (void)channel_group;
+
        switch (id) {
        case SR_CONF_CONN:
                if (!sdi || !sdi->conn)
@@ -225,12 +224,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
+static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *channel_group)
 {
        struct dev_context *devc;
        gint64 now;
        int ret;
 
+       (void)channel_group;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -261,10 +263,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        return ret;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_channel_group *channel_group)
 {
-
        (void)sdi;
+       (void)channel_group;
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
@@ -331,7 +334,6 @@ static int handle_events(int fd, int revents, void *cb_data)
        struct sr_dev_inst *sdi;
        struct timeval tv;
        gint64 now;
-       int i;
 
        (void)fd;
        (void)revents;
@@ -346,8 +348,7 @@ static int handle_events(int fd, int revents, void *cb_data)
        }
 
        if (sdi->status == SR_ST_STOPPING) {
-               for (i = 0; devc->usbfd[i] != -1; i++)
-                       sr_source_remove(devc->usbfd[i]);
+               usb_source_remove(drvc->sr_ctx);
 
                dev_close(sdi);
 
@@ -366,10 +367,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct drv_context *drvc = di->priv;
-       const struct libusb_pollfd **pfd;
        struct sr_usb_dev_inst *usb;
        struct libusb_transfer *transfer;
-       int ret, i;
+       int ret;
        unsigned char *buf;
 
        if (sdi->status != SR_ST_ACTIVE)
@@ -387,15 +387,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        /* Send header packet to the session bus. */
        std_session_send_df_header(cb_data, LOG_PREFIX);
 
-       pfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
-       for (i = 0; pfd[i]; i++) {
-               /* Handle USB events every 100ms, for decent latency. */
-               sr_source_add(pfd[i]->fd, pfd[i]->events, 100,
-                               handle_events, (void *)sdi);
-               /* We'll need to remove this fd later. */
-               devc->usbfd[i] = pfd[i]->fd;
-       }
-       devc->usbfd[i] = -1;
+       usb_source_add(drvc->sr_ctx, 100, handle_events, (void *)sdi);
 
        buf = g_try_malloc(DMM_DATA_SIZE);
        transfer = libusb_alloc_transfer(0);
@@ -443,7 +435,7 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = dev_clear,
+       .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,