From cac9e2d4cc9408f67d3e45cb14428ed4fcff9741 Mon Sep 17 00:00:00 2001 From: Niel Nielsen Date: Thu, 3 Sep 2026 10:59:52 +0200 Subject: [PATCH] Implement OTA abort handling in cmdhw.c Added logic to restore fast link and log OTA abort action on firmware update failure. Signed-off-by: Niel Nielsen --- client/src/cmdhw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index 85682ec7d..a31a20589 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -2401,6 +2401,12 @@ static int CmdBWMUpgrade(const char *Cmd) { free(fw); if (res != PM3_SUCCESS) { + // Restore the fast link + logs that the OTA lowered at BEGIN. + PacketResponseNG resp; + uint8_t ab[1] = { BWM_OTA_ACTION_ABORT }; + clearCommandBuffer(); + SendCommandNG(CMD_PM5_BWM_ESP_OTA, ab, sizeof(ab)); + (void)WaitForResponseTimeout(CMD_PM5_BWM_ESP_OTA, &resp, 8000); PrintAndLogEx(FAILED, "BWM firmware update failed after %d attempts", max_attempts); return res; }