summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gusb/gusb-context.c8
-rw-r--r--meson.build3
2 files changed, 11 insertions, 0 deletions
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,