xref: /openbmc/linux/include/net/bluetooth/mgmt.h (revision a72b9869)
1 /*
2    BlueZ - Bluetooth protocol stack for Linux
3 
4    Copyright (C) 2010  Nokia Corporation
5    Copyright (C) 2011-2012  Intel Corporation
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License version 2 as
9    published by the Free Software Foundation;
10 
11    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 
20    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22    SOFTWARE IS DISCLAIMED.
23 */
24 
25 #define MGMT_INDEX_NONE			0xFFFF
26 
27 #define MGMT_STATUS_SUCCESS		0x00
28 #define MGMT_STATUS_UNKNOWN_COMMAND	0x01
29 #define MGMT_STATUS_NOT_CONNECTED	0x02
30 #define MGMT_STATUS_FAILED		0x03
31 #define MGMT_STATUS_CONNECT_FAILED	0x04
32 #define MGMT_STATUS_AUTH_FAILED		0x05
33 #define MGMT_STATUS_NOT_PAIRED		0x06
34 #define MGMT_STATUS_NO_RESOURCES	0x07
35 #define MGMT_STATUS_TIMEOUT		0x08
36 #define MGMT_STATUS_ALREADY_CONNECTED	0x09
37 #define MGMT_STATUS_BUSY		0x0a
38 #define MGMT_STATUS_REJECTED		0x0b
39 #define MGMT_STATUS_NOT_SUPPORTED	0x0c
40 #define MGMT_STATUS_INVALID_PARAMS	0x0d
41 #define MGMT_STATUS_DISCONNECTED	0x0e
42 #define MGMT_STATUS_NOT_POWERED		0x0f
43 #define MGMT_STATUS_CANCELLED		0x10
44 #define MGMT_STATUS_INVALID_INDEX	0x11
45 #define MGMT_STATUS_RFKILLED		0x12
46 #define MGMT_STATUS_ALREADY_PAIRED	0x13
47 #define MGMT_STATUS_PERMISSION_DENIED	0x14
48 
49 struct mgmt_hdr {
50 	__le16	opcode;
51 	__le16	index;
52 	__le16	len;
53 } __packed;
54 
55 struct mgmt_tlv {
56 	__le16 type;
57 	__u8   length;
58 	__u8   value[];
59 } __packed;
60 
61 struct mgmt_addr_info {
62 	bdaddr_t	bdaddr;
63 	__u8		type;
64 } __packed;
65 #define MGMT_ADDR_INFO_SIZE		7
66 
67 #define MGMT_OP_READ_VERSION		0x0001
68 #define MGMT_READ_VERSION_SIZE		0
69 struct mgmt_rp_read_version {
70 	__u8	version;
71 	__le16	revision;
72 } __packed;
73 
74 #define MGMT_OP_READ_COMMANDS		0x0002
75 #define MGMT_READ_COMMANDS_SIZE		0
76 struct mgmt_rp_read_commands {
77 	__le16	num_commands;
78 	__le16	num_events;
79 	__le16	opcodes[];
80 } __packed;
81 
82 #define MGMT_OP_READ_INDEX_LIST		0x0003
83 #define MGMT_READ_INDEX_LIST_SIZE	0
84 struct mgmt_rp_read_index_list {
85 	__le16	num_controllers;
86 	__le16	index[];
87 } __packed;
88 
89 /* Reserve one extra byte for names in management messages so that they
90  * are always guaranteed to be nul-terminated */
91 #define MGMT_MAX_NAME_LENGTH		(HCI_MAX_NAME_LENGTH + 1)
92 #define MGMT_MAX_SHORT_NAME_LENGTH	(HCI_MAX_SHORT_NAME_LENGTH + 1)
93 
94 #define MGMT_SETTING_POWERED		0x00000001
95 #define MGMT_SETTING_CONNECTABLE	0x00000002
96 #define MGMT_SETTING_FAST_CONNECTABLE	0x00000004
97 #define MGMT_SETTING_DISCOVERABLE	0x00000008
98 #define MGMT_SETTING_BONDABLE		0x00000010
99 #define MGMT_SETTING_LINK_SECURITY	0x00000020
100 #define MGMT_SETTING_SSP		0x00000040
101 #define MGMT_SETTING_BREDR		0x00000080
102 #define MGMT_SETTING_HS			0x00000100
103 #define MGMT_SETTING_LE			0x00000200
104 #define MGMT_SETTING_ADVERTISING	0x00000400
105 #define MGMT_SETTING_SECURE_CONN	0x00000800
106 #define MGMT_SETTING_DEBUG_KEYS		0x00001000
107 #define MGMT_SETTING_PRIVACY		0x00002000
108 #define MGMT_SETTING_CONFIGURATION	0x00004000
109 #define MGMT_SETTING_STATIC_ADDRESS	0x00008000
110 #define MGMT_SETTING_PHY_CONFIGURATION	0x00010000
111 #define MGMT_SETTING_WIDEBAND_SPEECH	0x00020000
112 #define MGMT_SETTING_CIS_CENTRAL	0x00040000
113 #define MGMT_SETTING_CIS_PERIPHERAL	0x00080000
114 
115 #define MGMT_OP_READ_INFO		0x0004
116 #define MGMT_READ_INFO_SIZE		0
117 struct mgmt_rp_read_info {
118 	bdaddr_t	bdaddr;
119 	__u8		version;
120 	__le16		manufacturer;
121 	__le32		supported_settings;
122 	__le32		current_settings;
123 	__u8		dev_class[3];
124 	__u8		name[MGMT_MAX_NAME_LENGTH];
125 	__u8		short_name[MGMT_MAX_SHORT_NAME_LENGTH];
126 } __packed;
127 
128 struct mgmt_mode {
129 	__u8 val;
130 } __packed;
131 
132 #define MGMT_SETTING_SIZE		1
133 
134 #define MGMT_OP_SET_POWERED		0x0005
135 
136 #define MGMT_OP_SET_DISCOVERABLE	0x0006
137 struct mgmt_cp_set_discoverable {
138 	__u8	val;
139 	__le16	timeout;
140 } __packed;
141 #define MGMT_SET_DISCOVERABLE_SIZE	3
142 
143 #define MGMT_OP_SET_CONNECTABLE		0x0007
144 
145 #define MGMT_OP_SET_FAST_CONNECTABLE	0x0008
146 
147 #define MGMT_OP_SET_BONDABLE		0x0009
148 
149 #define MGMT_OP_SET_LINK_SECURITY	0x000A
150 
151 #define MGMT_OP_SET_SSP			0x000B
152 
153 #define MGMT_OP_SET_HS			0x000C
154 
155 #define MGMT_OP_SET_LE			0x000D
156 #define MGMT_OP_SET_DEV_CLASS		0x000E
157 struct mgmt_cp_set_dev_class {
158 	__u8	major;
159 	__u8	minor;
160 } __packed;
161 #define MGMT_SET_DEV_CLASS_SIZE		2
162 
163 #define MGMT_OP_SET_LOCAL_NAME		0x000F
164 struct mgmt_cp_set_local_name {
165 	__u8	name[MGMT_MAX_NAME_LENGTH];
166 	__u8	short_name[MGMT_MAX_SHORT_NAME_LENGTH];
167 } __packed;
168 #define MGMT_SET_LOCAL_NAME_SIZE	260
169 
170 #define MGMT_OP_ADD_UUID		0x0010
171 struct mgmt_cp_add_uuid {
172 	__u8	uuid[16];
173 	__u8	svc_hint;
174 } __packed;
175 #define MGMT_ADD_UUID_SIZE		17
176 
177 #define MGMT_OP_REMOVE_UUID		0x0011
178 struct mgmt_cp_remove_uuid {
179 	__u8	uuid[16];
180 } __packed;
181 #define MGMT_REMOVE_UUID_SIZE		16
182 
183 struct mgmt_link_key_info {
184 	struct mgmt_addr_info addr;
185 	__u8	type;
186 	__u8	val[16];
187 	__u8	pin_len;
188 } __packed;
189 
190 #define MGMT_OP_LOAD_LINK_KEYS		0x0012
191 struct mgmt_cp_load_link_keys {
192 	__u8	debug_keys;
193 	__le16	key_count;
194 	struct	mgmt_link_key_info keys[];
195 } __packed;
196 #define MGMT_LOAD_LINK_KEYS_SIZE	3
197 
198 #define MGMT_LTK_UNAUTHENTICATED	0x00
199 #define MGMT_LTK_AUTHENTICATED		0x01
200 #define MGMT_LTK_P256_UNAUTH		0x02
201 #define MGMT_LTK_P256_AUTH		0x03
202 #define MGMT_LTK_P256_DEBUG		0x04
203 
204 struct mgmt_ltk_info {
205 	struct mgmt_addr_info addr;
206 	__u8	type;
207 	__u8	initiator;
208 	__u8	enc_size;
209 	__le16	ediv;
210 	__le64	rand;
211 	__u8	val[16];
212 } __packed;
213 
214 #define MGMT_OP_LOAD_LONG_TERM_KEYS	0x0013
215 struct mgmt_cp_load_long_term_keys {
216 	__le16	key_count;
217 	struct	mgmt_ltk_info keys[];
218 } __packed;
219 #define MGMT_LOAD_LONG_TERM_KEYS_SIZE	2
220 
221 #define MGMT_OP_DISCONNECT		0x0014
222 struct mgmt_cp_disconnect {
223 	struct mgmt_addr_info addr;
224 } __packed;
225 #define MGMT_DISCONNECT_SIZE		MGMT_ADDR_INFO_SIZE
226 struct mgmt_rp_disconnect {
227 	struct mgmt_addr_info addr;
228 } __packed;
229 
230 #define MGMT_OP_GET_CONNECTIONS		0x0015
231 #define MGMT_GET_CONNECTIONS_SIZE	0
232 struct mgmt_rp_get_connections {
233 	__le16 conn_count;
234 	struct mgmt_addr_info addr[];
235 } __packed;
236 
237 #define MGMT_OP_PIN_CODE_REPLY		0x0016
238 struct mgmt_cp_pin_code_reply {
239 	struct mgmt_addr_info addr;
240 	__u8	pin_len;
241 	__u8	pin_code[16];
242 } __packed;
243 #define MGMT_PIN_CODE_REPLY_SIZE	(MGMT_ADDR_INFO_SIZE + 17)
244 struct mgmt_rp_pin_code_reply {
245 	struct mgmt_addr_info addr;
246 } __packed;
247 
248 #define MGMT_OP_PIN_CODE_NEG_REPLY	0x0017
249 struct mgmt_cp_pin_code_neg_reply {
250 	struct mgmt_addr_info addr;
251 } __packed;
252 #define MGMT_PIN_CODE_NEG_REPLY_SIZE	MGMT_ADDR_INFO_SIZE
253 
254 #define MGMT_OP_SET_IO_CAPABILITY	0x0018
255 struct mgmt_cp_set_io_capability {
256 	__u8	io_capability;
257 } __packed;
258 #define MGMT_SET_IO_CAPABILITY_SIZE	1
259 
260 #define MGMT_OP_PAIR_DEVICE		0x0019
261 struct mgmt_cp_pair_device {
262 	struct mgmt_addr_info addr;
263 	__u8	io_cap;
264 } __packed;
265 #define MGMT_PAIR_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
266 struct mgmt_rp_pair_device {
267 	struct mgmt_addr_info addr;
268 } __packed;
269 
270 #define MGMT_OP_CANCEL_PAIR_DEVICE	0x001A
271 #define MGMT_CANCEL_PAIR_DEVICE_SIZE	MGMT_ADDR_INFO_SIZE
272 
273 #define MGMT_OP_UNPAIR_DEVICE		0x001B
274 struct mgmt_cp_unpair_device {
275 	struct mgmt_addr_info addr;
276 	__u8 disconnect;
277 } __packed;
278 #define MGMT_UNPAIR_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
279 struct mgmt_rp_unpair_device {
280 	struct mgmt_addr_info addr;
281 };
282 
283 #define MGMT_OP_USER_CONFIRM_REPLY	0x001C
284 struct mgmt_cp_user_confirm_reply {
285 	struct mgmt_addr_info addr;
286 } __packed;
287 #define MGMT_USER_CONFIRM_REPLY_SIZE	MGMT_ADDR_INFO_SIZE
288 struct mgmt_rp_user_confirm_reply {
289 	struct mgmt_addr_info addr;
290 } __packed;
291 
292 #define MGMT_OP_USER_CONFIRM_NEG_REPLY	0x001D
293 struct mgmt_cp_user_confirm_neg_reply {
294 	struct mgmt_addr_info addr;
295 } __packed;
296 #define MGMT_USER_CONFIRM_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
297 
298 #define MGMT_OP_USER_PASSKEY_REPLY	0x001E
299 struct mgmt_cp_user_passkey_reply {
300 	struct mgmt_addr_info addr;
301 	__le32	passkey;
302 } __packed;
303 #define MGMT_USER_PASSKEY_REPLY_SIZE	(MGMT_ADDR_INFO_SIZE + 4)
304 struct mgmt_rp_user_passkey_reply {
305 	struct mgmt_addr_info addr;
306 } __packed;
307 
308 #define MGMT_OP_USER_PASSKEY_NEG_REPLY	0x001F
309 struct mgmt_cp_user_passkey_neg_reply {
310 	struct mgmt_addr_info addr;
311 } __packed;
312 #define MGMT_USER_PASSKEY_NEG_REPLY_SIZE MGMT_ADDR_INFO_SIZE
313 
314 #define MGMT_OP_READ_LOCAL_OOB_DATA	0x0020
315 #define MGMT_READ_LOCAL_OOB_DATA_SIZE	0
316 struct mgmt_rp_read_local_oob_data {
317 	__u8	hash192[16];
318 	__u8	rand192[16];
319 	__u8	hash256[16];
320 	__u8	rand256[16];
321 } __packed;
322 
323 #define MGMT_OP_ADD_REMOTE_OOB_DATA	0x0021
324 struct mgmt_cp_add_remote_oob_data {
325 	struct mgmt_addr_info addr;
326 	__u8	hash[16];
327 	__u8	rand[16];
328 } __packed;
329 #define MGMT_ADD_REMOTE_OOB_DATA_SIZE	(MGMT_ADDR_INFO_SIZE + 32)
330 struct mgmt_cp_add_remote_oob_ext_data {
331 	struct mgmt_addr_info addr;
332 	__u8	hash192[16];
333 	__u8	rand192[16];
334 	__u8	hash256[16];
335 	__u8	rand256[16];
336 } __packed;
337 #define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
338 
339 #define MGMT_OP_REMOVE_REMOTE_OOB_DATA	0x0022
340 struct mgmt_cp_remove_remote_oob_data {
341 	struct mgmt_addr_info addr;
342 } __packed;
343 #define MGMT_REMOVE_REMOTE_OOB_DATA_SIZE MGMT_ADDR_INFO_SIZE
344 
345 #define MGMT_OP_START_DISCOVERY		0x0023
346 struct mgmt_cp_start_discovery {
347 	__u8 type;
348 } __packed;
349 #define MGMT_START_DISCOVERY_SIZE	1
350 
351 #define MGMT_OP_STOP_DISCOVERY		0x0024
352 struct mgmt_cp_stop_discovery {
353 	__u8 type;
354 } __packed;
355 #define MGMT_STOP_DISCOVERY_SIZE	1
356 
357 #define MGMT_OP_CONFIRM_NAME		0x0025
358 struct mgmt_cp_confirm_name {
359 	struct mgmt_addr_info addr;
360 	__u8	name_known;
361 } __packed;
362 #define MGMT_CONFIRM_NAME_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
363 struct mgmt_rp_confirm_name {
364 	struct mgmt_addr_info addr;
365 } __packed;
366 
367 #define MGMT_OP_BLOCK_DEVICE		0x0026
368 struct mgmt_cp_block_device {
369 	struct mgmt_addr_info addr;
370 } __packed;
371 #define MGMT_BLOCK_DEVICE_SIZE		MGMT_ADDR_INFO_SIZE
372 
373 #define MGMT_OP_UNBLOCK_DEVICE		0x0027
374 struct mgmt_cp_unblock_device {
375 	struct mgmt_addr_info addr;
376 } __packed;
377 #define MGMT_UNBLOCK_DEVICE_SIZE	MGMT_ADDR_INFO_SIZE
378 
379 #define MGMT_OP_SET_DEVICE_ID		0x0028
380 struct mgmt_cp_set_device_id {
381 	__le16	source;
382 	__le16	vendor;
383 	__le16	product;
384 	__le16	version;
385 } __packed;
386 #define MGMT_SET_DEVICE_ID_SIZE		8
387 
388 #define MGMT_OP_SET_ADVERTISING		0x0029
389 
390 #define MGMT_OP_SET_BREDR		0x002A
391 
392 #define MGMT_OP_SET_STATIC_ADDRESS	0x002B
393 struct mgmt_cp_set_static_address {
394 	bdaddr_t bdaddr;
395 } __packed;
396 #define MGMT_SET_STATIC_ADDRESS_SIZE	6
397 
398 #define MGMT_OP_SET_SCAN_PARAMS		0x002C
399 struct mgmt_cp_set_scan_params {
400 	__le16	interval;
401 	__le16	window;
402 } __packed;
403 #define MGMT_SET_SCAN_PARAMS_SIZE	4
404 
405 #define MGMT_OP_SET_SECURE_CONN		0x002D
406 
407 #define MGMT_OP_SET_DEBUG_KEYS		0x002E
408 
409 #define MGMT_OP_SET_PRIVACY		0x002F
410 struct mgmt_cp_set_privacy {
411 	__u8 privacy;
412 	__u8 irk[16];
413 } __packed;
414 #define MGMT_SET_PRIVACY_SIZE		17
415 
416 struct mgmt_irk_info {
417 	struct mgmt_addr_info addr;
418 	__u8 val[16];
419 } __packed;
420 
421 #define MGMT_OP_LOAD_IRKS		0x0030
422 struct mgmt_cp_load_irks {
423 	__le16 irk_count;
424 	struct mgmt_irk_info irks[];
425 } __packed;
426 #define MGMT_LOAD_IRKS_SIZE		2
427 
428 #define MGMT_OP_GET_CONN_INFO		0x0031
429 struct mgmt_cp_get_conn_info {
430 	struct mgmt_addr_info addr;
431 } __packed;
432 #define MGMT_GET_CONN_INFO_SIZE		MGMT_ADDR_INFO_SIZE
433 struct mgmt_rp_get_conn_info {
434 	struct mgmt_addr_info addr;
435 	__s8	rssi;
436 	__s8	tx_power;
437 	__s8	max_tx_power;
438 } __packed;
439 
440 #define MGMT_OP_GET_CLOCK_INFO		0x0032
441 struct mgmt_cp_get_clock_info {
442 	struct mgmt_addr_info addr;
443 } __packed;
444 #define MGMT_GET_CLOCK_INFO_SIZE	MGMT_ADDR_INFO_SIZE
445 struct mgmt_rp_get_clock_info {
446 	struct mgmt_addr_info addr;
447 	__le32  local_clock;
448 	__le32  piconet_clock;
449 	__le16  accuracy;
450 } __packed;
451 
452 #define MGMT_OP_ADD_DEVICE		0x0033
453 struct mgmt_cp_add_device {
454 	struct mgmt_addr_info addr;
455 	__u8	action;
456 } __packed;
457 #define MGMT_ADD_DEVICE_SIZE		(MGMT_ADDR_INFO_SIZE + 1)
458 
459 #define MGMT_OP_REMOVE_DEVICE		0x0034
460 struct mgmt_cp_remove_device {
461 	struct mgmt_addr_info addr;
462 } __packed;
463 #define MGMT_REMOVE_DEVICE_SIZE		MGMT_ADDR_INFO_SIZE
464 
465 struct mgmt_conn_param {
466 	struct mgmt_addr_info addr;
467 	__le16 min_interval;
468 	__le16 max_interval;
469 	__le16 latency;
470 	__le16 timeout;
471 } __packed;
472 
473 #define MGMT_OP_LOAD_CONN_PARAM		0x0035
474 struct mgmt_cp_load_conn_param {
475 	__le16 param_count;
476 	struct mgmt_conn_param params[];
477 } __packed;
478 #define MGMT_LOAD_CONN_PARAM_SIZE	2
479 
480 #define MGMT_OP_READ_UNCONF_INDEX_LIST	0x0036
481 #define MGMT_READ_UNCONF_INDEX_LIST_SIZE 0
482 struct mgmt_rp_read_unconf_index_list {
483 	__le16	num_controllers;
484 	__le16	index[];
485 } __packed;
486 
487 #define MGMT_OPTION_EXTERNAL_CONFIG	0x00000001
488 #define MGMT_OPTION_PUBLIC_ADDRESS	0x00000002
489 
490 #define MGMT_OP_READ_CONFIG_INFO	0x0037
491 #define MGMT_READ_CONFIG_INFO_SIZE	0
492 struct mgmt_rp_read_config_info {
493 	__le16	manufacturer;
494 	__le32	supported_options;
495 	__le32	missing_options;
496 } __packed;
497 
498 #define MGMT_OP_SET_EXTERNAL_CONFIG	0x0038
499 struct mgmt_cp_set_external_config {
500 	__u8 config;
501 } __packed;
502 #define MGMT_SET_EXTERNAL_CONFIG_SIZE	1
503 
504 #define MGMT_OP_SET_PUBLIC_ADDRESS	0x0039
505 struct mgmt_cp_set_public_address {
506 	bdaddr_t bdaddr;
507 } __packed;
508 #define MGMT_SET_PUBLIC_ADDRESS_SIZE	6
509 
510 #define MGMT_OP_START_SERVICE_DISCOVERY	0x003A
511 struct mgmt_cp_start_service_discovery {
512 	__u8 type;
513 	__s8 rssi;
514 	__le16 uuid_count;
515 	__u8 uuids[][16];
516 } __packed;
517 #define MGMT_START_SERVICE_DISCOVERY_SIZE 4
518 
519 #define MGMT_OP_READ_LOCAL_OOB_EXT_DATA	0x003B
520 struct mgmt_cp_read_local_oob_ext_data {
521 	__u8 type;
522 } __packed;
523 #define MGMT_READ_LOCAL_OOB_EXT_DATA_SIZE 1
524 struct mgmt_rp_read_local_oob_ext_data {
525 	__u8    type;
526 	__le16	eir_len;
527 	__u8	eir[];
528 } __packed;
529 
530 #define MGMT_OP_READ_EXT_INDEX_LIST	0x003C
531 #define MGMT_READ_EXT_INDEX_LIST_SIZE	0
532 struct mgmt_rp_read_ext_index_list {
533 	__le16	num_controllers;
534 	struct {
535 		__le16 index;
536 		__u8   type;
537 		__u8   bus;
538 	} entry[];
539 } __packed;
540 
541 #define MGMT_OP_READ_ADV_FEATURES	0x0003D
542 #define MGMT_READ_ADV_FEATURES_SIZE	0
543 struct mgmt_rp_read_adv_features {
544 	__le32 supported_flags;
545 	__u8   max_adv_data_len;
546 	__u8   max_scan_rsp_len;
547 	__u8   max_instances;
548 	__u8   num_instances;
549 	__u8   instance[];
550 } __packed;
551 
552 #define MGMT_OP_ADD_ADVERTISING		0x003E
553 struct mgmt_cp_add_advertising {
554 	__u8	instance;
555 	__le32	flags;
556 	__le16	duration;
557 	__le16	timeout;
558 	__u8	adv_data_len;
559 	__u8	scan_rsp_len;
560 	__u8	data[];
561 } __packed;
562 #define MGMT_ADD_ADVERTISING_SIZE	11
563 struct mgmt_rp_add_advertising {
564 	__u8	instance;
565 } __packed;
566 
567 #define MGMT_ADV_FLAG_CONNECTABLE	BIT(0)
568 #define MGMT_ADV_FLAG_DISCOV		BIT(1)
569 #define MGMT_ADV_FLAG_LIMITED_DISCOV	BIT(2)
570 #define MGMT_ADV_FLAG_MANAGED_FLAGS	BIT(3)
571 #define MGMT_ADV_FLAG_TX_POWER		BIT(4)
572 #define MGMT_ADV_FLAG_APPEARANCE	BIT(5)
573 #define MGMT_ADV_FLAG_LOCAL_NAME	BIT(6)
574 #define MGMT_ADV_FLAG_SEC_1M 		BIT(7)
575 #define MGMT_ADV_FLAG_SEC_2M 		BIT(8)
576 #define MGMT_ADV_FLAG_SEC_CODED 	BIT(9)
577 #define MGMT_ADV_FLAG_CAN_SET_TX_POWER	BIT(10)
578 #define MGMT_ADV_FLAG_HW_OFFLOAD	BIT(11)
579 #define MGMT_ADV_PARAM_DURATION		BIT(12)
580 #define MGMT_ADV_PARAM_TIMEOUT		BIT(13)
581 #define MGMT_ADV_PARAM_INTERVALS	BIT(14)
582 #define MGMT_ADV_PARAM_TX_POWER		BIT(15)
583 #define MGMT_ADV_PARAM_SCAN_RSP		BIT(16)
584 
585 #define MGMT_ADV_FLAG_SEC_MASK	(MGMT_ADV_FLAG_SEC_1M | MGMT_ADV_FLAG_SEC_2M | \
586 				 MGMT_ADV_FLAG_SEC_CODED)
587 
588 #define MGMT_OP_REMOVE_ADVERTISING	0x003F
589 struct mgmt_cp_remove_advertising {
590 	__u8	instance;
591 } __packed;
592 #define MGMT_REMOVE_ADVERTISING_SIZE	1
593 struct mgmt_rp_remove_advertising {
594 	__u8	instance;
595 } __packed;
596 
597 #define MGMT_OP_GET_ADV_SIZE_INFO	0x0040
598 struct mgmt_cp_get_adv_size_info {
599 	__u8	instance;
600 	__le32	flags;
601 } __packed;
602 #define MGMT_GET_ADV_SIZE_INFO_SIZE	5
603 struct mgmt_rp_get_adv_size_info {
604 	__u8	instance;
605 	__le32	flags;
606 	__u8	max_adv_data_len;
607 	__u8	max_scan_rsp_len;
608 } __packed;
609 
610 #define MGMT_OP_START_LIMITED_DISCOVERY	0x0041
611 
612 #define MGMT_OP_READ_EXT_INFO		0x0042
613 #define MGMT_READ_EXT_INFO_SIZE		0
614 struct mgmt_rp_read_ext_info {
615 	bdaddr_t bdaddr;
616 	__u8     version;
617 	__le16   manufacturer;
618 	__le32   supported_settings;
619 	__le32   current_settings;
620 	__le16   eir_len;
621 	__u8     eir[];
622 } __packed;
623 
624 #define MGMT_OP_SET_APPEARANCE		0x0043
625 struct mgmt_cp_set_appearance {
626 	__le16	appearance;
627 } __packed;
628 #define MGMT_SET_APPEARANCE_SIZE	2
629 
630 #define MGMT_OP_GET_PHY_CONFIGURATION	0x0044
631 struct mgmt_rp_get_phy_configuration {
632 	__le32	supported_phys;
633 	__le32	configurable_phys;
634 	__le32	selected_phys;
635 } __packed;
636 #define MGMT_GET_PHY_CONFIGURATION_SIZE	0
637 
638 #define MGMT_PHY_BR_1M_1SLOT	0x00000001
639 #define MGMT_PHY_BR_1M_3SLOT	0x00000002
640 #define MGMT_PHY_BR_1M_5SLOT	0x00000004
641 #define MGMT_PHY_EDR_2M_1SLOT	0x00000008
642 #define MGMT_PHY_EDR_2M_3SLOT	0x00000010
643 #define MGMT_PHY_EDR_2M_5SLOT	0x00000020
644 #define MGMT_PHY_EDR_3M_1SLOT	0x00000040
645 #define MGMT_PHY_EDR_3M_3SLOT	0x00000080
646 #define MGMT_PHY_EDR_3M_5SLOT	0x00000100
647 #define MGMT_PHY_LE_1M_TX		0x00000200
648 #define MGMT_PHY_LE_1M_RX		0x00000400
649 #define MGMT_PHY_LE_2M_TX		0x00000800
650 #define MGMT_PHY_LE_2M_RX		0x00001000
651 #define MGMT_PHY_LE_CODED_TX	0x00002000
652 #define MGMT_PHY_LE_CODED_RX	0x00004000
653 
654 #define MGMT_PHY_BREDR_MASK (MGMT_PHY_BR_1M_1SLOT | MGMT_PHY_BR_1M_3SLOT | \
655 			     MGMT_PHY_BR_1M_5SLOT | MGMT_PHY_EDR_2M_1SLOT | \
656 			     MGMT_PHY_EDR_2M_3SLOT | MGMT_PHY_EDR_2M_5SLOT | \
657 			     MGMT_PHY_EDR_3M_1SLOT | MGMT_PHY_EDR_3M_3SLOT | \
658 			     MGMT_PHY_EDR_3M_5SLOT)
659 #define MGMT_PHY_LE_MASK (MGMT_PHY_LE_1M_TX | MGMT_PHY_LE_1M_RX | \
660 			  MGMT_PHY_LE_2M_TX | MGMT_PHY_LE_2M_RX | \
661 			  MGMT_PHY_LE_CODED_TX | MGMT_PHY_LE_CODED_RX)
662 #define MGMT_PHY_LE_TX_MASK (MGMT_PHY_LE_1M_TX | MGMT_PHY_LE_2M_TX | \
663 			     MGMT_PHY_LE_CODED_TX)
664 #define MGMT_PHY_LE_RX_MASK (MGMT_PHY_LE_1M_RX | MGMT_PHY_LE_2M_RX | \
665 			     MGMT_PHY_LE_CODED_RX)
666 
667 #define MGMT_OP_SET_PHY_CONFIGURATION	0x0045
668 struct mgmt_cp_set_phy_configuration {
669 	__le32	selected_phys;
670 } __packed;
671 #define MGMT_SET_PHY_CONFIGURATION_SIZE	4
672 
673 #define MGMT_OP_SET_BLOCKED_KEYS	0x0046
674 
675 #define HCI_BLOCKED_KEY_TYPE_LINKKEY	0x00
676 #define HCI_BLOCKED_KEY_TYPE_LTK	0x01
677 #define HCI_BLOCKED_KEY_TYPE_IRK	0x02
678 
679 struct mgmt_blocked_key_info {
680 	__u8 type;
681 	__u8 val[16];
682 } __packed;
683 
684 struct mgmt_cp_set_blocked_keys {
685 	__le16 key_count;
686 	struct mgmt_blocked_key_info keys[];
687 } __packed;
688 #define MGMT_OP_SET_BLOCKED_KEYS_SIZE 2
689 
690 #define MGMT_OP_SET_WIDEBAND_SPEECH	0x0047
691 
692 #define MGMT_CAP_SEC_FLAGS		0x01
693 #define MGMT_CAP_MAX_ENC_KEY_SIZE	0x02
694 #define MGMT_CAP_SMP_MAX_ENC_KEY_SIZE	0x03
695 #define MGMT_CAP_LE_TX_PWR		0x04
696 
697 #define MGMT_OP_READ_CONTROLLER_CAP	0x0048
698 #define MGMT_READ_CONTROLLER_CAP_SIZE	0
699 struct mgmt_rp_read_controller_cap {
700 	__le16   cap_len;
701 	__u8     cap[];
702 } __packed;
703 
704 #define MGMT_OP_READ_EXP_FEATURES_INFO	0x0049
705 #define MGMT_READ_EXP_FEATURES_INFO_SIZE 0
706 struct mgmt_rp_read_exp_features_info {
707 	__le16 feature_count;
708 	struct {
709 		__u8   uuid[16];
710 		__le32 flags;
711 	} features[];
712 } __packed;
713 
714 #define MGMT_OP_SET_EXP_FEATURE		0x004a
715 struct mgmt_cp_set_exp_feature {
716 	__u8   uuid[16];
717 	__u8   param[];
718 } __packed;
719 #define MGMT_SET_EXP_FEATURE_SIZE	16
720 struct mgmt_rp_set_exp_feature {
721 	__u8   uuid[16];
722 	__le32 flags;
723 } __packed;
724 
725 #define MGMT_OP_READ_DEF_SYSTEM_CONFIG	0x004b
726 #define MGMT_READ_DEF_SYSTEM_CONFIG_SIZE	0
727 
728 #define MGMT_OP_SET_DEF_SYSTEM_CONFIG	0x004c
729 #define MGMT_SET_DEF_SYSTEM_CONFIG_SIZE		0
730 
731 #define MGMT_OP_READ_DEF_RUNTIME_CONFIG	0x004d
732 #define MGMT_READ_DEF_RUNTIME_CONFIG_SIZE	0
733 
734 #define MGMT_OP_SET_DEF_RUNTIME_CONFIG	0x004e
735 #define MGMT_SET_DEF_RUNTIME_CONFIG_SIZE	0
736 
737 #define MGMT_OP_GET_DEVICE_FLAGS	0x004F
738 #define MGMT_GET_DEVICE_FLAGS_SIZE	7
739 struct mgmt_cp_get_device_flags {
740 	struct mgmt_addr_info addr;
741 } __packed;
742 struct mgmt_rp_get_device_flags {
743 	struct mgmt_addr_info addr;
744 	__le32 supported_flags;
745 	__le32 current_flags;
746 } __packed;
747 
748 #define MGMT_OP_SET_DEVICE_FLAGS	0x0050
749 #define MGMT_SET_DEVICE_FLAGS_SIZE	11
750 struct mgmt_cp_set_device_flags {
751 	struct mgmt_addr_info addr;
752 	__le32 current_flags;
753 } __packed;
754 struct mgmt_rp_set_device_flags {
755 	struct mgmt_addr_info addr;
756 } __packed;
757 
758 #define MGMT_ADV_MONITOR_FEATURE_MASK_OR_PATTERNS    BIT(0)
759 
760 #define MGMT_OP_READ_ADV_MONITOR_FEATURES	0x0051
761 #define MGMT_READ_ADV_MONITOR_FEATURES_SIZE	0
762 struct mgmt_rp_read_adv_monitor_features {
763 	__le32 supported_features;
764 	__le32 enabled_features;
765 	__le16 max_num_handles;
766 	__u8 max_num_patterns;
767 	__le16 num_handles;
768 	__le16 handles[];
769 }  __packed;
770 
771 struct mgmt_adv_pattern {
772 	__u8 ad_type;
773 	__u8 offset;
774 	__u8 length;
775 	__u8 value[31];
776 } __packed;
777 
778 #define MGMT_OP_ADD_ADV_PATTERNS_MONITOR	0x0052
779 struct mgmt_cp_add_adv_patterns_monitor {
780 	__u8 pattern_count;
781 	struct mgmt_adv_pattern patterns[];
782 } __packed;
783 #define MGMT_ADD_ADV_PATTERNS_MONITOR_SIZE	1
784 struct mgmt_rp_add_adv_patterns_monitor {
785 	__le16 monitor_handle;
786 } __packed;
787 
788 #define MGMT_OP_REMOVE_ADV_MONITOR		0x0053
789 struct mgmt_cp_remove_adv_monitor {
790 	__le16 monitor_handle;
791 } __packed;
792 #define MGMT_REMOVE_ADV_MONITOR_SIZE		2
793 struct mgmt_rp_remove_adv_monitor {
794 	__le16 monitor_handle;
795 } __packed;
796 
797 #define MGMT_OP_ADD_EXT_ADV_PARAMS		0x0054
798 struct mgmt_cp_add_ext_adv_params {
799 	__u8	instance;
800 	__le32	flags;
801 	__le16	duration;
802 	__le16	timeout;
803 	__le32	min_interval;
804 	__le32	max_interval;
805 	__s8	tx_power;
806 } __packed;
807 #define MGMT_ADD_EXT_ADV_PARAMS_MIN_SIZE	18
808 struct mgmt_rp_add_ext_adv_params {
809 	__u8	instance;
810 	__s8	tx_power;
811 	__u8	max_adv_data_len;
812 	__u8	max_scan_rsp_len;
813 } __packed;
814 
815 #define MGMT_OP_ADD_EXT_ADV_DATA		0x0055
816 struct mgmt_cp_add_ext_adv_data {
817 	__u8	instance;
818 	__u8	adv_data_len;
819 	__u8	scan_rsp_len;
820 	__u8	data[];
821 } __packed;
822 #define MGMT_ADD_EXT_ADV_DATA_SIZE	3
823 struct mgmt_rp_add_ext_adv_data {
824 	__u8	instance;
825 } __packed;
826 
827 struct mgmt_adv_rssi_thresholds {
828 	__s8	high_threshold;
829 	__le16	high_threshold_timeout;
830 	__s8	low_threshold;
831 	__le16	low_threshold_timeout;
832 	__u8	sampling_period;
833 } __packed;
834 
835 #define MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI	0x0056
836 struct mgmt_cp_add_adv_patterns_monitor_rssi {
837 	struct mgmt_adv_rssi_thresholds rssi;
838 	__u8	pattern_count;
839 	struct mgmt_adv_pattern patterns[];
840 } __packed;
841 #define MGMT_ADD_ADV_PATTERNS_MONITOR_RSSI_SIZE	8
842 #define MGMT_OP_SET_MESH_RECEIVER		0x0057
843 struct mgmt_cp_set_mesh {
844 	__u8   enable;
845 	__le16 window;
846 	__le16 period;
847 	__u8   num_ad_types;
848 	__u8   ad_types[];
849 } __packed;
850 #define MGMT_SET_MESH_RECEIVER_SIZE	6
851 
852 #define MGMT_OP_MESH_READ_FEATURES	0x0058
853 #define MGMT_MESH_READ_FEATURES_SIZE	0
854 #define MESH_HANDLES_MAX	3
855 struct mgmt_rp_mesh_read_features {
856 	__le16	index;
857 	__u8   max_handles;
858 	__u8   used_handles;
859 	__u8   handles[MESH_HANDLES_MAX];
860 } __packed;
861 
862 #define MGMT_OP_MESH_SEND		0x0059
863 struct mgmt_cp_mesh_send {
864 	struct mgmt_addr_info addr;
865 	__le64  instant;
866 	__le16  delay;
867 	__u8   cnt;
868 	__u8   adv_data_len;
869 	__u8   adv_data[];
870 } __packed;
871 #define MGMT_MESH_SEND_SIZE		19
872 
873 #define MGMT_OP_MESH_SEND_CANCEL	0x005A
874 struct mgmt_cp_mesh_send_cancel {
875 	__u8  handle;
876 } __packed;
877 #define MGMT_MESH_SEND_CANCEL_SIZE	1
878 
879 #define MGMT_EV_CMD_COMPLETE		0x0001
880 struct mgmt_ev_cmd_complete {
881 	__le16	opcode;
882 	__u8	status;
883 	__u8	data[];
884 } __packed;
885 
886 #define MGMT_EV_CMD_STATUS		0x0002
887 struct mgmt_ev_cmd_status {
888 	__le16	opcode;
889 	__u8	status;
890 } __packed;
891 
892 #define MGMT_EV_CONTROLLER_ERROR	0x0003
893 struct mgmt_ev_controller_error {
894 	__u8	error_code;
895 } __packed;
896 
897 #define MGMT_EV_INDEX_ADDED		0x0004
898 
899 #define MGMT_EV_INDEX_REMOVED		0x0005
900 
901 #define MGMT_EV_NEW_SETTINGS		0x0006
902 
903 #define MGMT_EV_CLASS_OF_DEV_CHANGED	0x0007
904 struct mgmt_ev_class_of_dev_changed {
905 	__u8	dev_class[3];
906 };
907 
908 #define MGMT_EV_LOCAL_NAME_CHANGED	0x0008
909 struct mgmt_ev_local_name_changed {
910 	__u8	name[MGMT_MAX_NAME_LENGTH];
911 	__u8	short_name[MGMT_MAX_SHORT_NAME_LENGTH];
912 } __packed;
913 
914 #define MGMT_EV_NEW_LINK_KEY		0x0009
915 struct mgmt_ev_new_link_key {
916 	__u8	store_hint;
917 	struct mgmt_link_key_info key;
918 } __packed;
919 
920 #define MGMT_EV_NEW_LONG_TERM_KEY	0x000A
921 struct mgmt_ev_new_long_term_key {
922 	__u8	store_hint;
923 	struct mgmt_ltk_info key;
924 } __packed;
925 
926 #define MGMT_EV_DEVICE_CONNECTED	0x000B
927 struct mgmt_ev_device_connected {
928 	struct mgmt_addr_info addr;
929 	__le32	flags;
930 	__le16	eir_len;
931 	__u8	eir[];
932 } __packed;
933 
934 #define MGMT_DEV_DISCONN_UNKNOWN	0x00
935 #define MGMT_DEV_DISCONN_TIMEOUT	0x01
936 #define MGMT_DEV_DISCONN_LOCAL_HOST	0x02
937 #define MGMT_DEV_DISCONN_REMOTE		0x03
938 #define MGMT_DEV_DISCONN_AUTH_FAILURE	0x04
939 #define MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND	0x05
940 
941 #define MGMT_EV_DEVICE_DISCONNECTED	0x000C
942 struct mgmt_ev_device_disconnected {
943 	struct mgmt_addr_info addr;
944 	__u8	reason;
945 } __packed;
946 
947 #define MGMT_EV_CONNECT_FAILED		0x000D
948 struct mgmt_ev_connect_failed {
949 	struct mgmt_addr_info addr;
950 	__u8	status;
951 } __packed;
952 
953 #define MGMT_EV_PIN_CODE_REQUEST	0x000E
954 struct mgmt_ev_pin_code_request {
955 	struct mgmt_addr_info addr;
956 	__u8	secure;
957 } __packed;
958 
959 #define MGMT_EV_USER_CONFIRM_REQUEST	0x000F
960 struct mgmt_ev_user_confirm_request {
961 	struct mgmt_addr_info addr;
962 	__u8	confirm_hint;
963 	__le32	value;
964 } __packed;
965 
966 #define MGMT_EV_USER_PASSKEY_REQUEST	0x0010
967 struct mgmt_ev_user_passkey_request {
968 	struct mgmt_addr_info addr;
969 } __packed;
970 
971 #define MGMT_EV_AUTH_FAILED		0x0011
972 struct mgmt_ev_auth_failed {
973 	struct mgmt_addr_info addr;
974 	__u8	status;
975 } __packed;
976 
977 #define MGMT_DEV_FOUND_CONFIRM_NAME		0x01
978 #define MGMT_DEV_FOUND_LEGACY_PAIRING		0x02
979 #define MGMT_DEV_FOUND_NOT_CONNECTABLE		0x04
980 #define MGMT_DEV_FOUND_INITIATED_CONN		0x08
981 #define MGMT_DEV_FOUND_NAME_REQUEST_FAILED	0x10
982 
983 #define MGMT_EV_DEVICE_FOUND		0x0012
984 struct mgmt_ev_device_found {
985 	struct mgmt_addr_info addr;
986 	__s8	rssi;
987 	__le32	flags;
988 	__le16	eir_len;
989 	__u8	eir[];
990 } __packed;
991 
992 #define MGMT_EV_DISCOVERING		0x0013
993 struct mgmt_ev_discovering {
994 	__u8	type;
995 	__u8	discovering;
996 } __packed;
997 
998 #define MGMT_EV_DEVICE_BLOCKED		0x0014
999 struct mgmt_ev_device_blocked {
1000 	struct mgmt_addr_info addr;
1001 } __packed;
1002 
1003 #define MGMT_EV_DEVICE_UNBLOCKED	0x0015
1004 struct mgmt_ev_device_unblocked {
1005 	struct mgmt_addr_info addr;
1006 } __packed;
1007 
1008 #define MGMT_EV_DEVICE_UNPAIRED		0x0016
1009 struct mgmt_ev_device_unpaired {
1010 	struct mgmt_addr_info addr;
1011 } __packed;
1012 
1013 #define MGMT_EV_PASSKEY_NOTIFY		0x0017
1014 struct mgmt_ev_passkey_notify {
1015 	struct mgmt_addr_info addr;
1016 	__le32	passkey;
1017 	__u8	entered;
1018 } __packed;
1019 
1020 #define MGMT_EV_NEW_IRK			0x0018
1021 struct mgmt_ev_new_irk {
1022 	__u8     store_hint;
1023 	bdaddr_t rpa;
1024 	struct mgmt_irk_info irk;
1025 } __packed;
1026 
1027 #define MGMT_CSRK_LOCAL_UNAUTHENTICATED		0x00
1028 #define MGMT_CSRK_REMOTE_UNAUTHENTICATED	0x01
1029 #define MGMT_CSRK_LOCAL_AUTHENTICATED		0x02
1030 #define MGMT_CSRK_REMOTE_AUTHENTICATED		0x03
1031 
1032 struct mgmt_csrk_info {
1033 	struct mgmt_addr_info addr;
1034 	__u8 type;
1035 	__u8 val[16];
1036 } __packed;
1037 
1038 #define MGMT_EV_NEW_CSRK		0x0019
1039 struct mgmt_ev_new_csrk {
1040 	__u8 store_hint;
1041 	struct mgmt_csrk_info key;
1042 } __packed;
1043 
1044 #define MGMT_EV_DEVICE_ADDED		0x001a
1045 struct mgmt_ev_device_added {
1046 	struct mgmt_addr_info addr;
1047 	__u8 action;
1048 } __packed;
1049 
1050 #define MGMT_EV_DEVICE_REMOVED		0x001b
1051 struct mgmt_ev_device_removed {
1052 	struct mgmt_addr_info addr;
1053 } __packed;
1054 
1055 #define MGMT_EV_NEW_CONN_PARAM		0x001c
1056 struct mgmt_ev_new_conn_param {
1057 	struct mgmt_addr_info addr;
1058 	__u8 store_hint;
1059 	__le16 min_interval;
1060 	__le16 max_interval;
1061 	__le16 latency;
1062 	__le16 timeout;
1063 } __packed;
1064 
1065 #define MGMT_EV_UNCONF_INDEX_ADDED	0x001d
1066 
1067 #define MGMT_EV_UNCONF_INDEX_REMOVED	0x001e
1068 
1069 #define MGMT_EV_NEW_CONFIG_OPTIONS	0x001f
1070 
1071 struct mgmt_ev_ext_index {
1072 	__u8 type;
1073 	__u8 bus;
1074 } __packed;
1075 
1076 #define MGMT_EV_EXT_INDEX_ADDED		0x0020
1077 
1078 #define MGMT_EV_EXT_INDEX_REMOVED	0x0021
1079 
1080 #define MGMT_EV_LOCAL_OOB_DATA_UPDATED	0x0022
1081 struct mgmt_ev_local_oob_data_updated {
1082 	__u8    type;
1083 	__le16	eir_len;
1084 	__u8	eir[];
1085 } __packed;
1086 
1087 #define MGMT_EV_ADVERTISING_ADDED	0x0023
1088 struct mgmt_ev_advertising_added {
1089 	__u8    instance;
1090 } __packed;
1091 
1092 #define MGMT_EV_ADVERTISING_REMOVED	0x0024
1093 struct mgmt_ev_advertising_removed {
1094 	__u8    instance;
1095 } __packed;
1096 
1097 #define MGMT_EV_EXT_INFO_CHANGED	0x0025
1098 struct mgmt_ev_ext_info_changed {
1099 	__le16	eir_len;
1100 	__u8	eir[];
1101 } __packed;
1102 
1103 #define MGMT_EV_PHY_CONFIGURATION_CHANGED	0x0026
1104 struct mgmt_ev_phy_configuration_changed {
1105 	__le32	selected_phys;
1106 } __packed;
1107 
1108 #define MGMT_EV_EXP_FEATURE_CHANGED	0x0027
1109 struct mgmt_ev_exp_feature_changed {
1110 	__u8	uuid[16];
1111 	__le32	flags;
1112 } __packed;
1113 
1114 #define MGMT_EV_DEVICE_FLAGS_CHANGED		0x002a
1115 struct mgmt_ev_device_flags_changed {
1116 	struct mgmt_addr_info addr;
1117 	__le32 supported_flags;
1118 	__le32 current_flags;
1119 } __packed;
1120 
1121 #define MGMT_EV_ADV_MONITOR_ADDED	0x002b
1122 struct mgmt_ev_adv_monitor_added {
1123 	__le16 monitor_handle;
1124 }  __packed;
1125 
1126 #define MGMT_EV_ADV_MONITOR_REMOVED	0x002c
1127 struct mgmt_ev_adv_monitor_removed {
1128 	__le16 monitor_handle;
1129 }  __packed;
1130 
1131 #define MGMT_EV_CONTROLLER_SUSPEND		0x002d
1132 struct mgmt_ev_controller_suspend {
1133 	__u8	suspend_state;
1134 } __packed;
1135 
1136 #define MGMT_EV_CONTROLLER_RESUME		0x002e
1137 struct mgmt_ev_controller_resume {
1138 	__u8	wake_reason;
1139 	struct mgmt_addr_info addr;
1140 } __packed;
1141 
1142 #define MGMT_WAKE_REASON_NON_BT_WAKE		0x0
1143 #define MGMT_WAKE_REASON_UNEXPECTED		0x1
1144 #define MGMT_WAKE_REASON_REMOTE_WAKE		0x2
1145 
1146 #define MGMT_EV_ADV_MONITOR_DEVICE_FOUND	0x002f
1147 struct mgmt_ev_adv_monitor_device_found {
1148 	__le16 monitor_handle;
1149 	struct mgmt_addr_info addr;
1150 	__s8   rssi;
1151 	__le32 flags;
1152 	__le16 eir_len;
1153 	__u8   eir[];
1154 } __packed;
1155 
1156 #define MGMT_EV_ADV_MONITOR_DEVICE_LOST		0x0030
1157 struct mgmt_ev_adv_monitor_device_lost {
1158 	__le16 monitor_handle;
1159 	struct mgmt_addr_info addr;
1160 } __packed;
1161 
1162 #define MGMT_EV_MESH_DEVICE_FOUND	0x0031
1163 struct mgmt_ev_mesh_device_found {
1164 	struct mgmt_addr_info addr;
1165 	__s8	rssi;
1166 	__le64	instant;
1167 	__le32	flags;
1168 	__le16	eir_len;
1169 	__u8	eir[];
1170 } __packed;
1171 
1172 
1173 #define MGMT_EV_MESH_PACKET_CMPLT		0x0032
1174 struct mgmt_ev_mesh_pkt_cmplt {
1175 	__u8	handle;
1176 } __packed;
1177