0,
};
-static const char *probe_names[] = {
- "Probe",
- NULL,
-};
-
SR_PRIV struct sr_dev_driver uni_t_ut61d_driver_info;
SR_PRIV struct sr_dev_driver voltcraft_vc820_driver_info;
return SR_OK;
}
-static int hw_init(int dmm)
+static int hw_init(struct sr_context *sr_ctx, int dmm)
{
- int ret;
struct drv_context *drvc;
if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
return SR_ERR_MALLOC;
}
- if ((ret = libusb_init(NULL)) < 0) {
- sr_err("Failed to initialize libusb: %s.",
- libusb_error_name(ret));
- return SR_ERR;
- }
-
if (dmm == UNI_T_UT61D)
di = di_ut61d;
else if (dmm == VOLTCRAFT_VC820)
di = di_vc820;
sr_dbg("Selected '%s' subdriver.", di->name);
+ drvc->sr_ctx = sr_ctx;
di->priv = drvc;
return SR_OK;
}
-static int hw_init_ut61d(void)
+static int hw_init_ut61d(struct sr_context *sr_ctx)
{
- return hw_init(UNI_T_UT61D);
+ return hw_init(sr_ctx, UNI_T_UT61D);
}
-static int hw_init_vc820(void)
+static int hw_init_vc820(struct sr_context *sr_ctx)
{
- return hw_init(VOLTCRAFT_VC820);
+ return hw_init(sr_ctx, VOLTCRAFT_VC820);
}
static GSList *hw_scan(GSList *options)
devices = NULL;
- if (!(l = sr_usb_connect(NULL, "1a86.e008")))
+ if (!(l = sr_usb_find(drvc->sr_ctx->libusb_ctx, "1a86.e008")))
return NULL;
for (i = 0; i < (int)g_slist_length(l); i++) {
{
clear_instances();
- // libusb_exit(NULL);
-
return SR_OK;
}
*data = hwcaps;
sr_spew("%s: Returning hwcaps.", __func__);
break;
- case SR_DI_NUM_PROBES:
- *data = GINT_TO_POINTER(1);
- sr_spew("%s: Returning number of probes.", __func__);
- break;
- case SR_DI_PROBE_NAMES:
- *data = probe_names;
- sr_spew("%s: Returning probe names.", __func__);
- break;
case SR_DI_SAMPLERATES:
/* TODO: Get rid of this. */
*data = NULL;