Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Runner/suites/Connectivity/Bluetooth/BT_FW_KMD_Service/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,18 @@ else
fi

log_info "=== bluetoothctl list (controllers) ==="
bluetoothctl list 2>/dev/null || true

out="$(bluetoothctl list 2>/dev/null | sanitize_bt_output || true)"
if printf '%s\n' "$out" | grep -qi '^[[:space:]]*Controller[[:space:]]'; then
# Non-interactive worked print what we got
printf '%s\n' "$out"
else
# Non-interactive printed no controllers → retry using interactive method
log_warn "bluetoothctl list returned no controllers in non-interactive mode, retrying interactive list."

log_info "=== bluetoothctl list (controllers) ==="
btctl_script "list" "quit" | sanitize_bt_output || true
fi

log_info "=== lsmod (subset: BT stack) ==="
lsmod 2>/dev/null | grep -E '^(bluetooth|hci_uart|btqca|btbcm|rfkill|cfg80211)\b' || true
Expand Down
10 changes: 9 additions & 1 deletion Runner/suites/Connectivity/Bluetooth/BT_ON_OFF/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ elif findhcisysfs >/dev/null 2>&1; then
else
ADAPTER=""
fi

if [ -n "$ADAPTER" ]; then
log_info "Using adapter: $ADAPTER"
else
Expand All @@ -111,8 +111,13 @@ else
exit 0
fi

# --- NEW: warn/diag if non-interactive "bluetoothctl list" is empty (non-fatal) ---
btwarniflistempty "$ADAPTER" || true

# Ensure controller is visible to bluetoothctl (try public-addr if needed)
if ! bt_ensure_controller_visible "$ADAPTER"; then
# --- NEW: print diagnostics before skipping ---
btloghcidiag "$ADAPTER"
log_warn "SKIP — no controller visible to bluetoothctl (HCI RAW/DOWN or attach incomplete)."
echo "$TESTNAME SKIP" > "$res_file"
exit 0
Expand Down Expand Up @@ -154,6 +159,9 @@ after_on="$(btgetpower "$ADAPTER" 2>/dev/null || true)"
[ -z "$after_on" ] && after_on="unknown"

if [ "$after_on" = "yes" ]; then
# --- NEW: post-check (covers your "list is empty after run" symptom) ---
btwarniflistempty "$ADAPTER" || true

log_pass "Post-ON verification: Powered=yes (as expected)."
echo "$TESTNAME PASS" > "$res_file"
exit 0
Expand Down
47 changes: 20 additions & 27 deletions Runner/suites/Connectivity/Bluetooth/BT_SCAN/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause# BT_SCAN – Bluetooth scanning validation (non-expect version)
# SPDX-License-Identifier: BSD-3-Clause#
# BT_SCAN – Bluetooth scanning validation (non-expect version)

# ---------- Repo env + helpers ----------
SCRIPT_DIR="$(
cd "$(dirname "$0")" || exit 1
Expand Down Expand Up @@ -68,9 +70,12 @@ rm -f "$res_file"

log_info "------------------------------------------------------------"
log_info "Starting $TESTNAME Testcase"
log_info "Checking dependency: bluetoothctl"
log_info "Checking dependencies: bluetoothctl pgrep"

check_dependencies bluetoothctl pgrep
if ! check_dependencies bluetoothctl pgrep; then
echo "$TESTNAME SKIP" > "$res_file"
exit 0
fi

# -----------------------------
# 1. Ensure bluetoothd is running
Expand Down Expand Up @@ -167,10 +172,12 @@ log_info "Discovering state after scan ON window: $dstate_on"

# -----------------------------
# 7. Get devices list after scan ON
# - Try non-interactive bluetoothctl first
# - If empty/flaky, fallback to btctl_script "devices" "quit"
# -----------------------------
devices_out="$(
bluetoothctl devices 2>/dev/null \
| sanitize_bt_output
bt_list_devices_raw 2>/dev/null \
| grep '^Device ' || true
)"

if [ -n "$TARGET_MAC" ]; then
Expand Down Expand Up @@ -204,31 +211,17 @@ fi
# -----------------------------
log_info "Testing scan OFF..."
if ! bt_set_scan off "$ADAPTER"; then
log_warn "bt_set_scan(off) returned non-zero continuing with Discovering check."
# bt_set_scan(off) can be flaky on minimal images; rely on poll helper
log_warn "bt_set_scan(off) returned non-zero; continuing with scan-off polling."
fi

SCAN_OFF_OK=0
ITER=10
i=1
while [ "$i" -le "$ITER" ]; do
dstate_off="$(bt_get_discovering 2>/dev/null || true)"
[ -z "$dstate_off" ] && dstate_off="unknown"

log_info "Discovering state during scan OFF wait (iteration $i/$ITER): $dstate_off"

if [ "$dstate_off" = "no" ]; then
SCAN_OFF_OK=1
break
fi

sleep 2
i=$((i + 1))
done

if [ "$SCAN_OFF_OK" -eq 1 ]; then
log_pass "Discovering=no observed after scan OFF polling."
# Use lib helper to avoid repetitive log spam and handle 'unknown' cleanly.
if bt_scan_poll_off 10 1; then
# On minimal/ramdisk images bt_scan_poll_off may treat persistent 'unknown' as non-fatal.
log_pass "Scan OFF cleanup completed."
else
log_warn "Discovering did not transition to 'no' after scan OFF window."
# If you keep bt_scan_poll_off strict, this may still warn; not a test failure.
log_warn "Scan OFF cleanup did not confirm Discovering=no (non-fatal)."
fi

echo "$TESTNAME PASS" > "$res_file"
Expand Down
Loading
Loading