Skip to content

wait_for_termination issue with Snooping Transport #874

@ttdennis

Description

@ttdennis

When the wait_for_termination() method is called while a SnoopingTransport is in use Bumble crashes. The reason is that the Source class in the SnoopingTransport does not have the wait_for_termination() method implemented.

The following example shows the scan.py app being run:

BUMBLE_SNOOPER=btsnoop:file:/tmp/bumble-snoop uv run bumble-scan usb:0
<<< connecting to HCI...
<<< connected
Traceback (most recent call last):
  File "/Users/user/git/bumble/.venv/bin/bumble-scan", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/user/git/bumble/.venv/lib/python3.14/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/user/git/bumble/.venv/lib/python3.14/site-packages/click/core.py", line 1406, in main
    rv = self.invoke(ctx)
  File "/Users/user/git/bumble/.venv/lib/python3.14/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/git/bumble/.venv/lib/python3.14/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/Users/user/git/bumble/apps/scan.py", line 241, in main
    asyncio.run(
    ~~~~~~~~~~~^
        scan(
        ^^^^^
    ...<11 lines>...
        )
        ^
    )
    ^
  File "/opt/homebrew/Cellar/python@3.14/3.14.2/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/runners.py", line 204, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/python@3.14/3.14.2/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/runners.py", line 127, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/python@3.14/3.14.2/Frameworks/Python.framework/Versions/3.14/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/user/git/bumble/apps/scan.py", line 184, in scan
    await hci_source.wait_for_termination()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Source' object has no attribute 'wait_for_termination'

The docstring in the wait_for_termination() implementation in the BaseSource mentions that it is only kept for backward compatibility.

So I guess the solution is to either add a wait_for_termination method to the Source class in the SnoopingTransport, or adapt the scripts to use await source.terminated.

I would have created a PR to fix the issue, but I'm not sure what you prefer (implementing the method versus deprecating it and adapting the apps/examples).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions