Last edited one month ago

How to scan Bluetooth devices

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP25x lines

1. Scan for available Bluetooth devices[edit source]

 hcitool scan
Scanning ...
       A0:AF:BD:3B:26:61       lmecxl0923
       B0:55:08:40:33:84       HUAWEI P8 lite 2017

2. Setting the device to Visible[edit source]

To control the visiblity of our Bluetooth device to other Bluetooth hardware.

  • to enable visibility:
 hciconfig hciX piscan

(hciX corresponds to the available Bluetooth hardware: hci0)

  • To disable visibility:
 hciconfig hciX noscan

(hciX corresponds to the available Bluetooth hardware: hci0)

3. How to scan via bluetoothd/systemd[edit source]

Systemd provides a tool for Bluetooth management: bluetoothctl.
Example session with bluetoothclt for scanning, pairing, connecting:

[NEW] Controller 43:43:A1:12:1F:AC stm32mp1 [default]
Agent registered
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller 43:43:A1:12:1F:AC Powered: yes
[bluetooth]# agent on
Agent is already registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller 43:43:A1:12:1F:AC Discovering: yes
[NEW] Device D8:DB:36:D1:39:88 STM
[bluetooth]# scan off
[CHG] Controller 43:43:A1:12:1F:AC Discovering: no
Discovery stopped
[bluetooth]#pair D8:DB:36:D1:39:88
Pairing successful
[bluetooth]# connect D8:DB:36:D1:39:88
Connection successful
[STM]# quit
Agent unregistered
[DEL] Controller 43:43:A1:12:1F:AC stm32mp1 [default]