X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fkecheng-kc-330b%2Fapi.c;h=d9e647d12f682818dda54d23133db5de601cdb9e;hb=c1bcb8cc633cc69ce4a872f59ec2b686bc00bd04;hp=3b6544ac028bb87cc4f13ab1d61c24d2fc88dd34;hpb=b979d0c9cbf3a697c0ac4b06031ffb18b5f60006;p=libsigrok.git diff --git a/hardware/kecheng-kc-330b/api.c b/hardware/kecheng-kc-330b/api.c index 3b6544ac..d9e647d1 100644 --- a/hardware/kecheng-kc-330b/api.c +++ b/hardware/kecheng-kc-330b/api.c @@ -168,11 +168,7 @@ static GSList *scan(GSList *options) static GSList *dev_list(void) { - struct drv_context *drvc; - - drvc = di->priv; - - return drvc->instances; + return ((struct drv_context *)(di->priv))->instances; } static int dev_clear(void) @@ -256,12 +252,15 @@ static int cleanup(void) return ret; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi) +static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_probe_group *probe_group) { struct dev_context *devc; GVariant *rational[2]; const uint64_t *si; + (void)probe_group; + devc = sdi->priv; switch (key) { case SR_CONF_LIMIT_SAMPLES: @@ -302,7 +301,8 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi) return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi) +static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, + const struct sr_probe_group *probe_group) { struct dev_context *devc; uint64_t p, q; @@ -310,6 +310,8 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi) int tmp, ret; const char *tmp_str; + (void)probe_group; + if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -379,13 +381,15 @@ static int config_set(int key, 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_probe_group *probe_group) { GVariant *tuple, *rational[2]; GVariantBuilder gvb; unsigned int i; (void)sdi; + (void)probe_group; switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -428,9 +432,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, struct sr_config *src; struct sr_usb_dev_inst *usb; GVariant *gvar, *rational[2]; - const struct libusb_pollfd **pfd; const uint64_t *si; - int stored_mqflags, req_len, buf_len, len, ret, i; + int stored_mqflags, req_len, buf_len, len, ret; unsigned char buf[9]; if (sdi->status != SR_ST_ACTIVE) @@ -490,15 +493,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, if (!(devc->xfer = libusb_alloc_transfer(0))) return SR_ERR; - pfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx); - for (i = 0; pfd[i]; i++) { - /* Handle USB events every 10ms. */ - sr_source_add(pfd[i]->fd, pfd[i]->events, 10, - kecheng_kc_330b_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, 10, + kecheng_kc_330b_handle_events, (void *)sdi); if (devc->data_source == DATA_SOURCE_LIVE) { buf[0] = CMD_GET_LIVE_SPL;