1

We are trying to connect a Bluetooth device without a passkey and trusting default yes in Python.

I am running a headless Raspberry PI 3, and I want it to automatically accept pairings from any device.

I saw this answer in an identical question:

Automatically accepting Bluetooth connections on a Pi 3

But it seems to be a bit outdated and some of the used commands don't seem to exist. enter image description here

ViGoRa
  • 17
  • 7
  • Which version of BlueZ are you using? Does it have to be python commands or is it OK to just use BlueZ commands directly? – Youssif Saeed Mar 07 '19 at 06:54
  • "some of the used commands don't seem to exist" - which ones specifically? – Dmitry Grigoryev Mar 07 '19 at 09:36
  • Latest Version of BlueZ was using. @Youssif Saeed – ViGoRa Mar 07 '19 at 16:24
  • hci0 is showing error @Dmitry Grigoryev – ViGoRa Mar 07 '19 at 16:25
  • Can you try doing this using normal BlueZ command line tools first? You can run 'btmgmt bondable on' to set your device to be pairable/bondable, then 'btmgmt io-cap 3' to set your IO capabilities to NoInput/NoOutput. After that, test that your raspberry pi accepts incoming pairing without requiring a passkey and see if it works. If this fails, please post the error message that you are getting. – Youssif Saeed Mar 07 '19 at 22:02
  • Set Bondable for hci0 failed with status 0×14 (Permission Denied). @Youssif Saeed,. Thanks for responding – ViGoRa Mar 08 '19 at 05:28
  • It is came while using the command with 'sudo'. But it shows the "Pairing Requested" Confirmation box. How to avoid it???. Thanks for responding – ViGoRa Mar 08 '19 at 05:49
  • We are using BlueZ 5.43 version. @YoussifSaeed – ViGoRa Mar 08 '19 at 06:07
  • Are you using classic Bluetooth or Bluetooth Low Energy (BLE)? Assuming that you are using BLE, Can you try the following:- 'btmgmt power off', 'btmgmt breder off', 'btmgmt power on'. Then quit btmgmt and try to re-pair to the Raspberry Pi. I currently don't have access to my Raspberry Pi but when I do I can try this. By the way, the latest version of BlueZ is 5.50 so you currently don't have the latest but I don't think this is related to the issue you are seeing. – Youssif Saeed Mar 08 '19 at 06:41
  • If 'bredr off', any device is not showing the raspberry pi Bluetooth. If 'bredr on', all devices are showing but couldn't connect to the pi Bluetooth(It asks for pin, no default pin is not working). @YoussifSaeed – ViGoRa Mar 08 '19 at 09:12
  • I added the photo of message in the question. @YoussifSaeed – ViGoRa Mar 08 '19 at 11:56
  • I got error in bluetooth-agent in the previous solution. @YoussifSaeed – ViGoRa Mar 09 '19 at 09:19
  • I got error in bluetooth-agent in the previous solution. @DmitryGregoryev – ViGoRa Mar 09 '19 at 09:20
  • We updated BlueZ 5.50 @YoussifSaeed – ViGoRa Mar 09 '19 at 09:21
  • Why that "Pairing Requested" will be coming. I added photo in the question. @YoussifSaeed – ViGoRa Mar 09 '19 at 09:24

1 Answers1

1

Taken from raspberryPi.org

To pair type pair xx:xx:xx:xx:xx:xx where xx:xx:xx:xx:xx:xx is your BD address of the 
device you want to pair
Next type trust xx:xx:xx:xx:xx:xx

You should read the full thread from the link, this can help you.

Basicly the idea is to pair bluetooth device without user gui.

[The raspberry is much faster without a Desktop envoirement]

clockw0rk
  • 216
  • 1
  • 8