From 6762b812d5c9d764948f1ec0de8f0b98689b8929 Mon Sep 17 00:00:00 2001 From: Adrian <4030444+adrian-stepien@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:06:02 +0000 Subject: [PATCH] Avoid hanging the bootrom after a memory dump Bootloader memory-dump cleanup sends CMD_PING to wake the communication thread after clearing its run flag. The thread can be waiting for another transmit after the dump ACK, so it sends this command before exiting. The non-BWM bootrom does not handle CMD_PING: its default dispatch enters Fatal(), leaving the device unresponsive even though the dump succeeded. Use CMD_DEVICE_INFO for the wakeup instead. It is already supported by the bootloader and used to identify it before the dump. Keep the wakeup so closing the client does not leave the communication thread waiting. Reproduced on PM5: the dump completed, but the following reset and device probe failed. With only the rebuilt client changed, the same test script passed five OS-to-bootloader, memory-dump and reset-to-OS cycles, with a successful ping after each. No firmware was flashed for this comparison. Built the client with AppleClang through Make, CMake and experimental_lib; client/check passed. GCC 16 compiled the changed translation unit with -Wall -Werror. Existing macOS linker warnings remain. The full GCC host build was not repeated because of the previously observed Apple SDK alignment error. Linux and Windows were not tested; this change replaces an existing protocol command without changing platform-specific code. --- client/src/proxmark3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 7e76b948d..7655800e0 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -964,7 +964,8 @@ finish2: clearCommandBuffer(); if (in_bootloader) { g_session.current_device->g_conn->run = false; - SendCommandBL(CMD_PING, 0, 0, 0, NULL, 0); + // Wake the comm thread with a command supported by the bootrom. + SendCommandBL(CMD_DEVICE_INFO, 0, 0, 0, NULL, 0); } else { SendCommandNG(CMD_QUIT_SESSION, NULL, 0); msleep(100);