From 39e2117114250b3ea04b931c40aa48052d6674df Mon Sep 17 00:00:00 2001 From: Niel Nielsen Date: Thu, 3 Sep 2026 09:43:05 +0200 Subject: [PATCH] Improve error handling in bwm_wifi.c Handle error reporting for failed commands and update reboot command handling. Signed-off-by: Niel Nielsen --- armsrc/bwm_wifi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/armsrc/bwm_wifi.c b/armsrc/bwm_wifi.c index 66499ab89..af597f705 100644 --- a/armsrc/bwm_wifi.c +++ b/armsrc/bwm_wifi.c @@ -139,6 +139,12 @@ int bwm_cmd(uint16_t cmd, const uint8_t *req, uint16_t req_len, if (!is_resp && rcmd == BWM_CMD_CMD_ERROR && rlen >= 2) { uint16_t failed_cmd = (uint16_t)pbuf[0] | ((uint16_t)pbuf[1] << 8); if (failed_cmd == cmd) { + int32_t esp_err = 0; + if (rlen >= 6) { + esp_err = (int32_t)((uint32_t)pbuf[2] | ((uint32_t)pbuf[3] << 8) | + ((uint32_t)pbuf[4] << 16) | ((uint32_t)pbuf[5] << 24)); + } + Dbprintf("[bwm-wifi] cmd 0x%04x failed, esp_err=0x%08x", (unsigned)cmd, (unsigned)esp_err); return PM3_EFAILED; } // unrelated command's error - ignore, keep waiting