Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist #889

Closed
ClusterM opened this issue Jul 17, 2022 · 4 comments · Fixed by #900
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend bug Something isn't working

Comments

@ClusterM
Copy link

ClusterM commented Jul 17, 2022

  • bleak version:
    bleak-0.14.3
  • Python version:
    Python 3.9.2
  • Operating System:
    Linux lovepoint 5.15.48-sunxi64 #22.05.3 SMP Wed Jun 22 07:33:24 UTC 2022 aarch64 GNU/Linux
  • BlueZ version (bluetoothctl -v) in case of Linux:
    bluetoothctl: 5.55

Description

Can't execute bleak/examples/scanner.py:

cluster@lovepoint:~/bleak/examples$ sudo python3 scanner.py
Traceback (most recent call last):
  File "/home/cluster/bleak/examples/scanner.py", line 31, in <module>
    asyncio.run(main(sys.argv[1] if len(sys.argv) == 2 else ADDRESS))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/cluster/bleak/examples/scanner.py", line 26, in main
    device = await BleakScanner.find_device_by_address(address)
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/scanner.py", line 220, in find_device_by_address
    return await cls.find_device_by_filter(
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/scanner.py", line 249, in find_device_by_filter
    async with cls(detection_callback=apply_filter, **kwargs):
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/scanner.py", line 95, in __aenter__
    await self.start()
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/scanner.py", line 155, in start
    assert_reply(reply)
  File "/usr/local/lib/python3.9/dist-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist

Same with bleak/examples/discover.py:

cluster@lovepoint:~/bleak/examples$ python3 discover.py
Traceback (most recent call last):
  File "/home/cluster/bleak/examples/discover.py", line 22, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/cluster/bleak/examples/discover.py", line 16, in main
    devices = await discover()
  File "/home/cluster/.local/lib/python3.9/site-packages/bleak/backends/scanner.py", line 115, in discover
    async with cls(**kwargs) as scanner:
  File "/home/cluster/.local/lib/python3.9/site-packages/bleak/backends/scanner.py", line 95, in __aenter__
    await self.start()
  File "/home/cluster/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/scanner.py", line 155, in start
    assert_reply(reply)
  File "/home/cluster/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
@ClusterM
Copy link
Author

I commented out all assert_reply(reply) in scanner.py. It doesn't throw exception now but can't find any device.

@dlech
Copy link
Collaborator

dlech commented Jul 17, 2022

sudo python3 scanner.py

Sudo is not required and should not be used with Bleak.

bleak.exc.BleakDBusError: [org.freedesktop.DBus.Error.UnknownObject] Method "SetDiscoveryFilter" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist

It this the same problems as #693?

@dlech dlech added the Backend: BlueZ Issues and PRs relating to the BlueZ backend label Jul 17, 2022
@ClusterM
Copy link
Author

It this the same problems as #693?

Seems like yes.

@dlech
Copy link
Collaborator

dlech commented Jul 17, 2022

We should probably try to make a better error message for this. Also #524 could help avoid the problem in some cases.

@dlech dlech added the bug Something isn't working label Jul 20, 2022
dlech added a commit that referenced this issue Jul 29, 2022
Added
-----

* Added new ``assigned_numbers`` module and ``AdvertisementDataType`` enum.
* Added new ``bluez`` kwarg to ``BleakScanner`` in BlueZ backend.
* Added support for passive scanning in the BlueZ backend. Fixes #606.
* Added option to use cached services, characteristics and descriptors in WinRT backend. Fixes #686.
* Added ``PendingDeprecationWarning`` to use of ``address_type`` as keyword argument. It will be moved into the
  ``winrt`` keyword instead according to #623.
* Added better error message when adapter is not present in BlueZ backend. Fixes #889.

Changed
-------

* Add ``py.typed`` file so mypy discovers Bleak's type annotations.
* UUID descriptions updated to 2022-03-16 assigned numbers document.
* Replace use of deprecated ``asyncio.get_event_loop()`` in Android backend.
* Adjust default timeout for ``read_gatt_char()`` with CoreBluetooth to 10s. Merged #891.
* ``BleakScanner()`` args ``detection_callback`` and ``service_uuids`` are no longer keyword-only.
* ``BleakScanner()`` arg ``scanning_mode`` is no longer Windows-only and is no longer keyword-only.
* All ``BleakScanner()`` instances in BlueZ backend now use common D-Bus object manager.
* Deprecated ``filters`` kwarg in ``BleakScanner`` in BlueZ backend.
* BlueZ version is now checked on first connection instead of import to avoid import side effects. Merged #907.

Fixed
-----

* Documentation fixes.
* On empty characteristic description from WinRT, use the lookup table instead of returning empty string.
* Fixed detection of first advertisement in BlueZ backend. Merged #903.
* Fixed performance issues in BlueZ backend caused by calling "GetManagedObjects" each time a
  ``BleakScanner`` scans or ``BleakClient`` is connected. Fixes #500.
* Fixed not handling "InterfacesRemoved" in ``BleakClient`` in BlueZ backend. Fixes #882.
* Fixed leaking D-Bus socket file descriptors in BlueZ backend. Fixes #805.
@dlech dlech mentioned this issue Jul 29, 2022
dlech added a commit that referenced this issue Jul 29, 2022
Added
-----

* Added new ``assigned_numbers`` module and ``AdvertisementDataType`` enum.
* Added new ``bluez`` kwarg to ``BleakScanner`` in BlueZ backend.
* Added support for passive scanning in the BlueZ backend. Fixes #606.
* Added option to use cached services, characteristics and descriptors in WinRT backend. Fixes #686.
* Added ``PendingDeprecationWarning`` to use of ``address_type`` as keyword argument. It will be moved into the
  ``winrt`` keyword instead according to #623.
* Added better error message when adapter is not present in BlueZ backend. Fixes #889.

Changed
-------

* Add ``py.typed`` file so mypy discovers Bleak's type annotations.
* UUID descriptions updated to 2022-03-16 assigned numbers document.
* Replace use of deprecated ``asyncio.get_event_loop()`` in Android backend.
* Adjust default timeout for ``read_gatt_char()`` with CoreBluetooth to 10s. Merged #891.
* ``BleakScanner()`` args ``detection_callback`` and ``service_uuids`` are no longer keyword-only.
* ``BleakScanner()`` arg ``scanning_mode`` is no longer Windows-only and is no longer keyword-only.
* All ``BleakScanner()`` instances in BlueZ backend now use common D-Bus object manager.
* Deprecated ``filters`` kwarg in ``BleakScanner`` in BlueZ backend.
* BlueZ version is now checked on first connection instead of import to avoid import side effects. Merged #907.

Fixed
-----

* Documentation fixes.
* On empty characteristic description from WinRT, use the lookup table instead of returning empty string.
* Fixed detection of first advertisement in BlueZ backend. Merged #903.
* Fixed performance issues in BlueZ backend caused by calling "GetManagedObjects" each time a
  ``BleakScanner`` scans or ``BleakClient`` is connected. Fixes #500.
* Fixed not handling "InterfacesRemoved" in ``BleakClient`` in BlueZ backend. Fixes #882.
* Fixed leaking D-Bus socket file descriptors in BlueZ backend. Fixes #805.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: BlueZ Issues and PRs relating to the BlueZ backend bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants