Score:0

Bluez: cannot find Bluetooth device after failed pairing

pf flag

I am developing a simple app in python that uses bluez and dbus. The app should pair with a Bluetooth device - a raspberry Pi. I failed at pairing once, and now not only am I not able to reproduce the error, I can't even find the device anymore.

what I did:

  • scanned for all the devices ( using the startDiscovery() function on an object implementing org.bluez.Adapter1 interface)
  • checked every found device if its MAC address matches the one I am looking for
  • after finding the device I was looking for, I used its path to create a proxy object ( with bus.get_object('org.bluez', device_path) )
  • I created org.bluez.device1 interface on this object ( with dbus.Interface(device_obj, 'org.bluez.Device1') )
  • I set the the "Trusted" property of this interface to True
  • I called the Pair() function on this interface

This resulted in failed Pair attempt - it happened only once, I was not able to track down the error. Furthermore - the bluetooth on the raspberry Pi I tried to pair with stopped working: I was not able to advertise anymore. Rebooting and reinstalling bluez did not help, I had to reflash the SD card and install a fresh OS to make the bluetooth on RPi functional again.

On the application side I am able to scan and see all the other BT devices, except the one I failed to pair with. I tried rebooting, and reinstalling my code in the virtual environment.

If I run the bluetoothctl scan on program, I am able to see that RPi I am looking for. The bluetoothctl paired-devices list is empty. I belive the problem must be in my app.

I am really confused, and would be very grateful for any tips or suggestions.

user7216373 avatar
pf flag
I investigated the dbus, and just figured out that all the bluetooth devices I haven't tried pairing with use _org.freedesktop.DBus.ObjectManager_ interface to manifest, however the one device I tried to pair with before uses the _org.freedesktop.DBus.Properties_ interface... Any idea why this happens? And why is it persistent after rebooting?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.