diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2025-05-13 12:43:02 +0200 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2025-05-13 12:43:02 +0200 |
| commit | 5578a5da437b3575b3cb0fc49a46a9d0505aa642 (patch) | |
| tree | accc9754d77fa00b50df129da793de0a885d424a | |
| parent | fbd21359f3b325466087c665035f22ff55b36f68 (diff) | |
int -> void use sendToLedgerDeviceCallback only when neededcyjan-better-ledger-v2
7 files changed, 36 insertions, 36 deletions
diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index b907f7c..fdbfbaa 100644 --- a/impls/monero.dart/lib/src/checksum_monero.dart +++ b/impls/monero.dart/lib/src/checksum_monero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names -const String wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116"; -const String wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe"; +const String wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84"; +const String wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe"; const String wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d"; diff --git a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart index 5f5657c..81649b1 100644 --- a/impls/monero.dart/lib/src/generated_bindings_monero.g.dart +++ b/impls/monero.dart/lib/src/generated_bindings_monero.g.dart @@ -4462,7 +4462,7 @@ class MoneroC { void MONERO_Wallet_setLedgerCallback( ffi.Pointer< ffi.NativeFunction< - ffi.Int Function(ffi.Pointer<ffi.UnsignedChar> command, + ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command, ffi.UnsignedInt cmd_len)>> sendToLedgerDevice, ) { @@ -4476,7 +4476,7 @@ class MoneroC { ffi.Void Function( ffi.Pointer< ffi.NativeFunction< - ffi.Int Function( + ffi.Void Function( ffi.Pointer<ffi.UnsignedChar> command, ffi.UnsignedInt cmd_len)>>)>>( 'MONERO_Wallet_setLedgerCallback'); @@ -4485,7 +4485,7 @@ class MoneroC { void Function( ffi.Pointer< ffi.NativeFunction< - ffi.Int Function(ffi.Pointer<ffi.UnsignedChar> command, + ffi.Void Function(ffi.Pointer<ffi.UnsignedChar> command, ffi.UnsignedInt cmd_len)>>)>(); ffi.Pointer<ffi.Void> MONERO_WalletManager_createWallet( diff --git a/impls/monero.ts/checksum_monero.ts b/impls/monero.ts/checksum_monero.ts index 0972f78..7ed01a3 100644 --- a/impls/monero.ts/checksum_monero.ts +++ b/impls/monero.ts/checksum_monero.ts @@ -1,5 +1,5 @@ export const moneroChecksum = { - wallet2_api_c_h_sha256: "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116", - wallet2_api_c_cpp_sha256: "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe", + wallet2_api_c_h_sha256: "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84", + wallet2_api_c_cpp_sha256: "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe", wallet2_api_c_exp_sha256: "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d", } diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h index 4e0fb1c..d3d7414 100644 --- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h +++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h @@ -1,6 +1,6 @@ #ifndef MONEROC_CHECKSUMS #define MONEROC_CHECKSUMS -const char * MONERO_wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116"; -const char * MONERO_wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe"; +const char * MONERO_wallet2_api_c_h_sha256 = "91218f60e937753a606b1db899ee2ed66a1b02144eb2d79b950ce59804397f84"; +const char * MONERO_wallet2_api_c_cpp_sha256 = "282128494f3419c128dff7ed67daadd9c2ad0600d10557e829df03d9bc1ad891-0232839913b13cf0ab0bb7ad25fff0c05f37d2fe"; const char * MONERO_wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d"; #endif diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp index aa08270..fce37c4 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.cpp @@ -2156,7 +2156,7 @@ void MONERO_Wallet_setDeviceSendData(unsigned char* data, size_t len) { DEBUG_END() } -void MONERO_Wallet_setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { +void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { DEBUG_START() Monero::Wallet::setLedgerCallback(sendToLedgerDevice); DEBUG_END() diff --git a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h index f5fc460..580e746 100644 --- a/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h +++ b/monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h @@ -841,7 +841,7 @@ extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceSend(); extern ADDAPI bool MONERO_Wallet_getWaitsForDeviceReceive(); extern ADDAPI void MONERO_Wallet_setDeviceReceivedData(unsigned char* data, size_t len); extern ADDAPI void MONERO_Wallet_setDeviceSendData(unsigned char* data, size_t len); -extern ADDAPI void MONERO_Wallet_setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); +extern ADDAPI void MONERO_Wallet_setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); // }; // struct WalletManager diff --git a/patches/monero/0006-add-dummy-device-for-ledger.patch b/patches/monero/0006-add-dummy-device-for-ledger.patch index 42bfd76..6a332c6 100644 --- a/patches/monero/0006-add-dummy-device-for-ledger.patch +++ b/patches/monero/0006-add-dummy-device-for-ledger.patch @@ -197,7 +197,7 @@ index 000000000..01e6fc7b7 +size_t hw::io::device_io_dummy::receivedFromDeviceLength = 0; +bool hw::io::device_io_dummy::waitsForDeviceSend = false; +bool hw::io::device_io_dummy::waitsForDeviceReceive = false; -+int (*hw::io::device_io_dummy::sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len) = nullptr; ++void (*hw::io::device_io_dummy::sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len) = nullptr; +std::mutex hw::io::device_io_dummy::mutex; +std::condition_variable hw::io::device_io_dummy::cv_send; +std::condition_variable hw::io::device_io_dummy::cv_receive; @@ -249,25 +249,25 @@ index 000000000..01e6fc7b7 + if (sendToLedgerDeviceCallback != nullptr) { + MDEBUG("exchange(): calling sendToLedgerDeviceCallback"); + sendToLedgerDeviceCallback(command, cmd_len); -+ } -+ -+ MDEBUG("exchange(): waitsForDeviceSend"); -+ // Wait for the send flag to be cleared by external code -+ while (waitsForDeviceSend) { -+ cv_send.wait(lock); -+ MDEBUG("exchange(): waitsForDeviceSend notified"); -+ } -+ -+ MDEBUG("exchange(): waitsForDeviceReceive"); -+ // Wait for the receive flag to be cleared by external code -+ while (waitsForDeviceReceive) { -+ cv_receive.wait(lock); -+ MDEBUG("exchange(): waitsForDeviceReceive notified"); -+ } -+ -+ if (receivedFromDeviceLength > max_resp_len) { -+ MDEBUG("exchange(): receivedFromDeviceLength ("<<receivedFromDeviceLength<<") is larger than max_resp_len ("<<max_resp_len<<")"); -+ return 1; ++ } else { ++ MDEBUG("exchange(): waitsForDeviceSend"); ++ // Wait for the send flag to be cleared by external code ++ while (waitsForDeviceSend) { ++ cv_send.wait(lock); ++ MDEBUG("exchange(): waitsForDeviceSend notified"); ++ } ++ ++ MDEBUG("exchange(): waitsForDeviceReceive"); ++ // Wait for the receive flag to be cleared by external code ++ while (waitsForDeviceReceive) { ++ cv_receive.wait(lock); ++ MDEBUG("exchange(): waitsForDeviceReceive notified"); ++ } ++ ++ if (receivedFromDeviceLength > max_resp_len) { ++ MDEBUG("exchange(): receivedFromDeviceLength ("<<receivedFromDeviceLength<<") is larger than max_resp_len ("<<max_resp_len<<")"); ++ return 1; ++ } + } + + memset(response, 0, max_resp_len); @@ -283,7 +283,7 @@ index 000000000..01e6fc7b7 + MDEBUG("release()"); + } + -+ void device_io_dummy::setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { ++ void device_io_dummy::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { + MDEBUG("setLedgerCallback()"); + sendToLedgerDeviceCallback = sendToLedgerDevice; + } @@ -370,7 +370,7 @@ index 000000000..1128b9c1d + static size_t receivedFromDeviceLength; + static bool waitsForDeviceSend; + static bool waitsForDeviceReceive; -+ static int (*sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len); ++ static void (*sendToLedgerDeviceCallback)(unsigned char *command, unsigned int cmd_len); + + device_io_dummy() = default; + device_io_dummy(int a, int b, int c, int d); @@ -386,7 +386,7 @@ index 000000000..1128b9c1d + + int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len, bool user_input); + -+ static void setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); ++ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); + static void setDeviceReceivedData(unsigned char* data, size_t len); + }; + }; @@ -564,7 +564,7 @@ index 3fcd6f332..844a1c451 100644 + #endif +} + -+void Wallet::setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { ++void Wallet::setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)) { + #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI)) + MERROR("MONERO compiled with #if !(defined(HIDAPI_DUMMY) && !defined(HAVE_HIDAPI))"); + return; @@ -619,7 +619,7 @@ index 764adbfbf..a48a6be54 100644 + + static void setDeviceReceivedData(unsigned char* data, size_t len); + static void setDeviceSendData(unsigned char* data, size_t len); -+ static void setLedgerCallback(int (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); ++ static void setLedgerCallback(void (*sendToLedgerDevice)(unsigned char *command, unsigned int cmd_len)); }; /** |
