Open Ramavarapu opened 4 years ago
I'm affected by this bug as well. Reproduced in the same way.
I am working on this as part of upgrades to the adafruit-blinka-bleio library to support MacOS and to keep up with changes to bleak
. Could I ask you what versions of bleak
and adafruit-blinka-bleio
you are running? You can get these from pip3 list
.
bleak
is 0.8.0
adafruit-blinka-bleio
is 1.1.0
Let me know if you need any more information.
I reproduced this problem on RPi 3B+ and RPi 4B. The problem does not occur on RPi Zero W and RPi 3B (no +).
This appears to be a bluez-firmware
problem. As of this writing, the latest version is bluez-firmware-1.2-4+rpt5
. I had to roll back to bluez-firmware-1.2-4+rpt2
to get this to work. I downloaded the .deb from http://archive.raspberrypi.org/debian/pool/main/b/bluez-firmware/bluez-firmware_1.2-4+rpt2_all.deb. Versions rpt3
and rpt4
didn't work. What seems like the same problem was reported here: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=285641&p=1728626, and that report rolled back to rpt2
also.
I will try to figure out how to submit a bug report to RPi about this, but if you are familiar, have at it!
Someone else with an equivalent problem opened this issue on the appropriate RPi GitHub: https://github.com/RPi-Distro/bluez-firmware/issues/6. I'll track that.
Please use https://github.com/dhalbert/Adafruit_Blinka_bleio/tree/macos-fixes with bleak 0.8.0 and see if that works for you. I'll be submitting that to the library soon.
When I run this sample code on my Raspberry Pi 4, I get the error message(s) below. AFAIK, I have followed all the pre-req steps. Any help/pointers to what I am doing wrong is much appreciated!
-RS
Scanning... Traceback (most recent call last): File "/home/pi/software/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter/examples/ble_berrymed_pulse_oximeter_simpletest.py", line 32, in
pulse_ox_connection = ble.connect(adv)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_ble/init.py", line 279, in connect
connection = self._adapter.connect(advertisement.address, timeout=timeout)
File "/home/pi/.local/lib/python3.7/site-packages/bleio/adapter.py", line 335, in connect
return self.await_bleak(self._connect_async(address, timeout=timeout))
File "/home/pi/.local/lib/python3.7/site-packages/bleio/adapter.py", line 114, in await_bleak
return future.result(timeout)
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
return self.get_result()
File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in get_result
raise self._exception
File "/home/pi/.local/lib/python3.7/site-packages/bleio/adapter.py", line 344, in _connect_async
await client.connect(timeout=timeout)
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 175, in connect
await self.get_services()
File "/home/pi/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 317, in get_services
raise BleakError("Services discovery error")
bleak.exc.BleakError: Services discovery error