From f9d1a634da5e6e095d9c7feeecd2e194e5198636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= Date: Fri, 6 Dec 2019 10:02:03 +0100 Subject: [PATCH] Fix libusb_set_debug deprecated warnings The function libusb_set_debug() is deprecated, use libusb_set_option() instead using the LIBUSB_OPTION_LOG_LEVEL option. - Details: http://libusb.sourceforge.net/api-1.0/group__libusb__lib.html - Fixes the following warnings: pcsensor.c:200:9: warning: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations] libusb_set_debug(ctx, 4); //LIBUSB_LOG_LEVEL_DEBUG pcsensor.c:202:9: warning: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations] libusb_set_debug(ctx, 0); //LIBUSB_LOG_LEVEL_NONE --- pcsensor.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pcsensor.c b/pcsensor.c index 1dc82a9..15a5706 100644 --- a/pcsensor.c +++ b/pcsensor.c @@ -192,15 +192,19 @@ int find_lvr_winusb(temper_device_t *devices) { int setup_libusb_access(temper_device_t *devices) { int i; + int log_level = 0; // LIBUSB_LOG_LEVEL_NONE int numdev; libusb_init(&ctx); if(debug) { - libusb_set_debug(ctx, 4); //LIBUSB_LOG_LEVEL_DEBUG - } else { - libusb_set_debug(ctx, 0); //LIBUSB_LOG_LEVEL_NONE + log_level = 4; // LIBUSB_LOG_LEVEL_DEBUG } +#if LIBUSBX_API_VERSION < 0x01000106 + libusb_set_debug(ctx, log_level); +#else + libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, log_level); +#endif if((numdev = find_lvr_winusb(devices)) < 1) { fprintf(stderr, "Couldn't find the USB device, Exiting: %d\n", numdev);