summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-08 02:51:40 +0200
committerGravatar Martin Szulecki2020-06-08 02:51:40 +0200
commit6bbe87b6f6c5ef388839ebf64a7d38fcd91468bf (patch)
tree9eda07bb8e765a704f5b8c7dd741fa8549490fa2 /src
parent794e1ec89a61fff4e5ebc9eb522933a5fdbbe676 (diff)
downloadusbmuxd-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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/usb.c b/src/usb.c
index 845ac62..de09256 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009 Hector Martin <hector@marcansoft.com> 4 * Copyright (C) 2009 Hector Martin <hector@marcansoft.com>
5 * Copyright (C) 2009 Nikias Bassen <nikias@gmx.li> 5 * Copyright (C) 2009 Nikias Bassen <nikias@gmx.li>
6 * Copyright (C) 2009 Martin Szulecki <opensuse@sukimashita.com> 6 * Copyright (C) 2009-2020 Martin Szulecki <martin.szulecki@libimobiledevice.org>
7 * Copyright (C) 2014 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@xamarin.com> 7 * Copyright (C) 2014 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@xamarin.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -801,7 +801,11 @@ int usb_init(void)
801 device_polling = 1; 801 device_polling = 1;
802 res = libusb_init(NULL); 802 res = libusb_init(NULL);
803 803
804#if LIBUSB_API_VERSION >= 0x01000106
805 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)));
806#else
804 libusb_set_debug(NULL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE))); 807 libusb_set_debug(NULL, (log_level >= LL_DEBUG ? LIBUSB_LOG_LEVEL_DEBUG: (log_level >= LL_WARNING ? LIBUSB_LOG_LEVEL_WARNING: LIBUSB_LOG_LEVEL_NONE)));
808#endif
805 809
806 if(res != 0) { 810 if(res != 0) {
807 usbmuxd_log(LL_FATAL, "libusb_init failed: %s", libusb_error_name(res)); 811 usbmuxd_log(LL_FATAL, "libusb_init failed: %s", libusb_error_name(res));