diff options
author | Martin Szulecki | 2020-06-08 02:51:40 +0200 |
---|---|---|
committer | Martin Szulecki | 2020-06-08 02:51:40 +0200 |
commit | 6bbe87b6f6c5ef388839ebf64a7d38fcd91468bf (patch) | |
tree | 9eda07bb8e765a704f5b8c7dd741fa8549490fa2 /src | |
parent | 794e1ec89a61fff4e5ebc9eb522933a5fdbbe676 (diff) | |
download | usbmuxd-6bbe87b6f6c5ef388839ebf64a7d38fcd91468bf.tar.gz usbmuxd-6bbe87b6f6c5ef388839ebf64a7d38fcd91468bf.tar.bz2 |
Use libusb_set_option() to set debug level depending on libusb version
Diffstat (limited to 'src')
-rw-r--r-- | src/usb.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3,7 +3,7 @@ * * Copyright (C) 2009 Hector Martin <hector@marcansoft.com> * Copyright (C) 2009 Nikias Bassen <nikias@gmx.li> - * Copyright (C) 2009 Martin Szulecki <opensuse@sukimashita.com> + * Copyright (C) 2009-2020 Martin Szulecki <martin.szulecki@libimobiledevice.org> * Copyright (C) 2014 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@xamarin.com> * * This program is free software; you can redistribute it and/or modify @@ -801,7 +801,11 @@ int usb_init(void) device_polling = 1; res = libusb_init(NULL); +#if LIBUSB_API_VERSION >= 0x01000106 + libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE))); +#else libusb_set_debug(NULL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE))); +#endif if(res != 0) { usbmuxd_log(LL_FATAL, "libusb_init failed: %s", libusb_error_name(res)); |