Skip to content

Find bluetooth interface

Identify bluetooth controller interfaces and inspect their kernel and management-layer details.


List available Bluetooth interfaces

ls -1 /sys/class/bluetooth/

Resolve the device path of a Bluetooth interface

readlink -f /sys/class/bluetooth/hci0

Find first kernel log entry mentioning hci0

dmesg -T | grep -oiE 'hci0' | head -n1

List Bluetooth controller names using btmgmt

btmgmt info | awk '/^hci[0-9]+:/ { sub(":", "", $1); print $1 }'

Extract Bluetooth controller identifiers from btmgmt output

btmgmt info | awk '/^hci[0-9]+:/ { sub(":", "", $1); print $1 }'

Inspect debug information for a Bluetooth controller

hr() {
  printf -v _hr "%*s" "$(tput cols 2>/dev/null || echo 80)" ""
  echo "${_hr// /-}"
}

# Pick a readable-ish random 256-color (avoid very dark low numbers)
rand_color() { printf '%s' $(( 16 + RANDOM % 216 )); }

find /sys/kernel/debug/bluetooth/hci0 -maxdepth 1 -type f -print0 \
| sort -z \
| while IFS= read -r -d '' f; do
    c=$(rand_color)
    esc=$'\033'

    # Set color
    printf '%s[38;5;%sm' "$esc" "$c"

    hr
    printf '%s\n' "$f"
    hr
    sed 's/^/  /' "$f"
    printf '%s[0m\n\n' "$esc"   # reset + blank line
  done

Show detailed udev information for a Bluetooth HCI device

hci=hci0
udevadm info -q all -p "$(readlink -f /sys/class/bluetooth/$hci/device)"