From 5578a5da437b3575b3cb0fc49a46a9d0505aa642 Mon Sep 17 00:00:00 2001 From: Czarek Nakamoto Date: Tue, 13 May 2025 12:43:02 +0200 Subject: int -> void use sendToLedgerDeviceCallback only when needed --- .../monero/0006-add-dummy-device-for-ledger.patch | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'patches') 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 ("< max_resp_len) { ++ MDEBUG("exchange(): receivedFromDeviceLength ("<