GSList *l, *devices, *conn_devices;
struct libusb_device_descriptor des;
libusb_device **devlist;
GSList *l, *devices, *conn_devices;
struct libusb_device_descriptor des;
libusb_device **devlist;
- if ((ret = libusb_get_device_descriptor(devlist[i], &des)) != 0) {
- sr_warn("Failed to get device descriptor: %s.",
- libusb_error_name(ret));
- continue;
- }
+ libusb_get_device_descriptor(devlist[i], &des);
sdi->status = SR_ST_INITIALIZING;
sdi->vendor = g_strdup("Saleae");
sdi->model = g_strdup("Logic16");
sdi->status = SR_ST_INITIALIZING;
sdi->vendor = g_strdup("Saleae");
sdi->model = g_strdup("Logic16");
sdi->connection_id = g_strdup(connection_id);
for (j = 0; j < ARRAY_SIZE(channel_names); j++)
sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE,
sdi->connection_id = g_strdup(connection_id);
for (j = 0; j < ARRAY_SIZE(channel_names); j++)
sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE,
devices = g_slist_append(devices, sdi);
if (check_conf_profile(devlist[i])) {
devices = g_slist_append(devices, sdi);
if (check_conf_profile(devlist[i])) {
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
} else {
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
} else {
- if (ezusb_upload_firmware(devlist[i], USB_CONFIGURATION,
- FX2_FIRMWARE) == SR_OK)
+ if (ezusb_upload_firmware(drvc->sr_ctx, devlist[i],
+ USB_CONFIGURATION, FX2_FIRMWARE) == SR_OK)
libusb_free_device_list(devlist, 1);
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
libusb_free_device_list(devlist, 1);
g_slist_free_full(conn_devices, (GDestroyNotify)sr_usb_dev_inst_free);
struct sr_usb_dev_inst *usb;
struct libusb_device_descriptor des;
struct drv_context *drvc;
struct sr_usb_dev_inst *usb;
struct libusb_device_descriptor des;
struct drv_context *drvc;
device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
if (device_count < 0) {
sr_err("Failed to get device list: %s.",
device_count = libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
if (device_count < 0) {
sr_err("Failed to get device list: %s.",
- if ((ret = libusb_get_device_descriptor(devlist[i], &des))) {
- sr_err("Failed to get device descriptor: %s.",
- libusb_error_name(ret));
- continue;
- }
+ libusb_get_device_descriptor(devlist[i], &des);
if (ret == LIBUSB_ERROR_BUSY) {
sr_err("Unable to claim USB interface. Another "
"program or driver has already claimed it.");
if (ret == LIBUSB_ERROR_BUSY) {
sr_err("Unable to claim USB interface. Another "
"program or driver has already claimed it.");
sr_info("Opened device on %d.%d (logical) / %s (physical), interface %d.",
usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
sr_info("Opened device on %d.%d (logical) / %s (physical), interface %d.",
usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
if (usb->devhdl) {
libusb_release_interface(usb->devhdl, USB_INTERFACE);
libusb_close(usb->devhdl);
if (usb->devhdl) {
libusb_release_interface(usb->devhdl, USB_INTERFACE);
libusb_close(usb->devhdl);
sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
libusb_release_interface(usb->devhdl, USB_INTERFACE);
libusb_close(usb->devhdl);
usb->devhdl = NULL;
sr_info("Closing device on %d.%d (logical) / %s (physical) interface %d.",
usb->bus, usb->address, sdi->connection_id, USB_INTERFACE);
libusb_release_interface(usb->devhdl, USB_INTERFACE);
libusb_close(usb->devhdl);
usb->devhdl = NULL;
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
break;
case SR_CONF_VOLTAGE_THRESHOLD:
g_variant_get(data, "(dd)", &low, &high);
break;
case SR_CONF_VOLTAGE_THRESHOLD:
g_variant_get(data, "(dd)", &low, &high);
usb_source_add(sdi->session, devc->ctx, timeout, receive_data, (void *)sdi);
usb_source_add(sdi->session, devc->ctx, timeout, receive_data, (void *)sdi);
.name = "saleae-logic16",
.longname = "Saleae Logic16",
.api_version = 1,
.name = "saleae-logic16",
.longname = "Saleae Logic16",
.api_version = 1,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,
.dev_clear = NULL,
.config_get = config_get,
.config_set = config_set,