Correct way to turn on Bluetooth discovery on Ubuntu command line

Viewed 734

Looks like there are two different options to put Bluetooth in discovery mode:

First method:

$ sudo bluetoothctl
#discoverable on
#pairable on
#agent on
#default-agent

Second method:

$ sudo hciconfig hci0 piscan

Second method seems to be simpler. Is there any problem in using the second method? When does the first method make sense?

1 Answers

The first method should be used going forward because hciconfig has been deprecated along with a few other command line tools. I believe they are still bundled in your OS either because you have an older version of the OS or maybe because there's a grace period before the tools are fully removed.

You can also use btmgmt to get your device to be discoverable/connectable/pairable. The difference is that btmgmt is considered to be more system related while bluetoothctl is application-related. See this answer below for more information:-

Raspberry BLE Encryption / Pairing

Related