]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: Merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 25 Mar 2014 08:51:52 +0000 (10:51 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 26 Mar 2014 16:31:38 +0000 (09:31 -0700)
commit1c612be2c0d2c53280c850f47a131800f7f58cd1
tree888d8c7c40aaabee58f82c5bd8a09ede666c7585
parent059180c8f7ce4e4b155a0b40627fc15637f63208
Bluetooth: Merge ADV_IND/ADV_SCAN_IND and SCAN_RSP together

To avoid too many events being sent to user space and to help parsing of
all available remote device data it makes sense for us to wait for the
scan response and send a single merged Device Found event to user space.

This patch adds a few new variables to hci_dev to track the last
received ADV_IND/ADV_SCAN_IND, i.e. those which will cause a SCAN_REQ to
be send in the case of active scanning. When the SCAN_RSP is received
the pending data is passed together with the SCAN_RSP to the
mgmt_device_found function which takes care of merging them into a
single Device Found event.

We also need a bit of extra logic to handle situations where we don't
receive a SCAN_RSP after caching some data. In such a scenario we simply
have to send out the pending data as it is and then operate on the new
report as if there was no pending data.

We also need to send out any pending data when scanning stops as
well as ensure that the storage is empty at the start of a new active
scanning session. These both cases are covered by the update to the
hci_cc_le_set_scan_enable function in this patch.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c