aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-03-16 19:11:21 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-17 02:16:48 -0400
commit72000df2c01d6927319ad7e3f43460f6d0227de5 (patch)
treef7639b65edcac4187963cf9db1eb8e661369bd88 /net/bluetooth
parent5425f98e863ac5e4798a186475d4a8d95a2c08e8 (diff)
Bluetooth: Add support for Local OOB Extended Data Update events
When a different user requests a new set of local out-of-band data, then inform all previous users that the data has been updated. To limit the scope of users, the updates are limited to previous users. If a user has never requested out-of-band data, it will also not see the update. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7fa3c4b8384b..72e41d29e301 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -133,6 +133,7 @@ static const u16 mgmt_events[] = {
133 MGMT_EV_NEW_CONFIG_OPTIONS, 133 MGMT_EV_NEW_CONFIG_OPTIONS,
134 MGMT_EV_EXT_INDEX_ADDED, 134 MGMT_EV_EXT_INDEX_ADDED,
135 MGMT_EV_EXT_INDEX_REMOVED, 135 MGMT_EV_EXT_INDEX_REMOVED,
136 MGMT_EV_LOCAL_OOB_DATA_UPDATED,
136}; 137};
137 138
138#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000) 139#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
@@ -262,6 +263,13 @@ static int mgmt_index_event(u16 event, struct hci_dev *hdev, void *data,
262 flag, NULL); 263 flag, NULL);
263} 264}
264 265
266static int mgmt_limited_event(u16 event, struct hci_dev *hdev, void *data,
267 u16 len, int flag, struct sock *skip_sk)
268{
269 return mgmt_send_event(event, hdev, HCI_CHANNEL_CONTROL, data, len,
270 flag, skip_sk);
271}
272
265static int mgmt_generic_event(u16 event, struct hci_dev *hdev, void *data, 273static int mgmt_generic_event(u16 event, struct hci_dev *hdev, void *data,
266 u16 len, struct sock *skip_sk) 274 u16 len, struct sock *skip_sk)
267{ 275{
@@ -6387,8 +6395,16 @@ static int read_local_oob_ext_data(struct sock *sk, struct hci_dev *hdev,
6387 6395
6388 hci_dev_unlock(hdev); 6396 hci_dev_unlock(hdev);
6389 6397
6398 hci_sock_set_flag(sk, HCI_MGMT_OOB_DATA_EVENTS);
6399
6390 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_EXT_DATA, 6400 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_LOCAL_OOB_EXT_DATA,
6391 MGMT_STATUS_SUCCESS, rp, sizeof(*rp) + eir_len); 6401 MGMT_STATUS_SUCCESS, rp, sizeof(*rp) + eir_len);
6402 if (err < 0)
6403 goto done;
6404
6405 err = mgmt_limited_event(MGMT_EV_LOCAL_OOB_DATA_UPDATED, hdev,
6406 rp, sizeof(*rp) + eir_len,
6407 HCI_MGMT_OOB_DATA_EVENTS, sk);
6392 6408
6393done: 6409done:
6394 kfree(rp); 6410 kfree(rp);