summaryrefslogtreecommitdiff
path: root/gusb/gusb-context.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2019-11-28 18:34:02 +0000
committerRichard Hughes <richard@hughsie.com>2019-12-03 16:16:17 +0000
commit46724c359f293faab893986870907194c16ec68e (patch)
tree0f246d1bb34c3f3c90922a00c9cc8f25ce27d6ed /gusb/gusb-context.c
parent2d6aa6b6cb9eda1f6fb53e67bd246679f9993a51 (diff)
downloadgusb-46724c359f293faab893986870907194c16ec68e.tar.gz
Do not use deprecated libusb API
Diffstat (limited to 'gusb/gusb-context.c')
-rw-r--r--gusb/gusb-context.c8
1 files changed, 8 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]);
}