Skip to content

Instantly share code, notes, and snippets.

@raresteak
Last active August 12, 2024 12:56
Show Gist options
  • Save raresteak/94119f189397a983ab7bb4d3776141f2 to your computer and use it in GitHub Desktop.
Save raresteak/94119f189397a983ab7bb4d3776141f2 to your computer and use it in GitHub Desktop.
Bluetooth Classic at Linux command line

List devices

hciconfig
hciconfig hci0 version

Bring interface up | down

sudo hciconfig hci0 up
hciconfig
sudo hciconfig hci1 down
hciconfig

Display/set interface name

hciconfig hci0 name
sudo hciconfig hci0 name MyBlueToothDevice
hciconfig hci0 name

Set/unset device discoverable and connection acceptance

hciconfig hci0
sudo hciconfig hci0 piscan
hciconfig hci0
sudo hciconfig hci0 noscan
hciconfig hci0 

scanning/device discovery

  • Brief (MAC and Name)
hcitool -i hci0 scan
  • Detailed, includes device class
hcitool -i hci0 scan --info --class

set device class

hciconfig hci0 class
sudo hciconfig hci0 class 0x??????
hciconfig hci0 class

BT stack debugging

Let command run

while you perform other BT activity

hcidump -X -i hci0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment