2017-02-09 02:09:44

by Bridger Maxwell

[permalink] [raw]
Subject: Scanning for advertising packets more often

Hi,

I=E2=80=99m trying to make a Bluetooth LE peripheral that will work =
without pairing. Instead, multiple receivers can listen for events by =
listening for changes in the advertising packet. I=E2=80=99ve got the =
peripheral configured to broadcast every 100ms, but the receiver running =
Bluez only gets updates about once per second.

Is there a way to configure Bluez to get advertising packets scanned =
more often? I=E2=80=99d also like to turn off any duplicate filtering.

Additionally, the peripheral broadcasts two types of advertising =
packets. One type is from the builtin firmware and I don=E2=80=99t care =
about. The other type is my custom advertising packet. Both of these =
have the same MAC address. I believe Bluez is filtering duplicates from =
the same address within each 1 second window. I am getting a random =
sampling of either the firmware advertising packet or my custom =
advertising packet once per second.

I=E2=80=99m using Pybluez[ble] to use Bluez. This is the scratch script =
I have running so far: =
https://gist.github.com/bridger/83fc2e9c60fd07d925b0bec80c47acab I tried =
using LE_SET_SCAN_PARAMETERS to change the scan interval and window but =
this didn=E2=80=99t seem to have an effect.

If this is a bad idea, let me know. I liked the simplicity of not =
pairing but maybe I=E2=80=99m headed in the wrong direction.

- Bridger Maxwell=


2017-02-10 11:36:06

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Scanning for advertising packets more often

Hi Bridger,

> I’m trying to make a Bluetooth LE peripheral that will work without pairing. Instead, multiple receivers can listen for events by listening for changes in the advertising packet. I’ve got the peripheral configured to broadcast every 100ms, but the receiver running Bluez only gets updates about once per second.
>
> Is there a way to configure Bluez to get advertising packets scanned more often? I’d also like to turn off any duplicate filtering.
>
> Additionally, the peripheral broadcasts two types of advertising packets. One type is from the builtin firmware and I don’t care about. The other type is my custom advertising packet. Both of these have the same MAC address. I believe Bluez is filtering duplicates from the same address within each 1 second window. I am getting a random sampling of either the firmware advertising packet or my custom advertising packet once per second.
>
> I’m using Pybluez[ble] to use Bluez. This is the scratch script I have running so far: https://gist.github.com/bridger/83fc2e9c60fd07d925b0bec80c47acab I tried using LE_SET_SCAN_PARAMETERS to change the scan interval and window but this didn’t seem to have an effect.
>
> If this is a bad idea, let me know. I liked the simplicity of not pairing but maybe I’m headed in the wrong direction.

scanning without duplicate filtering is a pretty nasty thing from a power consumption point of view. It is not that BlueZ (and the kernel) can not handle it. It is just that it will cause many wakeups.

Question is if you know the BD_ADDR of your peripheral ahead of time and just want to disable duplicate filtering for a device we can stick into the whitelist or if you want to do it for all devices. I am really reluctant to enable this for all devices. Since people test this in their small setup with only a few devices around. And then it goes into the wild and you enter areas with millions of LE advertising packets around. And then out of the sudden all hell breaks loose. We have been extremely cautious with using duplicate filtering and the whitelist for all our transaction driven by the kernel.

Regards

Marcel


2017-02-09 11:13:54

by Barry Byford

[permalink] [raw]
Subject: Re: Scanning for advertising packets more often

Hello Bridger,

On 9 February 2017 at 02:09, Bridger Maxwell <[email protected]> wr=
ote:
> Hi,
>
> I=E2=80=99m trying to make a Bluetooth LE peripheral that will work witho=
ut pairing. Instead, multiple receivers can listen for events by listening =
for changes in the advertising packet. I=E2=80=99ve got the peripheral conf=
igured to broadcast every 100ms, but the receiver running Bluez only gets u=
pdates about once per second.
>
> Is there a way to configure Bluez to get advertising packets scanned more=
often? I=E2=80=99d also like to turn off any duplicate filtering.
>
> Additionally, the peripheral broadcasts two types of advertising packets.=
One type is from the builtin firmware and I don=E2=80=99t care about. The =
other type is my custom advertising packet. Both of these have the same MAC=
address. I believe Bluez is filtering duplicates from the same address wit=
hin each 1 second window. I am getting a random sampling of either the firm=
ware advertising packet or my custom advertising packet once per second.
>
> I=E2=80=99m using Pybluez[ble] to use Bluez. This is the scratch script I=
have running so far: https://gist.github.com/bridger/83fc2e9c60fd07d925b0b=
ec80c47acab I tried using LE_SET_SCAN_PARAMETERS to change the scan interva=
l and window but this didn=E2=80=99t seem to have an effect.
>
> If this is a bad idea, let me know. I liked the simplicity of not pairing=
but maybe I=E2=80=99m headed in the wrong direction.

You may find this link to a previous thread relevant to your requirements:
http://marc.info/?l=3Dlinux-bluetooth&m=3D148106041713054&w=3D2



>
> - Bridger Maxwell--
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html