Merge pull request #3629 from tweathers-sec/fix-bwm-data-available

Fix: poll the BWM link in data_available(), so a Proxmark5 on BLE/WiFi can be aborted
This commit is contained in:
Iceman authored and GitHub committed 2026-09-16 00:24:24 +07:00
commit da3400ff04
2 files changed
+12 -2

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Fixed `PLATFORM_EXTRAS=BWM` - a command started over the Proxmark5 wireless module can be aborted again, `data_available()` only polled USB so CMD_BREAK_LOOP was never seen on the BLE or WiFi link (@tweathers-sec)
- Fixed `lf search` - a leftover debug print no longer reports `DEBUG: detectindala | <n>` on every failed Indala demodulation (@tweathers-sec)
- Changed `memcpy` - the device's own implementation now copies a word at a time when source and destination allow it (@iceman1001)
- Changed NG replies - the outgoing frame is offset so its payload lands word aligned, taking USB transfer speed from 630 to 789 kB/s on RDV4 (@iceman1001)
+11 -2
View File
@@ -25,6 +25,9 @@
#include "string.h"
#include "usb_cdc_apis.h"
#include "usart.h"
#ifdef WITH_BWM_FORWARD
#include "bwm_forward.h"
#endif
#include "BigBuf.h" // trace_restart_timeline
#ifdef WITH_SMARTCARD
#include "i2c.h" // sc_log_trace_reset
@@ -327,7 +330,11 @@ int BUTTON_HELD(int ms) {
// This function returns false if no data is available or
// the USB connection is invalid.
bool data_available(void) {
#ifdef WITH_FPC_USART_HOST
#if defined(WITH_BWM_FORWARD)
// The BWM (BLE / WiFi) link is the host connection on a Proxmark5, so it
// has to be polled here too or CMD_BREAK_LOOP is never seen over it.
return usb_poll_validate_length() || (bwm_fwd_rxdata_available() > 0);
#elif defined(WITH_FPC_USART_HOST)
return usb_poll_validate_length() || (usart_rxdata_available() > 0);
#else
return usb_poll_validate_length();
@@ -338,7 +345,9 @@ bool data_available(void) {
// In most of the cases, you should use data_available() unless
// the timing is critical.
bool data_available_fast(void) {
#ifdef WITH_FPC_USART_HOST
#if defined(WITH_BWM_FORWARD)
return usb_available_length() || (bwm_fwd_rxdata_available() > 0);
#elif defined(WITH_FPC_USART_HOST)
return usb_available_length() || (usart_rxdata_available() > 0);
#else
return usb_available_length();