X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Ffx2lafw%2Fapi.c;h=29c1887e9ac6c2ac307ba1f9e8509cd5aed96625;hb=7f4975b4401a1e8de61e356b5b272fc00b658260;hp=1fd59627238c96ebdb387eb8eee69027b07a4012;hpb=2f9376117c804898eaf75c3efebdbd97b6d89695;p=libsigrok.git diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 1fd59627..29c1887e 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -230,7 +230,7 @@ static GSList *scan(GSList *options) sr_err("Firmware upload failed for " "device %d.", devcnt); sdi->inst_type = SR_INST_USB; - sdi->conn = sr_usb_dev_inst_new (libusb_get_bus_number(devlist[i]), + sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]), 0xff, NULL); } } @@ -291,7 +291,7 @@ static int dev_open(struct sr_dev_inst *sdi) ret = libusb_claim_interface(usb->devhdl, USB_INTERFACE); if (ret != 0) { - switch(ret) { + switch (ret) { case LIBUSB_ERROR_BUSY: sr_err("Unable to claim USB interface. Another " "program or driver has already claimed it."); @@ -350,12 +350,15 @@ static int cleanup(void) 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_probe_group *probe_group) { struct dev_context *devc; struct sr_usb_dev_inst *usb; char str[128]; + (void)probe_group; + switch (id) { case SR_CONF_CONN: if (!sdi || !sdi->conn) @@ -381,11 +384,14 @@ 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_probe_group *probe_group) { struct dev_context *devc; int ret; + (void)probe_group; + if (sdi->status != SR_ST_ACTIVE) return SR_ERR; @@ -404,12 +410,14 @@ 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_probe_group *probe_group) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; + (void)probe_group; switch (key) { case SR_CONF_SCAN_OPTIONS: @@ -460,7 +468,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) struct drv_context *drvc; struct sr_usb_dev_inst *usb; struct libusb_transfer *transfer; - const struct libusb_pollfd **lupfd; unsigned int i, timeout, num_transfers; int ret; unsigned char *buf; @@ -516,17 +523,9 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) devc->submitted_transfers++; } - lupfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx); - for (i = 0; lupfd[i]; i++); - if (!(devc->usbfd = g_try_malloc(sizeof(struct libusb_pollfd) * (i + 1)))) - return SR_ERR; - for (i = 0; lupfd[i]; i++) { - sr_source_add(lupfd[i]->fd, lupfd[i]->events, - timeout, receive_data, NULL); - devc->usbfd[i] = lupfd[i]->fd; - } - devc->usbfd[i] = -1; - free(lupfd); + devc->ctx = drvc->sr_ctx; + + usb_source_add(devc->ctx, timeout, receive_data, NULL); /* Send header packet to the session bus. */ std_session_send_df_header(cb_data, LOG_PREFIX);