Skip to content

bluez5: Fix StartDiscovery/StopDiscovery without a discovery filter - #253

Merged
martinpitt merged 1 commit into
martinpitt:mainfrom
leierx:bluez-discovery
Dec 2, 2026
Merged

martinpitt merged 1 commit into
martinpitt:mainfrom
leierx:bluez-discovery

Conversation

@leierx

@leierx leierx commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

StartDiscovery/StopDiscovery on an adapter that never had SetDiscoveryFilter called raise:

org.freedesktop.DBus.Python.KeyError: KeyError: 'DiscoveryFilter'

AddAdapter doesn't set DiscoveryFilter, and both methods index it directly. BlueZ doesn't require a filter. The suite doesn't catch it because bluetoothctl scan on calls SetDiscoveryFilter first.

Fix: .get("DiscoveryFilter"). Test: test_discovery_without_filter; fails before, passes after.

AddAdapter() does not set DiscoveryFilter, so both methods raised
KeyError unless SetDiscoveryFilter() was called first. BlueZ does not
require a filter. The tests did not notice as bluetoothctl's "scan on"
always sets one.

Signed-off-by: Lars Smith Eier <larssmitheier@protonmail.com>

@martinpitt martinpitt left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, thanks!

@martinpitt
martinpitt merged commit 199a28c into martinpitt:main Dec 2, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants