Skip to content

Instantly share code, notes, and snippets.

@raresteak
Last active June 8, 2026 17:05
Show Gist options
  • Select an option

  • Save raresteak/94119f189397a983ab7bb4d3776141f2 to your computer and use it in GitHub Desktop.

Select an option

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

BTScanner

sudo btscanner

Interogate device

Query a device found earlier with scanning

Change your devices name because your device name will show up on the end users device wanting to connect.

sudo hciconfig hci0 name Watch
sudo sdptool browser AA:BB:CC:DD:EE:FF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment