Fix ledger issue (#114)

* Fix ledger issue (https://github.com/cake-tech/cake_wallet/issues/2007)

* cleanup debug message
This commit is contained in:
cyan
2025-02-11 16:11:45 +01:00
committed by GitHub
parent 09c6d2e5f8
commit 9d9b1f2f23
3 changed files with 7 additions and 4 deletions

View File

@@ -105,6 +105,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DUSE_DEVICE_TREZOR=OFF) add_definitions(-DUSE_DEVICE_TREZOR=OFF)
add_definitions(-DHIDAPI_DUMMY=ON) add_definitions(-DHIDAPI_DUMMY=ON)
set(HIDAPI_DUMMY ON)
SET(ANDROID TRUE) SET(ANDROID TRUE)
if(ARCHITECTURE STREQUAL "armv7a") if(ARCHITECTURE STREQUAL "armv7a")
SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a") SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a")
@@ -132,6 +133,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS") elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(USE_DEVICE_TREZOR OFF) set(USE_DEVICE_TREZOR OFF)
add_definitions(-DHIDAPI_DUMMY=ON) add_definitions(-DHIDAPI_DUMMY=ON)
set(HIDAPI_DUMMY ON)
add_definitions(-DUSE_DEVICE_LEDGER=ON)
SET(CMAKE_C_COMPILER @CC@) SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_CXX_COMPILER @CXX@) SET(CMAKE_CXX_COMPILER @CXX@)
else() else()

View File

@@ -86,7 +86,7 @@ index e6cd358..777584c 100644
device_registry::device_registry(){ device_registry::device_registry(){
hw::core::register_all(registry); hw::core::register_all(registry);
- #ifdef WITH_DEVICE_LEDGER - #ifdef WITH_DEVICE_LEDGER
+ #if defined(WITH_DEVICE_LEDGER) && !defined(HIDAPI_DUMMY) + #if defined(WITH_DEVICE_LEDGER) || defined(HIDAPI_DUMMY)
hw::ledger::register_all(registry); hw::ledger::register_all(registry);
#endif #endif
atexit(clear_device_registry); atexit(clear_device_registry);
@@ -102,7 +102,7 @@ index e6cd358..777584c 100644
MERROR(" - " << sm_pair.first); MERROR(" - " << sm_pair.first);
} }
- throw std::runtime_error("device not found: " + device_descriptor); - throw std::runtime_error("device not found: " + device_descriptor);
+ throw std::runtime_error("device not found: " + device_descriptor + "\nlalala\n" + ss.str()); + throw std::runtime_error("device not found: " + device_descriptor + "\n" + ss.str());
} }
return *device->second; return *device->second;
} }

View File

@@ -86,7 +86,7 @@ index e6cd358b6..777584c01 100644
device_registry::device_registry(){ device_registry::device_registry(){
hw::core::register_all(registry); hw::core::register_all(registry);
- #ifdef WITH_DEVICE_LEDGER - #ifdef WITH_DEVICE_LEDGER
+ #if defined(WITH_DEVICE_LEDGER) && !defined(HIDAPI_DUMMY) + #if defined(WITH_DEVICE_LEDGER) || defined(HIDAPI_DUMMY)
hw::ledger::register_all(registry); hw::ledger::register_all(registry);
#endif #endif
atexit(clear_device_registry); atexit(clear_device_registry);
@@ -102,7 +102,7 @@ index e6cd358b6..777584c01 100644
MERROR(" - " << sm_pair.first); MERROR(" - " << sm_pair.first);
} }
- throw std::runtime_error("device not found: " + device_descriptor); - throw std::runtime_error("device not found: " + device_descriptor);
+ throw std::runtime_error("device not found: " + device_descriptor + "\nlalala\n" + ss.str()); + throw std::runtime_error("device not found: " + device_descriptor + "\n" + ss.str());
} }
return *device->second; return *device->second;
} }