Commit Graph

38541 Commits

Author SHA1 Message Date
Zhou Xiao fcb4e4f77d feat(ble_log): define multi-buffer transport types and Kconfig
Replace ping-pong (2-buffer) transport constants with configurable
multi-buffer (4-buffer) types. Add buffer utilization reporting types,
unified queue depth derivation macros, and compile-time guards.

Rename Kconfig options to total-per-LBM semantics:
- BLE_LOG_LBM_TRANS_SIZE (512) -> BLE_LOG_LBM_TRANS_BUF_SIZE (2048)
- BLE_LOG_LBM_LL_TRANS_SIZE (1024) -> BLE_LOG_LBM_LL_TRANS_BUF_SIZE (2048)

Key type changes:
- ble_log_prph_trans_t: volatile bool -> plain bool (atomic ops used),
  add void *owner back-reference
- ble_log_lbm_t: trans array sized to BLE_LOG_TRANS_BUF_CNT (4),
  add trans_inflight and trans_inflight_peak counters
- BLE_LOG_TRANS_BUF_CNT replaces BLE_LOG_TRANS_PING_PONG_BUF_CNT
- New ble_log_buf_util_t for buffer utilization telemetry
- _Static_assert guards for divisibility, power-of-2, index limits
2026-04-07 11:49:43 +08:00
Zhou Xiao adcf6cb75f feat(ble_log_console): add CLI entry point, build scripts, and docs
- Click-based CLI entry point (console.py) with --port, --baudrate,
  --log-dir options and interactive Launch Screen when --port omitted
- Deprecation warning for --output CLI flag
- 'ls' subcommand to list saved capture files
- PyInstaller build scripts (build.sh, build.bat, build_exe.py)
- Convenience run scripts (run.sh, run.bat)
- README rewrite with installation, usage, architecture docs, and
  troubleshooting guide
- User guides in English and Chinese
- Remove old single-file ble_log_console.py
- Register new scripts in executable-list.txt
2026-04-07 11:49:31 +08:00
Zhou Xiao e40fd6753d feat(ble_log_console): add Textual frontend and app wiring
TUI frontend built on Textual with thread-safe backend integration:

- Launch screen with port/baud/log-dir selection and auto-refresh
- Log view with scrollable RichLog and color-coded write methods;
  Rich markup escaped to prevent crash on bracket characters
- Stats screen split into two tables by time base:
  - Firmware Counters (since chip init): Written and Buffer Loss
  - Console Measurements (since console start): Average Throughput
    and Peak Write — each with separate frames and bytes sub-columns
  - Column widths constrained with min_width/max_width for stable layout
  - Division-by-zero guard when peak window is zero
- Shortcut screen overlay
- Status panel with sync state, checksum mode, and transport metrics;
  speed display uses named UART_BITS_PER_BYTE constant
- Main app wiring: UART reader thread with threading.Lock for serial
  access, frame parser pipeline, stats emission via StatsUpdated
  messages (including funnel snapshots via public accessor for
  thread-safe delivery), BackendStopped message for disconnect
- BackendStopped posted on open_serial failure (prevents stuck status)
- Select.BLANK guard for baud rate in launch screen
- Explicit None guards replace asserts in backend worker
- Wall-clock burst tracking for REDIR frames (no chip-side timestamp)
- SN gap alerts (FrameLossDetected) and traffic spike notifications
2026-04-07 11:44:55 +08:00
Zhou Xiao cbbc495825 feat(ble_log_console): add backend with frame parser, stats, and data models
Modular backend for the BLE log console rewrite:

- Frame parser with sync state machine and checksum auto-detection
  (4 modes: XOR/Sum x Full/Header-only); handles incomplete frames
  during re-sync search when previously synced
- Internal frame decoder (INIT_DONE, ENH_STAT, FLUSH, INFO)
- Data models: SourceCode, FrameByteCount, FunnelSnapshot, LossType
- Stats package with composition-root StatsAccumulator orchestrating:
  - TransportMetrics (RX bytes, lifetime-average throughput)
  - FirmwareLossTracker / FirmwareWrittenTracker (ENH_STAT deltas
    with first-report absolute value initialization)
  - SNGapTracker (sliding window reorder-tolerant SN gap detection)
  - PeakBurstTracker (per-source sliding window burst density)
  - TrafficSpikeDetector (wire utilization spike detection)
  - Wall-clock burst tracker for non-timestamped sources (REDIR)
- Torn-read guard on ENH_STAT reports (baudrate-based plausibility)
  with prev-state update on discard to prevent cascading drops
- Console-local metrics (TransportMetrics, PeakBurstTracker) preserved
  across INIT_DONE resets; only ENH_STAT-coupled components reset
- UART transport with port validation and exclusive serial access
- Comprehensive test suite (17 test files, 223 tests)
2026-04-07 11:44:49 +08:00
Zhou Xiao 30ad222662 feat(ble_log): consume frame_sn on loss path and bump BLE_LOG_VERSION
Add BLE_LOG_GET_FRAME_SN() on the buffer-full loss path so the SN
counter advances even when frames are dropped. This allows the console
to detect firmware-side buffer loss via SN gaps. Bump BLE_LOG_VERSION
to reflect the semantic change.
2026-04-07 11:44:44 +08:00
Zhou Xiao 490acad912 feat(bt/ble_log): implement UART redirection stream write
Introduce stream write API with deferred frame encapsulation for UART
redirection on port 0. Redirected data is now properly framed (header +
payload + checksum) instead of being sent as raw ASCII, preventing frame
parser sync oscillation on the receiver.

- Add stream_seal/stream_write/stream_flush in ble_log_lbm.c
- Add BLE_LOG_SRC_REDIR source and BLE_LOG_UART_REDIR_ENABLED gate
- Simplify redir_uart_tx_chars and timer callback to use stream API
- Flush pending stream data in ble_log_prph_deinit
- Make get_trans static (no external callers after refactor)
- Move UART wrap linker flags outside CONFIG_BT_ENABLED guard
- Default UART DMA peripheral when SOC_UHCI_SUPPORTED
- Default baud rate 921600 -> 3000000
2026-04-07 11:44:38 +08:00
Zhou Xiao 24a368974e fix(bt/ble_log): fix flush timer callback in UART redirect module
Fix incorrect esp_timer callback signature, replace blocking mutex
with non-blocking trylock, add prph_inited guard, correct timer
period from 100us to 1s, and remove fragile idle-based flush logic.
2026-04-07 11:44:32 +08:00
Zhou Xiao 992b2f75c5 fix(bt/ble_log): use aligned counters in ble_log_stat_mgr_t
Replace embedded ble_log_enh_stat_t (packed wire struct) inside
ble_log_stat_mgr_t with flat uint32_t counters. Natural 4-byte
alignment ensures each load/store compiles to a single l32i/s32i
on Xtensa/RISC-V, making individual field access atomic without
locks.

Build the packed wire format on the stack inside a critical section
in ble_log_write_enh_stat() so the full snapshot is consistent.
2026-04-07 11:44:26 +08:00
Zhou Xiao 812edd64c8 change(bt/ble_log): make checksum and enhanced statistics always enabled
Remove CONFIG_BLE_LOG_PAYLOAD_CHECKSUM_ENABLED conditional compilation
-- payload checksum is always computed over the full frame.

Remove CONFIG_BLE_LOG_XOR_CHECKSUM_ENABLED conditional -- XOR checksum
is always used; delete the sum checksum dead code path.

Remove CONFIG_BLE_LOG_ENH_STAT_ENABLED conditional -- enhanced
statistics (frame/byte counters per source) are always active.

Remove incorrect select on choice symbol
BT_LE_CONTROLLER_LOG_MODE_BLE_LOG_V2 from BLE_LOG_IS_ESP_CONTROLLER.
2026-04-07 11:44:21 +08:00
Zhou Xiao 54a5fe04e6 change(bt/ble_log): deprecate legacy SPI log output module
Move ble_log_spi_out.c and ble_log_spi_out.h into a deprecated/
subdirectory under components/bt/common/ble_log/. Extract all
BT_BLE_LOG_SPI_OUT_* Kconfig options into deprecated/Kconfig.in
with an if-block to reduce depends-on repetition, sourced from
ble_log/Kconfig.in inside a "Legacy SPI Log Output (Deprecated)"
menu. Add mutual exclusion with BLE_LOG_ENABLED so that the legacy
SPI Out and the new BLE Log Module cannot be enabled simultaneously.
Update CMakeLists.txt source path and add deprecated/include to
include dirs so existing callers are unaffected. The BLE Log
Module's SPI Master DMA peripheral transport is the replacement.
2026-04-07 11:44:14 +08:00
Zhou Xiao 1fee2c3a0f change(bt/ble_log): remove BLE Log UHCI Out module
Delete ble_log_uhci_out.c and its header. Remove the UHCI Out source
from CMakeLists.txt and all BT_BLE_LOG_UHCI_OUT_* Kconfig options.
Remove per-chip BT_LE_CONTROLLER_LOG_UHCI_OUT_ENABLED Kconfig and
all UHCI Out caller references in esp32c5/c6/h2 controller bt.c.
Update ble_log_console README to reference the new BLE Log Module
UART DMA config. The functionality is superseded by the BLE Log
Module's UART DMA peripheral transport.
2026-04-07 11:43:22 +08:00
Jiang Jiang Jian 103b011df8 Merge branch 'bugfix/wps_deauth_during_scan_v5.2' into 'release/v5.2'
fix(wifi): ignore disconnect events outside WPS handshake phase in wps (v5.2)

See merge request espressif/esp-idf!47252
2026-04-07 10:37:24 +08:00
Island 8a289d2c78 Merge branch 'bugfix/fix_privacy_callback_trigger_multipe_times_v5.2' into 'release/v5.2'
Bugfix/fix privacy callback trigger multiple times (5.2)

See merge request espressif/esp-idf!47254
2026-04-03 20:35:52 +08:00
Jiang Jiang Jian 0f7d6c6a5b Merge branch 'backport/backport_some_bugfix_260331_v5.2' into 'release/v5.2'
feat(bss_max_idle): optimization of the max BSS idle mechanism(backport v5.2)

See merge request espressif/esp-idf!47161
2026-04-03 19:32:09 +08:00
Rahul Tank b1ddc500ce Merge branch 'bugfix/gatts_stop_null_conn_aware_states_v5.2' into 'release/v5.2'
fix(nimble): fix null dereference of ble_gatts_conn_aware_states after gatts stop (v5.2)

See merge request espressif/esp-idf!47138
2026-04-03 12:43:51 +05:30
yinqingzhao bcfe969272 feat(bss_max_idle): optimization of the max BSS idle mechanism 2026-04-03 14:27:04 +08:00
Zhi Wei Jian 1a532094a0 fix(ble/bluedroid): Fixed privacy callback triggering multiple times
(cherry picked from commit 5272b7e75b)

Co-authored-by: zhiweijian <zhiweijian@espressif.com>
2026-04-03 14:02:33 +08:00
Kapil Gupta 2dc272e88f fix(wifi): ignore disconnect events outside WPS handshake phase in wps
wifi_station_wps_start() calls esp_wifi_disconnect() to leave a
previously connected AP before scanning for WPS registrars. When the
STA is already connected, the async disconnect event triggers
wps_sm_notify_deauth() which incorrectly treats it as a handshake failure,
disabling WPS entirely.

Guard wps_handle_failure() so it only fires when wps_get_status() is
WPS_STATUS_PENDING, i.e. the STA has found a WPS AP and is actively
in the M1-M8 exchange.
2026-04-03 11:29:25 +05:30
Jiang Jiang Jian 339056dff6 Merge branch 'fix/wifi_nan_wrong_service_id_log_v5.2' into 'release/v5.2'
fix(nan): zero-init pub_id and sub_id in NAN service functions (Backport v5.2)

See merge request espressif/esp-idf!47128
2026-04-03 13:50:43 +08:00
Astha Verma 9fe3137223 fix(nimble): fix null dereference of ble_gatts_conn_aware_states after gatts stop 2026-04-03 09:48:41 +05:30
Jiang Jiang Jian 2e4038b613 Merge branch 'bugfix/wifibug-1649_bp5.2' into 'release/v5.2'
fix(wifi): return specific error in API BPv5.2

See merge request espressif/esp-idf!47173
2026-04-03 11:14:48 +08:00
Jiang Jiang Jian 78bb6b0d06 Merge branch 'bugfix/fix_coex_sync_filter_and_delay_issue_v5.2' into 'release/v5.2'
fix(coex): fix coex sync filter and delay issue(Backport v5.2)

See merge request espressif/esp-idf!47245
2026-04-03 11:01:37 +08:00
Island 5958167641 Merge branch 'feat/support_run_time_alloc_for_esp_ip_test_v5.2' into 'release/v5.2'
Support Mempool Run Time Allocation for ESP IP Chips (v5.2)

See merge request espressif/esp-idf!46820
2026-04-03 10:13:15 +08:00
morris babe3e2d0c Merge branch 'fix/fix_parlio_tx_sample_edge_v5.2' into 'release/v5.2'
change(parlio_tx): use shift edge instead sample edge (v5.2)

See merge request espressif/esp-idf!46941
2026-04-02 23:34:42 +08:00
muhaidong b43e3e9ea6 fix(coex): fix coex sync filter and delay issue 2026-04-02 20:39:27 +08:00
Chen Jichang 107548e016 change(parlio_tx): use shift edge instead sample edge
Made-with: Cursor
2026-04-02 18:41:32 +08:00
cjin 3f32fefaec feat(ble): supported ble mempool run time allocation for esp ip chips 2026-04-02 16:40:03 +08:00
Jin Chen 953692616a feat(ble): make env init function cuttable on ESP32-C2
(cherry picked from commit 5ec82368ba)

Co-authored-by: cjin <jinchen@espressif.com>
2026-04-02 16:36:22 +08:00
Jin Chen 2502afa094 change(ble): [AUTO_MR] Update lib_esp32h2 to 913c704d
(cherry picked from commit a8d705ff7a)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-04-02 16:36:22 +08:00
Jin Chen 8e067d416f change(ble): [AUTO_MR] Update lib_esp32c2 to b8594335
(cherry picked from commit a2ef5c0ff9)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-04-02 16:36:22 +08:00
Jin Chen ef9c3a7972 change(ble): [AUTO_MR] Update lib_esp32c6 to 913c704d
(cherry picked from commit 06010a8b79)

Co-authored-by: zhaoweiliang <zhaoweiliang@espressif.com>
2026-04-02 16:36:22 +08:00
Wang Meng Yang 55e88b4e27 Merge branch 'bugfix/improve_spp_hid_v5.2' into 'release/v5.2'
fix(bt/bluedroid): fixed multiple high-severity issues from AI code review in SPP & HID (v5.2)

See merge request espressif/esp-idf!47148
2026-04-02 14:24:23 +08:00
Rahul Tank eec94d330f Merge branch 'feat/add_eatt_documentation_v5.2' into 'release/v5.2'
feat(nimble): Add EATT documentation (v5.2)

See merge request espressif/esp-idf!47024
2026-04-02 11:48:15 +05:30
Sumeet Singh 4c30f20afb feat(nimble): Update blecent example README.md with EATT documentation 2026-04-02 06:57:07 +05:30
Rahul Tank e8e60bb6cf Merge branch 'bugfix/nimble_example_fixes_v5.2' into 'release/v5.2'
fix(nimble): Address nimble example issues (v5.2)

See merge request espressif/esp-idf!47075
2026-04-01 15:42:52 +05:30
morris 12d942c658 Merge branch 'fix/i2c_nack_c5_v5.2' into 'release/v5.2'
fix(i2c_master): Fix potential concurrency issue with task and interrupt when nack happens (v5.2)

See merge request espressif/esp-idf!47155
2026-04-01 17:22:50 +08:00
C.S.M c6795167c6 fix(i2c_master): Fix concurrency issue with task and interrupt when nack 2026-04-01 14:58:53 +08:00
morris b29fd46bb1 Merge branch 'ci/i2c_testcase_bypass_v5.2' into 'release/v5.2'
ci(i2c): bypass the know failure case for deprecated driver (v5.2)

See merge request espressif/esp-idf!47179
2026-04-01 14:41:41 +08:00
Island 1e07f40a93 Merge branch 'bugfix/fix_some_bluedroid_bugs_260121_v5.2' into 'release/v5.2'
Bugfix/fix some bluedroid bugs 260121 (5.2)

See merge request espressif/esp-idf!46980
2026-04-01 11:45:16 +08:00
Chen Chen f7a44d1b09 ci(i2c): bypass the know failure case for deprecated driver 2026-04-01 08:40:00 +08:00
Astha Verma 65474b7fba fix(nimble): fix missing gatt caching header in examples 2026-03-31 17:31:13 +05:30
Junchi Chen dc6b20df37 fix(wifi): return specific error in API BPv5.2 2026-03-31 16:41:46 +08:00
zhiweijian bd3e284921 fix(ble/bluedroid): Fixed bluedrodi CI build error 2026-03-31 14:05:07 +08:00
zhiweijian e022bea682 fix(bt/bluedroid): Fixed AddCharacteristic failed when attr_len is zero for AUTO_RSP 2026-03-31 12:03:33 +08:00
Jiang Jiang Jian 21cd10e001 Merge branch 'bugfix/bt_idf_ci_v5.2' into 'release/v5.2'
fix(bt/example): Fixed the HFP printing issue in the CI test (v5.2)

See merge request espressif/esp-idf!47082
2026-03-30 19:43:52 +08:00
Jin Cheng 1de651d067 fix(bt/bluedroid): fixed multiple high-severity issues from AI code review in SPP 2026-03-30 19:28:45 +08:00
Jin Cheng 419f6aa7f5 fix(bt/bluedroid): fixed multiple high-severity issues from AI code review in HID 2026-03-30 19:27:27 +08:00
Sumeet Singh 20f52d60ab fix(nimble): Fix enc adv NVS struct and add ext adv support 2026-03-30 16:18:18 +05:30
Shreeyash Bhakare d72a8b091c fix(nimble): fix CODED PHY ext adv Packet Too Long by using min interval (20 ms) 2026-03-30 16:18:18 +05:30
Rahul Tank 93b0ad0c90 fix(nimble): Correct adv_list_init / deinit during nimble init / deinit 2026-03-30 16:18:18 +05:30