BridgeManager: use SetUsbLogLevel for setting usb log level

This commit is contained in:
Henrik Grimler 2022-01-01 21:29:49 +01:00
parent 1e7ff3b659
commit 172ab65cbe
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
1 changed files with 3 additions and 45 deletions

View File

@ -408,29 +408,8 @@ bool BridgeManager::DetectDevice(void)
return (false);
}
// Setup libusb log level.
switch (usbLogLevel)
{
case UsbLogLevel::None:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_NONE);
break;
case UsbLogLevel::Error:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_ERROR);
break;
case UsbLogLevel::Warning:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_WARNING);
break;
case UsbLogLevel::Info:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO);
break;
case UsbLogLevel::Debug:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);
break;
}
// Set libusb log level.
SetUsbLogLevel(usbLogLevel);
// Get handle to Galaxy S device
struct libusb_device **devices;
@ -474,28 +453,7 @@ int BridgeManager::Initialise(bool resume)
}
// Setup libusb log level.
switch (usbLogLevel)
{
case UsbLogLevel::None:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_NONE);
break;
case UsbLogLevel::Error:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_ERROR);
break;
case UsbLogLevel::Warning:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_WARNING);
break;
case UsbLogLevel::Info:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO);
break;
case UsbLogLevel::Debug:
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);
break;
}
SetUsbLogLevel(usbLogLevel);
result = FindDeviceInterface();