bleak icon indicating copy to clipboard operation
bleak copied to clipboard

examples/service_explorer.py "Unknown ATT error" on macOS

Open jsmif opened this issue 2 years ago • 1 comments

  • bleak version: bleak-0.21.0a
  • Python version: Python 3.11.3
  • Operating System: macOS 13.3.1 (a)

Description

Testing examples/service_explorer.py on macOS since it doesn't work for me on Linux (https://github.com/hbldh/bleak/issues/1333 )

What I Did

I tried to connect to a device named "Dropcam" (presumably one of these: https://support.google.com/googlenest/answer/9244112?hl=en), and got the below error:

python3 service_explorer.py --address 1042157A-1971-51B5-EBFD-1E4B02C2BC37
2023-06-14 09:18:59,100 __main__ INFO: starting scan...
2023-06-14 09:19:02,259 __main__ INFO: connecting to device...
Traceback (most recent call last):
  File "/Users/user/Desktop/temp/bleak/examples/service_explorer.py", line 129, in <module>
    asyncio.run(main(args))
  File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/user/Desktop/temp/bleak/examples/service_explorer.py", line 41, in main
    async with BleakClient(
  File "/Users/user/Desktop/temp/bleak/bleak/__init__.py", line 491, in __aenter__
    await self.connect()
  File "/Users/user/Desktop/temp/bleak/bleak/__init__.py", line 531, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Desktop/temp/bleak/bleak/backends/corebluetooth/client.py", line 128, in connect
    await self.get_services()
  File "/Users/user/Desktop/temp/bleak/bleak/backends/corebluetooth/client.py", line 224, in get_services
    descriptors = await self._delegate.discover_descriptors(characteristic)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Desktop/temp/bleak/bleak/backends/corebluetooth/PeripheralDelegate.py", line 131, in discover_descriptors
    await future
bleak.exc.BleakError: Failed to discover descriptors for characteristic 65534: Error Domain=CBATTErrorDomain Code=101 "Unknown ATT error." UserInfo={NSLocalizedDescription=Unknown ATT error.}

Logs

Unfortunately I cannot provide logs as that would provide my exact physical location (see: wigle.net). I recognize that it may not be possible to reproduce this error. But if you find a possible fix based on the above backtrace I'm willing to test it out.

jsmif avatar Jun 14 '23 13:06 jsmif

Without logs of the Bluetooth packets, I can't really tell much. It sounds like the device is doing something unexpected that the Bluetooth stack doesn't like.

dlech avatar Jun 14 '23 14:06 dlech

This issue has been automatically closed because it has not had any activity for 100 days after being marked as stale.

github-actions[bot] avatar Oct 05 '25 02:10 github-actions[bot]