};
/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */
-static GSList *dev_insts = NULL;
+SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;
+static struct sr_dev_driver *zdi = &zeroplus_logic_cube_driver_info;
static libusb_context *usb_context = NULL;
struct libusb_device_descriptor des;
int i;
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index)))
return NULL;
libusb_get_device_list(usb_context, &devlist);
sdi->priv = ctx;
- dev_insts =
- g_slist_append(dev_insts, sdi);
+ zdi->instances = g_slist_append(zdi->instances, sdi);
ctx->usb = sr_usb_dev_inst_new(
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
{
struct sr_dev_inst *sdi;
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR; /* TODO: SR_ERR_ARG? */
}
GSList *l;
struct sr_dev_inst *sdi;
- for (l = dev_insts; l; l = l->next) {
+ for (l = zdi->instances; l; l = l->next) {
sdi = l->data;
/* Properly close all devices... */
close_dev(sdi);
/* ...and free all their memory. */
sr_dev_inst_free(sdi);
}
- g_slist_free(dev_insts);
- dev_insts = NULL;
+ g_slist_free(zdi->instances);
+ zdi->instances = NULL;
if (usb_context)
libusb_exit(usb_context);
struct context *ctx;
const void *info;
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return NULL;
}
{
struct sr_dev_inst *sdi;
- sdi = sr_dev_inst_get(dev_insts, dev_index);
+ sdi = sr_dev_inst_get(zdi->instances, dev_index);
if (sdi)
return sdi->status;
else
struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
unsigned char *buf;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR;
}
packet.type = SR_DF_END;
sr_session_send(cb_data, &packet);
- if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(zdi->instances, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
return SR_ERR_BUG;
}
.dev_config_set = hw_dev_config_set,
.dev_acquisition_start = hw_dev_acquisition_start,
.dev_acquisition_stop = hw_dev_acquisition_stop,
+ .instances = NULL,
};