diff options
author | Richard Hughes <richard@hughsie.com> | 2019-11-28 18:34:02 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2019-12-03 16:16:17 +0000 |
commit | 46724c359f293faab893986870907194c16ec68e (patch) | |
tree | 0f246d1bb34c3f3c90922a00c9cc8f25ce27d6ed | |
parent | 2d6aa6b6cb9eda1f6fb53e67bd246679f9993a51 (diff) | |
download | gusb-46724c359f293faab893986870907194c16ec68e.tar.gz |
Do not use deprecated libusb API
-rw-r--r-- | gusb/gusb-context.c | 8 | ||||
-rw-r--r-- | meson.build | 3 |
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, |