You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Runner/utils/lib_bluetooth.sh
+68-37Lines changed: 68 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -1696,54 +1696,85 @@ btfwpresent() {
1696
1696
}
1697
1697
1698
1698
btfwloaded() {
1699
-
# Look at recent Bluetooth/QCA/WCN messages only, to keep noise low.
1700
-
# Tune tail -n if needed.
1699
+
# ---- Configurable patterns (override via env if needed) ----
1700
+
# "Final success" (strongest marker that FW+UART setup completed)
1701
+
success_re="${BTFW_SUCCESS_RE:-setup on UART is completed|setup on uart is completed}"
1702
+
1703
+
# "Fatal-ish" errors: these should FAIL only if they occur after the final success,
1704
+
# otherwise they indicate transient issues during bring-up -> WARN.
1705
+
fatal_re="${BTFW_FATAL_RE:-tx timeout|Reading QCA version information failed|failed to open firmware|firmware file.*not found|download.*firmware.*failed|failed to download.*firmware|timeout waiting for firmware|firmware.*load.*failed}"
1706
+
1707
+
# Retry/transient hints: if success exists and we see these, we likely want WARN.
1708
+
transient_re="${BTFW_TRANSIENT_RE:-Retry BT power ON|retry bt power on|reset|re-init|reinit|failed.*\\(-110\\)}"
1709
+
1710
+
# ---- Collect recent relevant dmesg ----
1711
+
# Filter for BT/QCA/WCN related lines; keep a reasonable window.
# Fatal after success => FAIL (setup looked done, but then errors happened later)
1758
+
if [ "$last_fatal"-gt"$last_success" ];then
1759
+
log_warn "btfwloaded: fatal BT/QCA errors occurred after final setup marker; treating as FAIL."
1760
+
printf'%s\n'"$out"| tail -n 40 >&2
1761
+
return 1
1731
1762
fi
1732
-
1733
-
#--- Failure / warning patterns ---
1734
-
# Any of these will force a "not OK" verdict even if we saw a success marker.
1735
-
ifprintf'%s\n'"$out"| grep -qi -E \
1736
-
'tx timeout|Reading QCA version information failed|failed to open firmware|firmware file.*not found|no such file or directory.*firmware|download.*firmware.*failed|failed to download.*firmware|timeout waiting for firmware|firmware.*load.*failed';then
1737
-
ok=0
1763
+
1764
+
#Fatal before success OR transient hints => WARN (retry scenario)
1765
+
if [ "$last_fatal"-gt 0 ] && [ "$last_fatal"-lt"$last_success" ];then
1766
+
log_warn "btfwloaded: transient errors occurred before final setup marker; treating as WARN."
0 commit comments