diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index ee982fe..30725f8 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -69,6 +69,9 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Find programs on host set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Find libs in target set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target +add_definitions(-DHIDAPI_DUMMY=ON) +set(HIDAPI_DUMMY ON) + # specify the cross compiler to be used. Darwin uses clang provided by the SDK. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(ARCHITECTURE STREQUAL "aarch64") @@ -97,15 +100,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(BUILD_64 ON) SET(BREW OFF) SET(PORT OFF) - SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/") SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.14") SET(CMAKE_CXX_STANDARD 14) SET(LLVM_ENABLE_PIC OFF) SET(LLVM_ENABLE_PIE OFF) elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") add_definitions(-DUSE_DEVICE_TREZOR=OFF) - add_definitions(-DHIDAPI_DUMMY=ON) - set(HIDAPI_DUMMY ON) SET(ANDROID TRUE) if(ARCHITECTURE STREQUAL "armv7a") SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a") @@ -132,8 +132,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") SET(CMAKE_CXX_COMPILER @CXX@) elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(USE_DEVICE_TREZOR OFF) - add_definitions(-DHIDAPI_DUMMY=ON) - set(HIDAPI_DUMMY ON) add_definitions(-DUSE_DEVICE_LEDGER=ON) SET(CMAKE_C_COMPILER @CC@) SET(CMAKE_CXX_COMPILER @CXX@) diff --git a/patches/monero/0006-add-dummy-device-for-ledger.patch b/patches/monero/0006-add-dummy-device-for-ledger.patch index cb7266d..30261a4 100644 --- a/patches/monero/0006-add-dummy-device-for-ledger.patch +++ b/patches/monero/0006-add-dummy-device-for-ledger.patch @@ -22,23 +22,38 @@ Subject: [PATCH 06/17] add dummy device for ledger create mode 100644 src/device/device_io_dummy.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt -index c73b813d8..5c0f31cb8 100644 +index c73b813d8..ce5ef4bab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -692,8 +692,12 @@ include_directories(${LMDB_INCLUDE}) +@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE}) include_directories(${LIBUNWIND_INCLUDE}) link_directories(${LIBUNWIND_LIBRARY_DIRS}) +-# Final setup for hid +-if (HIDAPI_FOUND) +- message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") +- add_definitions(-DHAVE_HIDAPI) +- include_directories(${HIDAPI_INCLUDE_DIR}) +- link_directories(${LIBHIDAPI_LIBRARY_DIRS}) +if (HIDAPI_DUMMY) + add_definitions(-DHIDAPI_DUMMY) -+endif() + else() +- message(STATUS "Could not find HIDAPI") ++ # Final setup for hid ++ if (HIDAPI_FOUND) ++ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") ++ add_definitions(-DHAVE_HIDAPI) ++ include_directories(${HIDAPI_INCLUDE_DIR}) ++ link_directories(${LIBHIDAPI_LIBRARY_DIRS}) ++ else() ++ message(STATUS "Could not find HIDAPI") ++ endif() + endif() + + - # Final setup for hid --if (HIDAPI_FOUND) -+if (HIDAPI_FOUND) - message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") - add_definitions(-DHAVE_HIDAPI) - include_directories(${HIDAPI_INCLUDE_DIR}) + # Trezor support check + include(CheckTrezor) + diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt index e4f1159b5..14d398f87 100644 --- a/src/device/CMakeLists.txt diff --git a/patches/wownero/0008-add-dummy-device-for-ledger.patch b/patches/wownero/0008-add-dummy-device-for-ledger.patch index 3c7a08f..47b0cc7 100644 --- a/patches/wownero/0008-add-dummy-device-for-ledger.patch +++ b/patches/wownero/0008-add-dummy-device-for-ledger.patch @@ -21,23 +21,38 @@ Subject: [PATCH 08/15] add dummy device for ledger create mode 100644 src/device/device_io_dummy.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt -index 88335ee9d..86000f811 100644 +index c73b813d8..ce5ef4bab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -693,8 +693,12 @@ include_directories(${LMDB_INCLUDE}) +@@ -692,16 +692,21 @@ include_directories(${LMDB_INCLUDE}) include_directories(${LIBUNWIND_INCLUDE}) link_directories(${LIBUNWIND_LIBRARY_DIRS}) +-# Final setup for hid +-if (HIDAPI_FOUND) +- message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") +- add_definitions(-DHAVE_HIDAPI) +- include_directories(${HIDAPI_INCLUDE_DIR}) +- link_directories(${LIBHIDAPI_LIBRARY_DIRS}) +if (HIDAPI_DUMMY) + add_definitions(-DHIDAPI_DUMMY) -+endif() + else() +- message(STATUS "Could not find HIDAPI") ++ # Final setup for hid ++ if (HIDAPI_FOUND) ++ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") ++ add_definitions(-DHAVE_HIDAPI) ++ include_directories(${HIDAPI_INCLUDE_DIR}) ++ link_directories(${LIBHIDAPI_LIBRARY_DIRS}) ++ else() ++ message(STATUS "Could not find HIDAPI") ++ endif() + endif() + + - # Final setup for hid --if (HIDAPI_FOUND) -+if (HIDAPI_FOUND) - message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") - add_definitions(-DHAVE_HIDAPI) - include_directories(${HIDAPI_INCLUDE_DIR}) + # Trezor support check + include(CheckTrezor) + diff --git a/src/device/CMakeLists.txt b/src/device/CMakeLists.txt index e4f1159b5..14d398f87 100644 --- a/src/device/CMakeLists.txt @@ -235,13 +250,13 @@ index 000000000..edb4beea3 + MDEBUG("exchange(): waitsForDeviceSend"); + // NOTE: waitsForDeviceSend should be changed by external code + while (waitsForDeviceSend) { -+ usleep(1000); ++ std::this_thread::sleep_for(std::chrono::microseconds(1000)); + MDEBUG("exchange(): waitsForDeviceSend (still)"); + } + + MDEBUG("exchange(): waitsForDeviceReceive"); + while (waitsForDeviceReceive) { -+ usleep(1000); ++ std::this_thread::sleep_for(std::chrono::microseconds(1000)); + MDEBUG("exchange(): waitsForDeviceReceive (still)"); + } +