Skip to content

Fails every time with HCI TIMEOUT error on _bleio.Connection..discover_remote_services() #10580

@o-murphy

Description

@o-murphy

CircuitPython version and board name

LILYGO T-Display S3, ESP32S3

Code/REPL

async def _discover_services_task(self):
        if hasattr(self._connection, "_bleio_connection"):
            bleio_conn = self._connection._bleio_connection
            if hasattr(bleio_conn, "discover_remote_services"):

                await asyncio.sleep(1.0)
                try:
                    await asyncio.sleep(1)
                    return bleio_conn.discover_remote_services()
                except Exception as e:
                    raise BleakError(f"Failed to discover remote services: {e}")
        raise BleakError("Discover remote services not available")

Behavior

1368.945: DEBUG - Connected to BLE device @ 55:26:5e:02:d3:6b
1368.949: DEBUG - Retrieving services from BLE device @ 55:26:5e:02:d3:6b
Traceback (most recent call last):
  File "/lib/bleak/backends/circuitpython/client.py", line 114, in _discover_services_task
_bleio.BluetoothError: Unknown BLE error: 7

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 38, in <module>
  File "asyncio/core.py", line 346, in run
  File "asyncio/core.py", line 299, in run_until_complete
  File "asyncio/core.py", line 283, in run_until_complete
  File "asyncio/funcs.py", line 181, in gather
  File "asyncio/core.py", line 283, in run_until_complete
  File "<stdin>", line 22, in main
  File "/lib/bleak/__init__.py", line 565, in __aenter__
  File "/lib/bleak/__init__.py", line 587, in connect
  File "/lib/bleak/backends/circuitpython/client.py", line 79, in connect
  File "asyncio/core.py", line 283, in run_until_complete
  File "/lib/bleak/backends/circuitpython/client.py", line 116, in _discover_services_task
BleakError: Failed to discover remote services: Unknown BLE error: 7

Description

I'm trying to make bleak-compatible backend for CircuitPython, for now every time I wanna discover all services for peripheral i got _bleio.BluetoothError 7 HCI TIMEOUT

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions