From fa35b3cc2e1cc378779709378f7e5abfe6bcb332 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Tue, 1 Aug 2023 11:52:25 -0400 Subject: [PATCH] Add option force use OldUSB to compatiable with ubuntun18.04 Signed-off-by: Frank Li --- libuuu/CMakeLists.txt | 8 ++++++-- libuuu/error.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libuuu/CMakeLists.txt b/libuuu/CMakeLists.txt index 8dcb0f63..cccb7f59 100644 --- a/libuuu/CMakeLists.txt +++ b/libuuu/CMakeLists.txt @@ -24,8 +24,12 @@ endif() include_directories(${LIBUSB_INCLUDE_DIRS} ${LIBZSTD_INCLUDE_DIRS} ${UUUOPENSLL_INCLUDE_DIR} include) -set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wstrict-aliasing -Wextra ${UUUSSL}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ${UUUSSL}") +if (FORCE_OLD) +set(FORCE_OLDLIBUSB "-DFORCE_OLDLIBUSB") +endif() + +set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wstrict-aliasing -Wextra ${UUUSSL} ${FORCE_OLDLIBUSB}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ${UUUSSL} ${FORCE_OLDLIBUSB}") set(SOURCES error.cpp diff --git a/libuuu/error.cpp b/libuuu/error.cpp index 4ea6fed9..6d8b567a 100644 --- a/libuuu/error.cpp +++ b/libuuu/error.cpp @@ -53,7 +53,7 @@ void uuu_set_debug_level(uint32_t mask) { g_debug_level = mask; -#if LIBUSB_API_VERSION > 0x01000106 +#if LIBUSB_API_VERSION > 0x01000106 && !defined(FORCE_OLDLIBUSB) libusb_set_option(nullptr, LIBUSB_OPTION_LOG_LEVEL, get_libusb_debug_level()); #else libusb_set_debug(nullptr, get_libusb_debug_level());