diff options
-rw-r--r-- | include/net/bluetooth/hci.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 7 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 16 |
3 files changed, 24 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index ce757303dc07..a6ea156dc7e9 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -186,6 +186,7 @@ enum { | |||
186 | HCI_MGMT_UNCONF_INDEX_EVENTS, | 186 | HCI_MGMT_UNCONF_INDEX_EVENTS, |
187 | HCI_MGMT_EXT_INDEX_EVENTS, | 187 | HCI_MGMT_EXT_INDEX_EVENTS, |
188 | HCI_MGMT_GENERIC_EVENTS, | 188 | HCI_MGMT_GENERIC_EVENTS, |
189 | HCI_MGMT_OOB_DATA_EVENTS, | ||
189 | }; | 190 | }; |
190 | 191 | ||
191 | /* | 192 | /* |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 543c1ba3d892..a1a68671bf88 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -735,3 +735,10 @@ struct mgmt_ev_ext_index { | |||
735 | #define MGMT_EV_EXT_INDEX_ADDED 0x0020 | 735 | #define MGMT_EV_EXT_INDEX_ADDED 0x0020 |
736 | 736 | ||
737 | #define MGMT_EV_EXT_INDEX_REMOVED 0x0021 | 737 | #define MGMT_EV_EXT_INDEX_REMOVED 0x0021 |
738 | |||
739 | #define MGMT_EV_LOCAL_OOB_DATA_UPDATED 0x0022 | ||
740 | struct mgmt_ev_local_oob_data_updated { | ||
741 | __u8 type; | ||
742 | __le16 eir_len; | ||
743 | __u8 eir[0]; | ||
744 | } __packed; | ||
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 | ||
266 | static 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 | |||
265 | static int mgmt_generic_event(u16 event, struct hci_dev *hdev, void *data, | 273 | static 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 | ||
6393 | done: | 6409 | done: |
6394 | kfree(rp); | 6410 | kfree(rp); |