This allows hardware drivers to use a common libusb_context.
goto done;
}
+#ifdef HAVE_LIBUSB_1_0
+ ret = libusb_init(&context->libusb_ctx);
+ if (LIBUSB_SUCCESS != ret) {
+ sr_err("libusb_init() returned %s\n", libusb_error_name(ret));
+ goto done;
+ }
+#endif
+
*ctx = context;
ret = SR_OK;
{
sr_hw_cleanup_all();
+#ifdef HAVE_LIBUSB_1_0
+ libusb_exit(ctx->libusb_ctx);
+#endif
+
g_free(ctx);
return SR_OK;
#define DATASTORE_CHUNKSIZE (512 * 1024)
struct sr_context {
+#ifdef HAVE_LIBUSB_1_0
+ libusb_context *libusb_ctx;
+#endif
};
#ifdef HAVE_LIBUSB_1_0