-
Notifications
You must be signed in to change notification settings - Fork 301
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
Is passive scanning implemented in the Linux backend? #606
Comments
I think Windows is the only OS that has an API to select passive scanning. |
You're right, I don't see any way to choose passive scanning in the BlueZ D-Bus Adapter API description, so apparently this isn't possible (yet). |
Is there any upstream issue on this? I wish i could run passive scan. I suspect my constant active scans crash my device. |
There is a fairly new advertisement monitor API which requires BlueZ >= 5.56 and Linux kernel >= 5.10. It should handle passive scanning, if I understand correctly. |
Greetings Home Assistant is currently overhauling our Bluetooth support and we are looking for a passive scanning option. Our current recommendation is to use bleak for new integrations. Thanks for that! If this feature is viable soon we would want to only support bleak going forward, however if it’s something far future we likely need to consider supporting an additional Bluetooth library as well which we would really like to avoid. If there is anything we can do to help move this forward, please let me know what is needed. Thank you! |
If a company that uses Bleak want to sponsor me to take a week off of work, I can have a go at it. |
I sent you an email 👍 |
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.
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.
bluetoothctl -v
) in case of Linux: 5.53Description
I wanted to do a passive scan with Bleak. Issue #500 seemed to suggest that this is possible with the keyword argument
scanning_mode='passive'
to theBleakScanner
constructor. So I added this argument while initializing theBleakScanner
. However, Wireshark still shows me SCAN_REQ packets coming from my computer and SCAN_RSP packets as replies from my BLE devices, which suggests that Bleak is still doing an active scan.What I Did
My Minimal Workable Example is:
The text was updated successfully, but these errors were encountered: