Skip to content

Commit

Permalink
Update to libusb 1.0.22 and fix deprecated libusb_set_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
rwinzhang committed Aug 25, 2018
1 parent 409ea58 commit 2af7395
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cmake/Findlibusb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ find_library(LIBUSB_LIBRARY
PATHS
/usr/local/lib
/opt/local/lib
/usr/local/Cellar/libusb/1.0.21
/usr/local/Cellar/libusb/1.0.22
/usr/lib
)

Expand Down
30 changes: 15 additions & 15 deletions heimdall/source/BridgeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,23 +399,23 @@ bool BridgeManager::DetectDevice(void)
switch (usbLogLevel)
{
case UsbLogLevel::None:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 0);
break;

case UsbLogLevel::Error:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 1);
break;

case UsbLogLevel::Warning:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 2);
break;

case UsbLogLevel::Info:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 3);
break;

case UsbLogLevel::Debug:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 4);
break;
}

Expand Down Expand Up @@ -464,23 +464,23 @@ int BridgeManager::Initialise(bool resume)
switch (usbLogLevel)
{
case UsbLogLevel::None:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 0);
break;

case UsbLogLevel::Error:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 1);
break;

case UsbLogLevel::Warning:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 2);
break;

case UsbLogLevel::Info:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 3);
break;

case UsbLogLevel::Debug:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 4);
break;
}

Expand Down Expand Up @@ -1244,23 +1244,23 @@ void BridgeManager::SetUsbLogLevel(UsbLogLevel usbLogLevel)
switch (usbLogLevel)
{
case UsbLogLevel::None:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_NONE);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 0);
break;

case UsbLogLevel::Error:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_ERROR);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 1);
break;

case UsbLogLevel::Warning:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_WARNING);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 2);
break;

case UsbLogLevel::Info:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_INFO);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 3);
break;

case UsbLogLevel::Debug:
libusb_set_debug(libusbContext, LIBUSB_LOG_LEVEL_DEBUG);
libusb_set_option(libusbContext, LIBUSB_OPTION_LOG_LEVEL, 4);
break;
}
}
Expand Down

0 comments on commit 2af7395

Please sign in to comment.