Last edited 5 years ago

How to scan Bluetooth devices: Difference between revisions

deleted>Frq08988
mNo edit summary
 
Registered User
No edit summary
 
Line 1: Line 1:
<noinclude>
{{ArticleMainWriter | ChristopheR}}
{{ArticleApprovedVersion | ChristopheR | AlexandreT (Not Done), GeraldB (Not Done), LudovicB (Not Done), BernardP (Not Done), LoicP (Not Done) |No previous approved version | PhilipS - 04Jan'19 - 10182 | 14Jan'19}}
[[Category:Bluetooth]]
</noinclude>
=== Scan for available Bluetooth devices ===
=== Scan for available Bluetooth devices ===


Line 50: Line 44:
  Agent unregistered
  Agent unregistered
  [DEL] Controller 43:43:A1:12:1F:AC stm32mp1 [default]
  [DEL] Controller 43:43:A1:12:1F:AC stm32mp1 [default]
<noinclude>
[[Category:Bluetooth]]
{{PublicationRequestId | 10182 | 2019-01-04 | PhilipS}}
</noinclude>

Latest revision as of 10:29, 3 February 2020

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:

 bluetoothctl
[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]