Skip to content

Conversation

@smuppand
Copy link
Contributor

This PR refines the Bluetooth validation flow and consolidates common logic into shared helpers to make CI results more meaningful and less flaky.

Key changes

  • BT_ON_OFF:

    • Use bt_ensure_controller_visible and public-addr/bootstrap logic instead of inline controller checks.
    • Honour optional BT_ADAPTER env (from LAVA/CLI); fall back to findhcisysfs when not provided.
    • Ensure bluetoothd presence and adapter handling follows common pattern with clear SKIP/FAIL paths.
  • BT_SCAN:

    • Switch to the non-expect scan flow using bt_set_scan + bt_get_discovering and controller-visibility helpers.
    • Support BT_SCAN_TARGET_MAC / BT_TARGET_MAC to validate a specific device when provided, else require at least one device in bluetoothctl devices.
    • Poll Discovering state after scan ON/OFF and fail when no devices are discovered, improving CI signal.
    • Keep all Bluetooth-specific logic in lib_bluetooth.sh, leaving run.sh mostly as orchestration.
  • BT_FW_KMD:

    • Tighten btfwloaded() to scan dmesg for QCA/firmware issues (e.g. tx timeout/version-read failures).
    • Use shared helpers for controller visibility and basic sanity checks instead of ad-hoc parsing.
  • lib_bluetooth.sh:

    • Add reusable helpers: bt_ensure_controller_visible, bt_set_scan, bt_get_discovering, and controller MAC parsing.
    • Centralise public-addr/bootstrap flow and clean up bluetoothctl output handling.
    • Keep function names and existing call patterns intact where previously used.
  • functestlib.sh:

    • Trim Bluetooth-specific bits now moved into lib_bluetooth.sh, keeping this file focused on generic logging, dependency checks, and result handling.
    • No changes to .res file semantics or common test harness behaviour.

Add helpers for scan control, discovering state and controller visibility.
Harden btfwloaded() to catch common firmware failure patterns in dmesg.
Introduce bt_set_scan/bt_get_discovering/bt_ensure_controller_visible for reuse.
Keep existing public-addr/bootstrap and adapter selection logic intact.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Honor BT_ADAPTER and --adapter before auto-detection.
Keep existing findhcisysfs fallback when no override is given.
Improve logging to clearly report which adapter is used.
No functional change to power cycle logic or result handling.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Add BT_ADAPTER/--adapter and BT_SCAN_TARGET_MAC/BT_TARGET_MAC/--target-mac.
Use bt_ensure_controller_visible, bt_set_scan and bt_get_discovering consistently.
Validate either generic visibility or user-provided target MAC from devices list.
Preserve .res PASS/FAIL/SKIP semantics with detailed logging for CI.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Support BT_ADAPTER and --adapter overrides for firmware/KMD checks.
Fallback to findhcisysfs when no explicit adapter is provided.
Skip the test cleanly when no HCI adapter can be detected.
Keep existing btfwloaded-based firmware/KMD validation unchanged.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Drop duplicated BT helpers in favour of lib_bluetooth.sh implementations.
Retain only generic logging, dependency, and common infra helpers here.
Update callers to source lib_bluetooth.sh for adapter/scan operations.
No change to existing test result (.res) handling semantics.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Copy link

@bhargav0610 bhargav0610 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good for me

Copy link
Contributor

@abbajaj806 abbajaj806 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abbajaj806 abbajaj806 merged commit 599b560 into qualcomm-linux:main Nov 18, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants