2022-10-29 17:12:48

by Russell King (Oracle)

[permalink] [raw]
Subject: BTLE scanning - requesting duplicates

Hi,

I'm aware that in the bluetooth dbus API, there is the facility to
request duplicate filtering to be enabled or disabled. I wish to
disable duplicates, as some BTLE devices I have publish data rapidly
in their manufacturer data which I would like to capture.

However, it seems that setting a filter specifying the state of
DuplicateData in a filter does nothing - I get an update from the
MyNewt NumBLE based device about once every scan (so once every 10
seconds) which is way too slow.

I haven't found a way to speed this up. However, what I have noticed
is that no matter what I do, btmon says:

< HCI Command: LE Set Scan Parame.. (0x08|0x000b) plen 7 #88 [hci0] 149.394365
Type: Active (0x01)
Interval: 11.250 msec (0x0012)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #89 [hci0] 149.395217
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #90 [hci0] 149.395313
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The hardware is always told to filter duplicates no matter what I do.

Looking at the kernel code, net/bluetooth/hci_sync.c,
hci_active_scan_sync(), it seems that the facility _not_ to filter
duplicate data has never been implemented, except if we have
an "advertisement monitor" attached (what's one of those?)

Is there a reason why bluetoothd doesn't pass the request for
duplicate data to the adapter? Can it be made to do so? How would
that be achieved - can the management commands be modified to do
this?

Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!