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

Can't receive iBeacon advertisements #38

Open
cj8scrambler opened this issue Oct 1, 2021 · 0 comments
Open

Can't receive iBeacon advertisements #38

cj8scrambler opened this issue Oct 1, 2021 · 0 comments

Comments

@cj8scrambler
Copy link
Contributor

I am unable to receive iBeacon advertisements on a Raspberry Pi with kernel 5.10.17+ using the bleak backend. I don't believe this is realted to he BlueZ "Duplicate Advertisements" issue because this seems to be fixed in Linux 5.9+ (after commit 8208f5a9d435e).

With DEBUG logging enabled, I can see that bleak receives the DBUS InterfaceAdd, PropertiesChanged, InterfacesRemoved sequence from the device:

DEBUG:bleak.backends.bluezdbus.scanner:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/hci0/dev_C8_C4_6E_B0_74_C8', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.Device1': {'Address': <dbus_next.signature.Variant ('s', C8:C4:6E:B0:74:C8)>, 'AddressType': <dbus_next.signature.Variant ('s', random)>, 'Alias': <dbus_next.signature.Variant ('s', C8-C4-6E-B0-74-C8)>, 'Paired': <dbus_next.signature.Variant ('b', False)>, 'Trusted': <dbus_next.signature.Variant ('b', False)>, 'Blocked': <dbus_next.signature.Variant ('b', False)>, 'LegacyPairing': <dbus_next.signature.Variant ('b', False)>, 'RSSI': <dbus_next.signature.Variant ('n', -77)>, 'Connected': <dbus_next.signature.Variant ('b', False)>, 'UUIDs': <dbus_next.signature.Variant ('as', [])>, 'Adapter': <dbus_next.signature.Variant ('o', /org/bluez/hci0)>, 'ManufacturerData': <dbus_next.signature.Variant ('a{qv}', {76: <dbus_next.signature.Variant ('ay', b'\x02\x15\xa4\x95\xbbP\xc5\xb1KD\xb5\x12\x13p\xf0-t\xde\x00I\x03\xe8R')>})>, 'ServicesResolved': <dbus_next.signature.Variant ('b', False)>}, 'org.freedesktop.DBus.Properties': {}}]
DEBUG:bleak.backends.bluezdbus.scanner:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_C8_C4_6E_B0_74_C8): ['org.bluez.Device1', {}, ['RSSI']]
DEBUG:bleak.backends.bluezdbus.scanner:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_C8_C4_6E_B0_74_C8', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]

However start_scan() never returns this advertisement. It appears that when bleio performs the _scan_for_interval(), the device gets added, changed and removed during the scan interval. Since the InterfacesRemoved event came in during the scan interval, get_discovered_devices() reports no device.

Looking at the bleak backend implmentation, it seems that the only way to guarantee receiving this advertisement would be to register a callback to handle the InterfaceAdd and PropertiesChanged events.

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

No branches or pull requests

1 participant