From 2bb1f5583c41563132944b40aa2ac9dd113c6667 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 28 Nov 2019 18:34:02 +0000 Subject: Do not use deprecated libusb API --- gusb/gusb-context.c | 8 ++++++++ meson.build | 3 +++ 2 files changed, 11 insertions(+) diff --git a/gusb/gusb-context.c b/gusb/gusb-context.c index 09a74d5..dd7fb0c 100644 --- a/gusb/gusb-context.c +++ b/gusb/gusb-context.c @@ -167,7 +167,11 @@ g_usb_context_set_property (GObject *object, switch (prop_id) { case PROP_DEBUG_LEVEL: priv->debug_level = g_value_get_int (value); +#ifdef HAVE_LIBUSB_1_0_22 + libusb_set_option (priv->ctx, LIBUSB_OPTION_LOG_LEVEL, priv->debug_level); +#else libusb_set_debug (priv->ctx, priv->debug_level); +#endif break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -718,7 +722,11 @@ g_usb_context_set_debug (GUsbContext *context, if (debug_level != priv->debug_level) { priv->debug_level = debug_level; +#ifdef HAVE_LIBUSB_1_0_22 + libusb_set_option (priv->ctx, LIBUSB_OPTION_LOG_LEVEL, debug_level); +#else libusb_set_debug (priv->ctx, debug_level); +#endif g_object_notify_by_pspec (G_OBJECT (context), pspecs[PROP_DEBUG_LEVEL]); } diff --git a/meson.build b/meson.build index a9e2ba9..7e3d657 100644 --- a/meson.build +++ b/meson.build @@ -95,6 +95,9 @@ add_project_link_arguments( libgio = dependency('gio-2.0', version : '>= 2.44.0') libusb = dependency('libusb-1.0', version : '>= 1.0.19') +if libusb.version().version_compare ('>= 1.0.22') + conf.set('HAVE_LIBUSB_1_0_22', '1') +endif gusb_deps = [ libgio, -- cgit v1.2.1