1

I am scanning for ble beacon advertisements which dynamically modify their payload. Therefore, I want to be sure to miss as few advertisements as possible.

I currently monitor the scan output via bluetoothctl and wireshark. My beacon is broadcasting every 10 seconds, 2 messages on each of the 3 channels.

The goal is to catch both messages at least once on one of the channels.

Currently I face gaps of up to 20 or 30 seconds without successfully receiving anything.

What I do:

bluetoouthctl , turning "scan on"

wireshark, listening on bluetooth respective bluetooth device

I noticed the following behaviour after looking into "btmgmt":

hci1 type 7 discovering on
hci1 type 7 discovering off
hci1 type 7 discovering on
hci1 type 7 discovering off
hci1 type 7 discovering on
hci1 type 7 discovering off
hci1 type 7 discovering on
[mgmt]# 

I changed nothing on the scan intervall or window. It seems like discovery is turned on and off in the following manner: 10 seconds on 5 seconds off.

This means, there is always a timeframe of 5 seconds where I'm basically blind.

Any idea how I could change this behaviour?

Best,

0

Bluez utils are using MGMT kernel interface (not HCI) and this interface is simple, implements some logic under the hood and cannot provide the same functionality as HCI (i.e.: cannot run continuous passive scan).

Scan (discovery) initiated using kernel MGMT interface works only for 10s (defined in bluetooth Kernel module). Then Bluez is informed about end of scan and Bluez restarts scan (immediately if discovery filters are set, or after 5 seconds otherwise)

Solutions:

  • use HCI interface (command hcitool lescan works ok - use it source code as reference or find ready libraries)
  • modify bluetooth kernel module, set any discoveryFilter using Bluez (i.e.: RSSI -127).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.