summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2019-11-28 18:34:02 +0000
committerRichard Hughes <richard@hughsie.com>2019-11-28 18:52:06 +0000
commit2bb1f5583c41563132944b40aa2ac9dd113c6667 (patch)
tree0f246d1bb34c3f3c90922a00c9cc8f25ce27d6ed
parent4e8075ff084a24873df759b3c7daf363d1780f66 (diff)
downloadgusb-2bb1f5583c41563132944b40aa2ac9dd113c6667.tar.gz
Do not use deprecated libusb API
-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,