]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/net/bluetooth/hci.h
Bluetooth: Enable erroneous data reporting if WBS is supported
[mirror_ubuntu-jammy-kernel.git] / include / net / bluetooth / hci.h
CommitLineData
be21871f 1/*
1da177e4
LT
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
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
be21871f
AE
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
1da177e4
LT
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
be21871f
AE
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
1da177e4
LT
22 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __HCI_H
26#define __HCI_H
27
28#define HCI_MAX_ACL_SIZE 1024
29#define HCI_MAX_SCO_SIZE 255
4de0fc59 30#define HCI_MAX_ISO_SIZE 251
1da177e4
LT
31#define HCI_MAX_EVENT_SIZE 260
32#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
33
9b3b4460 34#define HCI_LINK_KEY_SIZE 16
523e93cd 35#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
9b3b4460 36
903e4541
AE
37#define HCI_MAX_AMP_ASSOC_SIZE 672
38
7d1dab49
DP
39#define HCI_MAX_CSB_DATA_SIZE 252
40
1da177e4
LT
41/* HCI dev events */
42#define HCI_DEV_REG 1
43#define HCI_DEV_UNREG 2
44#define HCI_DEV_UP 3
45#define HCI_DEV_DOWN 4
46#define HCI_DEV_SUSPEND 5
47#define HCI_DEV_RESUME 6
4a3f95b7
MH
48#define HCI_DEV_OPEN 7
49#define HCI_DEV_CLOSE 8
e131d74a 50#define HCI_DEV_SETUP 9
1da177e4
LT
51
52/* HCI notify events */
53#define HCI_NOTIFY_CONN_ADD 1
54#define HCI_NOTIFY_CONN_DEL 2
55#define HCI_NOTIFY_VOICE_SETTING 3
56
c13854ce 57/* HCI bus types */
0ac53939 58#define HCI_VIRTUAL 0
1da177e4
LT
59#define HCI_USB 1
60#define HCI_PCCARD 2
61#define HCI_UART 3
62#define HCI_RS232 4
63#define HCI_PCI 5
0ac53939 64#define HCI_SDIO 6
5c0e03cd
JH
65#define HCI_SPI 7
66#define HCI_I2C 8
65010e68 67#define HCI_SMD 9
1da177e4 68
943da25d 69/* HCI controller types */
ca8bee5d 70#define HCI_PRIMARY 0x00
8f1e1742 71#define HCI_AMP 0x01
943da25d 72
8598d064 73/* First BR/EDR Controller shall have ID = 0 */
6ed971ca 74#define AMP_ID_BREDR 0x00
8598d064 75
7c13823d
MH
76/* AMP controller types */
77#define AMP_TYPE_BREDR 0x00
78#define AMP_TYPE_80211 0x01
79
ab846ec4 80/* AMP controller status */
536619e8
MH
81#define AMP_STATUS_POWERED_DOWN 0x00
82#define AMP_STATUS_BLUETOOTH_ONLY 0x01
83#define AMP_STATUS_NO_CAPACITY 0x02
84#define AMP_STATUS_LOW_CAPACITY 0x03
85#define AMP_STATUS_MEDIUM_CAPACITY 0x04
86#define AMP_STATUS_HIGH_CAPACITY 0x05
87#define AMP_STATUS_FULL_CAPACITY 0x06
ab846ec4 88
1da177e4
LT
89/* HCI device quirks */
90enum {
118305b5
MH
91 /* When this quirk is set, the HCI Reset command is send when
92 * closing the transport instead of when opening it.
93 *
94 * This quirk must be set before hci_register_dev is called.
95 */
a6c511c6 96 HCI_QUIRK_RESET_ON_CLOSE,
118305b5
MH
97
98 /* When this quirk is set, the device is turned into a raw-only
99 * device and it will stay in unconfigured state.
100 *
101 * This quirk must be set before hci_register_dev is called.
102 */
da1f5198 103 HCI_QUIRK_RAW_DEVICE,
118305b5
MH
104
105 /* When this quirk is set, the buffer sizes reported by
106 * HCI Read Buffer Size command are corrected if invalid.
107 *
108 * This quirk must be set before hci_register_dev is called.
109 */
f9f462fa 110 HCI_QUIRK_FIXUP_BUFFER_SIZE,
118305b5 111
043ec9bf
MH
112 /* When this quirk is set, then a controller that does not
113 * indicate support for Inquiry Result with RSSI is assumed to
114 * support it anyway. Some early Bluetooth 1.2 controllers had
115 * wrongly configured local features that will require forcing
116 * them to enable this mode. Getting RSSI information with the
117 * inquiry responses is preferred since it allows for a better
e37c57a8 118 * user experience.
043ec9bf
MH
119 *
120 * This quirk must be set before hci_register_dev is called.
121 */
122 HCI_QUIRK_FIXUP_INQUIRY_MODE,
123
711ffa78
MH
124 /* When this quirk is set, then the HCI Read Local Supported
125 * Commands command is not supported. In general Bluetooth 1.2
126 * and later controllers should support this command. However
127 * some controllers indicate Bluetooth 1.2 support, but do
128 * not support this command.
129 *
130 * This quirk must be set before hci_register_dev is called.
131 */
132 HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
133
118305b5
MH
134 /* When this quirk is set, then no stored link key handling
135 * is performed. This is mainly due to the fact that the
136 * HCI Delete Stored Link Key command is advertised, but
137 * not supported.
138 *
139 * This quirk must be set before hci_register_dev is called.
140 */
f9f462fa 141 HCI_QUIRK_BROKEN_STORED_LINK_KEY,
89bc22d2 142
eb1904f4
MH
143 /* When this quirk is set, an external configuration step
144 * is required and will be indicated with the controller
e37c57a8 145 * configuration.
eb1904f4
MH
146 *
147 * This quirk can be set before hci_register_dev is called or
148 * during the hdev->setup vendor callback.
149 */
150 HCI_QUIRK_EXTERNAL_CONFIG,
151
89bc22d2
MH
152 /* When this quirk is set, the public Bluetooth address
153 * initially reported by HCI Read BD Address command
154 * is considered invalid. Controller configuration is
155 * required before this device can be used.
156 *
157 * This quirk can be set before hci_register_dev is called or
158 * during the hdev->setup vendor callback.
159 */
160 HCI_QUIRK_INVALID_BDADDR,
43d6bc46 161
7a0e5b15
MK
162 /* When this quirk is set, the public Bluetooth address
163 * initially reported by HCI Read BD Address command
164 * is considered invalid. The public BD Address can be
165 * specified in the fwnode property 'local-bd-address'.
166 * If this property does not exist or is invalid controller
167 * configuration is required before this device can be used.
168 *
169 * This quirk can be set before hci_register_dev is called or
170 * during the hdev->setup vendor callback.
171 */
172 HCI_QUIRK_USE_BDADDR_PROPERTY,
173
43d6bc46
MH
174 /* When this quirk is set, the duplicate filtering during
175 * scanning is based on Bluetooth devices addresses. To allow
176 * RSSI based updates, restart scanning if needed.
177 *
178 * This quirk can be set before hci_register_dev is called or
179 * during the hdev->setup vendor callback.
180 */
181 HCI_QUIRK_STRICT_DUPLICATE_FILTER,
695c4cb6
JP
182
183 /* When this quirk is set, LE scan and BR/EDR inquiry is done
184 * simultaneously, otherwise it's interleaved.
185 *
186 * This quirk can be set before hci_register_dev is called or
187 * during the hdev->setup vendor callback.
188 */
189 HCI_QUIRK_SIMULTANEOUS_DISCOVERY,
7e995b9e
MH
190
191 /* When this quirk is set, the enabling of diagnostic mode is
192 * not persistent over HCI Reset. Every time the controller
193 * is brought up it needs to be reprogrammed.
194 *
195 * This quirk can be set before hci_register_dev is called or
196 * during the hdev->setup vendor callback.
197 */
198 HCI_QUIRK_NON_PERSISTENT_DIAG,
740011cf
SW
199
200 /* When this quirk is set, setup() would be run after every
201 * open() and not just after the first open().
202 *
203 * This quirk can be set before hci_register_dev is called or
204 * during the hdev->setup vendor callback.
205 *
206 */
207 HCI_QUIRK_NON_PERSISTENT_SETUP,
4b127bd5
AM
208
209 /* When this quirk is set, wide band speech is supported by
210 * the driver since no reliable mechanism exist to report
211 * this from the hardware, a driver flag is use to convey
212 * this support
213 *
214 * This quirk must be set before hci_register_dev is called.
215 */
00bce3fb 216 HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
1da177e4
LT
217};
218
219/* HCI device flags */
220enum {
221 HCI_UP,
222 HCI_INIT,
223 HCI_RUNNING,
224
225 HCI_PSCAN,
226 HCI_ISCAN,
227 HCI_AUTH,
228 HCI_ENCRYPT,
229 HCI_INQUIRY,
230
231 HCI_RAW,
ab81cbf9 232
10572132 233 HCI_RESET,
1da177e4
LT
234};
235
f9207338
MH
236/* HCI socket flags */
237enum {
50ebc055 238 HCI_SOCK_TRUSTED,
f9207338
MH
239 HCI_MGMT_INDEX_EVENTS,
240 HCI_MGMT_UNCONF_INDEX_EVENTS,
ced85549 241 HCI_MGMT_EXT_INDEX_EVENTS,
321c6fee 242 HCI_MGMT_EXT_INFO_EVENTS,
5504c3a3
MH
243 HCI_MGMT_OPTION_EVENTS,
244 HCI_MGMT_SETTING_EVENTS,
245 HCI_MGMT_DEV_CLASS_EVENTS,
246 HCI_MGMT_LOCAL_NAME_EVENTS,
72000df2 247 HCI_MGMT_OOB_DATA_EVENTS,
f9207338
MH
248};
249
d23264a8
AG
250/*
251 * BR/EDR and/or LE controller flags: the flags defined here should represent
252 * states from the controller.
253 */
254enum {
a8b2d5c2 255 HCI_SETUP,
d603b76b 256 HCI_CONFIG,
a8b2d5c2 257 HCI_AUTO_OFF,
5e130367 258 HCI_RFKILLED,
a8b2d5c2 259 HCI_MGMT,
b6ae8457 260 HCI_BONDABLE,
a8b2d5c2 261 HCI_SERVICE_CACHE,
0663b297 262 HCI_KEEP_DEBUG_KEYS,
3769972b 263 HCI_USE_DEBUG_KEYS,
94324962 264 HCI_UNREGISTER,
4a964404 265 HCI_UNCONFIGURED,
0736cfa8 266 HCI_USER_CHANNEL,
dbece37a 267 HCI_EXT_CONFIGURED,
66c417c1 268 HCI_LE_ADV,
d23264a8 269 HCI_LE_SCAN,
84bde9d6 270 HCI_SSP_ENABLED,
e98d2ce2 271 HCI_SC_ENABLED,
134c2a89 272 HCI_SC_ONLY,
863efaf2 273 HCI_PRIVACY,
82a37ade 274 HCI_LIMITED_PRIVACY,
d6bfd59c 275 HCI_RPA_EXPIRED,
41edf160 276 HCI_RPA_RESOLVING,
6d80dfd0 277 HCI_HS_ENABLED,
06199cf8 278 HCI_LE_ENABLED,
f3d3444a 279 HCI_ADVERTISING,
cc91cb04 280 HCI_ADVERTISING_CONNECTABLE,
5e5282bb
JH
281 HCI_CONNECTABLE,
282 HCI_DISCOVERABLE,
6acd7db4 283 HCI_LIMITED_DISCOVERABLE,
47990ea0 284 HCI_LINK_SECURITY,
21693c15 285 HCI_PERIODIC_INQ,
1a4d3c4b 286 HCI_FAST_CONNECTABLE,
56f87901 287 HCI_BREDR_ENABLED,
81ad6fd9 288 HCI_LE_SCAN_INTERRUPTED,
00bce3fb 289 HCI_WIDEBAND_SPEECH_ENABLED,
b7cb93e5
MH
290
291 HCI_DUT_MODE,
4b4113d6 292 HCI_VENDOR_DIAG,
b7cb93e5
MH
293 HCI_FORCE_BREDR_SMP,
294 HCI_FORCE_STATIC_ADDR,
aa12af77 295 HCI_LL_RPA_RESOLUTION,
f80c5dad 296 HCI_CMD_PENDING,
b7cb93e5 297
eacb44df 298 __HCI_NUM_FLAGS,
d23264a8
AG
299};
300
1da177e4 301/* HCI timeouts */
5f246e89
AE
302#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
303#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
304#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
d1244adc 305#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
5f246e89 306#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
9345d40c 307#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
a3172b7e 308#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
9489eca4 309#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
1f01d8be 310#define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000) /* 4 seconds */
1da177e4 311
5b7f9909 312/* HCI data types */
1da177e4
LT
313#define HCI_COMMAND_PKT 0x01
314#define HCI_ACLDATA_PKT 0x02
315#define HCI_SCODATA_PKT 0x03
316#define HCI_EVENT_PKT 0x04
4de0fc59 317#define HCI_ISODATA_PKT 0x05
e875ff84 318#define HCI_DIAG_PKT 0xf0
1da177e4
LT
319#define HCI_VENDOR_PKT 0xff
320
5b7f9909 321/* HCI packet types */
1da177e4
LT
322#define HCI_DM1 0x0008
323#define HCI_DM3 0x0400
324#define HCI_DM5 0x4000
325#define HCI_DH1 0x0010
326#define HCI_DH3 0x0800
327#define HCI_DH5 0x8000
328
5075b972
JK
329/* HCI packet types inverted masks */
330#define HCI_2DH1 0x0002
331#define HCI_3DH1 0x0004
332#define HCI_2DH3 0x0100
333#define HCI_3DH3 0x0200
334#define HCI_2DH5 0x1000
335#define HCI_3DH5 0x2000
336
1da177e4
LT
337#define HCI_HV1 0x0020
338#define HCI_HV2 0x0040
339#define HCI_HV3 0x0080
340
341#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
342#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
343
5b7f9909
MH
344/* eSCO packet types */
345#define ESCO_HV1 0x0001
346#define ESCO_HV2 0x0002
347#define ESCO_HV3 0x0004
348#define ESCO_EV3 0x0008
349#define ESCO_EV4 0x0010
350#define ESCO_EV5 0x0020
efc7688b
MH
351#define ESCO_2EV3 0x0040
352#define ESCO_3EV3 0x0080
353#define ESCO_2EV5 0x0100
354#define ESCO_3EV5 0x0200
5b7f9909 355
a8746417 356#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
efc7688b 357#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
a8746417 358
1da177e4 359/* ACL flags */
e702112f 360#define ACL_START_NO_FLUSH 0x00
1da177e4
LT
361#define ACL_CONT 0x01
362#define ACL_START 0x02
d73a0988 363#define ACL_COMPLETE 0x03
1da177e4
LT
364#define ACL_ACTIVE_BCAST 0x04
365#define ACL_PICO_BCAST 0x08
366
4de0fc59
LAD
367/* ISO PB flags */
368#define ISO_START 0x00
369#define ISO_CONT 0x01
370#define ISO_SINGLE 0x02
371#define ISO_END 0x03
372
373/* ISO TS flags */
374#define ISO_TS 0x01
375
1da177e4
LT
376/* Baseband links */
377#define SCO_LINK 0x00
378#define ACL_LINK 0x01
5b7f9909 379#define ESCO_LINK 0x02
fcd89c09
VT
380/* Low Energy links do not have defined link type. Use invented one */
381#define LE_LINK 0x80
3161ae1c 382#define AMP_LINK 0x81
4de0fc59 383#define ISO_LINK 0x82
845472e8 384#define INVALID_LINK 0xff
1da177e4
LT
385
386/* LMP features */
387#define LMP_3SLOT 0x01
388#define LMP_5SLOT 0x02
389#define LMP_ENCRYPT 0x04
390#define LMP_SOFFSET 0x08
391#define LMP_TACCURACY 0x10
392#define LMP_RSWITCH 0x20
393#define LMP_HOLD 0x40
04837f64 394#define LMP_SNIFF 0x80
1da177e4
LT
395
396#define LMP_PARK 0x01
397#define LMP_RSSI 0x02
398#define LMP_QUALITY 0x04
399#define LMP_SCO 0x08
400#define LMP_HV2 0x10
401#define LMP_HV3 0x20
402#define LMP_ULAW 0x40
403#define LMP_ALAW 0x80
404
405#define LMP_CVSD 0x01
406#define LMP_PSCHEME 0x02
407#define LMP_PCONTROL 0x04
07a5c61e 408#define LMP_TRANSPARENT 0x08
1da177e4 409
5075b972
JK
410#define LMP_EDR_2M 0x02
411#define LMP_EDR_3M 0x04
d5859e22 412#define LMP_RSSI_INQ 0x40
5b7f9909
MH
413#define LMP_ESCO 0x80
414
415#define LMP_EV4 0x01
416#define LMP_EV5 0x02
69ab39ea 417#define LMP_NO_BREDR 0x20
d5859e22 418#define LMP_LE 0x40
5075b972 419#define LMP_EDR_3SLOT 0x80
5b7f9909 420
5075b972 421#define LMP_EDR_5SLOT 0x01
04837f64 422#define LMP_SNIFF_SUBR 0x02
d5859e22 423#define LMP_PAUSE_ENC 0x04
efc7688b
MH
424#define LMP_EDR_ESCO_2M 0x20
425#define LMP_EDR_ESCO_3M 0x40
426#define LMP_EDR_3S_ESCO 0x80
04837f64 427
d5859e22 428#define LMP_EXT_INQ 0x01
e6100a25 429#define LMP_SIMUL_LE_BR 0x02
769be974 430#define LMP_SIMPLE_PAIR 0x08
e702112f 431#define LMP_NO_FLUSH 0x40
769be974 432
d5859e22
JH
433#define LMP_LSTO 0x01
434#define LMP_INQ_TX_PWR 0x02
971e3a4b 435#define LMP_EXTFEATURES 0x80
d5859e22 436
eead27da 437/* Extended LMP features */
53b834d2
MH
438#define LMP_CSB_MASTER 0x01
439#define LMP_CSB_SLAVE 0x02
440#define LMP_SYNC_TRAIN 0x04
441#define LMP_SYNC_SCAN 0x08
442
d5991585
MH
443#define LMP_SC 0x01
444#define LMP_PING 0x02
445
53b834d2 446/* Host features */
cc2c04ec
JH
447#define LMP_HOST_SSP 0x01
448#define LMP_HOST_LE 0x02
449#define LMP_HOST_LE_BREDR 0x04
d5991585 450#define LMP_HOST_SC 0x08
eead27da 451
662bc2e6 452/* LE features */
0da71f1b 453#define HCI_LE_ENCRYPTION 0x01
662bc2e6 454#define HCI_LE_CONN_PARAM_REQ_PROC 0x02
0fe29fd1 455#define HCI_LE_SLAVE_FEATURES 0x08
cd7ca0ec 456#define HCI_LE_PING 0x10
94a3bd02 457#define HCI_LE_DATA_LEN_EXT 0x20
85a721a8
JK
458#define HCI_LE_PHY_2M 0x01
459#define HCI_LE_PHY_CODED 0x08
6b49bcb4 460#define HCI_LE_EXT_ADV 0x10
4b71bba4 461#define HCI_LE_EXT_SCAN_POLICY 0x80
5075b972
JK
462#define HCI_LE_PHY_2M 0x01
463#define HCI_LE_PHY_CODED 0x08
9756d33b 464#define HCI_LE_CHAN_SEL_ALG2 0x40
4de0fc59
LAD
465#define HCI_LE_CIS_MASTER 0x10
466#define HCI_LE_CIS_SLAVE 0x20
662bc2e6 467
04837f64
MH
468/* Connection modes */
469#define HCI_CM_ACTIVE 0x0000
470#define HCI_CM_HOLD 0x0001
471#define HCI_CM_SNIFF 0x0002
472#define HCI_CM_PARK 0x0003
473
1da177e4
LT
474/* Link policies */
475#define HCI_LP_RSWITCH 0x0001
476#define HCI_LP_HOLD 0x0002
477#define HCI_LP_SNIFF 0x0004
478#define HCI_LP_PARK 0x0008
479
04837f64 480/* Link modes */
1da177e4
LT
481#define HCI_LM_ACCEPT 0x8000
482#define HCI_LM_MASTER 0x0001
483#define HCI_LM_AUTH 0x0002
484#define HCI_LM_ENCRYPT 0x0004
485#define HCI_LM_TRUSTED 0x0008
486#define HCI_LM_RELIABLE 0x0010
487#define HCI_LM_SECURE 0x0020
7b5a9241 488#define HCI_LM_FIPS 0x0040
1da177e4 489
40be492f
MH
490/* Authentication types */
491#define HCI_AT_NO_BONDING 0x00
492#define HCI_AT_NO_BONDING_MITM 0x01
493#define HCI_AT_DEDICATED_BONDING 0x02
494#define HCI_AT_DEDICATED_BONDING_MITM 0x03
495#define HCI_AT_GENERAL_BONDING 0x04
496#define HCI_AT_GENERAL_BONDING_MITM 0x05
497
a77b15a6
MA
498/* I/O capabilities */
499#define HCI_IO_DISPLAY_ONLY 0x00
500#define HCI_IO_DISPLAY_YESNO 0x01
501#define HCI_IO_KEYBOARD_ONLY 0x02
502#define HCI_IO_NO_INPUT_OUTPUT 0x03
503
b6020ba0
WR
504/* Link Key types */
505#define HCI_LK_COMBINATION 0x00
506#define HCI_LK_LOCAL_UNIT 0x01
507#define HCI_LK_REMOTE_UNIT 0x02
508#define HCI_LK_DEBUG_COMBINATION 0x03
11015c79
MH
509#define HCI_LK_UNAUTH_COMBINATION_P192 0x04
510#define HCI_LK_AUTH_COMBINATION_P192 0x05
b6020ba0 511#define HCI_LK_CHANGED_COMBINATION 0x06
11015c79
MH
512#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
513#define HCI_LK_AUTH_COMBINATION_P256 0x08
b6020ba0 514
9f5a0d7b 515/* ---- HCI Error Codes ---- */
8e75b46a 516#define HCI_ERROR_UNKNOWN_CONN_ID 0x02
9f5a0d7b 517#define HCI_ERROR_AUTH_FAILURE 0x05
160b9251 518#define HCI_ERROR_PIN_OR_KEY_MISSING 0x06
2acf3d90 519#define HCI_ERROR_MEMORY_EXCEEDED 0x07
cdcba7c6 520#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
d41c15cf 521#define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d
9f5a0d7b
AE
522#define HCI_ERROR_REJ_BAD_ADDR 0x0f
523#define HCI_ERROR_REMOTE_USER_TERM 0x13
cdcba7c6
MA
524#define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14
525#define HCI_ERROR_REMOTE_POWER_OFF 0x15
9f5a0d7b
AE
526#define HCI_ERROR_LOCAL_HOST_TERM 0x16
527#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
4ebeee2d
JH
528#define HCI_ERROR_INVALID_LL_PARAMS 0x1e
529#define HCI_ERROR_UNSPECIFIED 0x1f
3c857757 530#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
9f5a0d7b 531
2455a3ea
AE
532/* Flow control modes */
533#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
534#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
535
bbaf444a
JH
536/* The core spec defines 127 as the "not available" value */
537#define HCI_TX_POWER_INVALID 127
a89612aa 538#define HCI_RSSI_INVALID 127
bbaf444a 539
ba165a90
JH
540#define HCI_ROLE_MASTER 0x00
541#define HCI_ROLE_SLAVE 0x01
542
32748db0
JH
543/* Extended Inquiry Response field types */
544#define EIR_FLAGS 0x01 /* flags */
545#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
546#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
547#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
548#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
549#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
550#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
551#define EIR_NAME_SHORT 0x08 /* shortened local name */
552#define EIR_NAME_COMPLETE 0x09 /* complete local name */
553#define EIR_TX_POWER 0x0A /* transmit power level */
9ec9fc8a 554#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
d619ffcf
JH
555#define EIR_SSP_HASH_C192 0x0E /* Simple Pairing Hash C-192 */
556#define EIR_SSP_RAND_R192 0x0F /* Simple Pairing Randomizer R-192 */
32748db0 557#define EIR_DEVICE_ID 0x10 /* device ID */
4453b006 558#define EIR_APPEARANCE 0x19 /* Device appearance */
1471aae0
MH
559#define EIR_LE_BDADDR 0x1B /* LE Bluetooth device address */
560#define EIR_LE_ROLE 0x1C /* LE role */
d619ffcf
JH
561#define EIR_SSP_HASH_C256 0x1D /* Simple Pairing Hash C-256 */
562#define EIR_SSP_RAND_R256 0x1E /* Simple Pairing Rand R-256 */
f709bfcf
MH
563#define EIR_LE_SC_CONFIRM 0x22 /* LE SC Confirmation Value */
564#define EIR_LE_SC_RANDOM 0x23 /* LE SC Random Value */
32748db0 565
3f0f524b
JH
566/* Low Energy Advertising Flags */
567#define LE_AD_LIMITED 0x01 /* Limited Discoverable */
568#define LE_AD_GENERAL 0x02 /* General Discoverable */
569#define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */
570#define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */
571#define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */
572
1da177e4 573/* ----- HCI Commands ---- */
6bd32326
VT
574#define HCI_OP_NOP 0x0000
575
a9de9248
MH
576#define HCI_OP_INQUIRY 0x0401
577struct hci_cp_inquiry {
578 __u8 lap[3];
579 __u8 length;
580 __u8 num_rsp;
66c853cc 581} __packed;
1da177e4 582
a9de9248 583#define HCI_OP_INQUIRY_CANCEL 0x0402
1da177e4 584
79d6e068
AG
585#define HCI_OP_PERIODIC_INQ 0x0403
586
a9de9248 587#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
6ac59344 588
a9de9248 589#define HCI_OP_CREATE_CONN 0x0405
1da177e4
LT
590struct hci_cp_create_conn {
591 bdaddr_t bdaddr;
1ebb9252 592 __le16 pkt_type;
1da177e4
LT
593 __u8 pscan_rep_mode;
594 __u8 pscan_mode;
1ebb9252 595 __le16 clock_offset;
1da177e4 596 __u8 role_switch;
66c853cc 597} __packed;
1da177e4 598
a9de9248 599#define HCI_OP_DISCONNECT 0x0406
1da177e4 600struct hci_cp_disconnect {
1ebb9252 601 __le16 handle;
1da177e4 602 __u8 reason;
66c853cc 603} __packed;
1da177e4 604
a9de9248 605#define HCI_OP_ADD_SCO 0x0407
1da177e4 606struct hci_cp_add_sco {
1ebb9252
MH
607 __le16 handle;
608 __le16 pkt_type;
66c853cc 609} __packed;
1da177e4 610
a9de9248
MH
611#define HCI_OP_CREATE_CONN_CANCEL 0x0408
612struct hci_cp_create_conn_cancel {
613 bdaddr_t bdaddr;
66c853cc 614} __packed;
1da177e4 615
a9de9248
MH
616#define HCI_OP_ACCEPT_CONN_REQ 0x0409
617struct hci_cp_accept_conn_req {
618 bdaddr_t bdaddr;
619 __u8 role;
66c853cc 620} __packed;
1da177e4 621
a9de9248
MH
622#define HCI_OP_REJECT_CONN_REQ 0x040a
623struct hci_cp_reject_conn_req {
624 bdaddr_t bdaddr;
625 __u8 reason;
66c853cc 626} __packed;
defc761b 627
a9de9248 628#define HCI_OP_LINK_KEY_REPLY 0x040b
1da177e4
LT
629struct hci_cp_link_key_reply {
630 bdaddr_t bdaddr;
9b3b4460 631 __u8 link_key[HCI_LINK_KEY_SIZE];
66c853cc 632} __packed;
1da177e4 633
a9de9248 634#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
1da177e4
LT
635struct hci_cp_link_key_neg_reply {
636 bdaddr_t bdaddr;
66c853cc 637} __packed;
1da177e4 638
a9de9248 639#define HCI_OP_PIN_CODE_REPLY 0x040d
1da177e4
LT
640struct hci_cp_pin_code_reply {
641 bdaddr_t bdaddr;
642 __u8 pin_len;
643 __u8 pin_code[16];
66c853cc 644} __packed;
980e1a53
JH
645struct hci_rp_pin_code_reply {
646 __u8 status;
647 bdaddr_t bdaddr;
648} __packed;
1da177e4 649
a9de9248 650#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
1da177e4
LT
651struct hci_cp_pin_code_neg_reply {
652 bdaddr_t bdaddr;
66c853cc 653} __packed;
980e1a53
JH
654struct hci_rp_pin_code_neg_reply {
655 __u8 status;
656 bdaddr_t bdaddr;
657} __packed;
1da177e4 658
a9de9248 659#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
1da177e4 660struct hci_cp_change_conn_ptype {
1ebb9252
MH
661 __le16 handle;
662 __le16 pkt_type;
66c853cc 663} __packed;
1da177e4 664
a9de9248 665#define HCI_OP_AUTH_REQUESTED 0x0411
1da177e4 666struct hci_cp_auth_requested {
1ebb9252 667 __le16 handle;
66c853cc 668} __packed;
1da177e4 669
a9de9248 670#define HCI_OP_SET_CONN_ENCRYPT 0x0413
1da177e4 671struct hci_cp_set_conn_encrypt {
1ebb9252 672 __le16 handle;
1da177e4 673 __u8 encrypt;
66c853cc 674} __packed;
1da177e4 675
a9de9248 676#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
1da177e4 677struct hci_cp_change_conn_link_key {
1ebb9252 678 __le16 handle;
66c853cc 679} __packed;
1da177e4 680
a9de9248
MH
681#define HCI_OP_REMOTE_NAME_REQ 0x0419
682struct hci_cp_remote_name_req {
683 bdaddr_t bdaddr;
684 __u8 pscan_rep_mode;
685 __u8 pscan_mode;
686 __le16 clock_offset;
66c853cc 687} __packed;
a9de9248
MH
688
689#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
690struct hci_cp_remote_name_req_cancel {
691 bdaddr_t bdaddr;
66c853cc 692} __packed;
a9de9248
MH
693
694#define HCI_OP_READ_REMOTE_FEATURES 0x041b
04837f64 695struct hci_cp_read_remote_features {
1ebb9252 696 __le16 handle;
66c853cc 697} __packed;
1da177e4 698
a9de9248
MH
699#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
700struct hci_cp_read_remote_ext_features {
701 __le16 handle;
702 __u8 page;
66c853cc 703} __packed;
a9de9248
MH
704
705#define HCI_OP_READ_REMOTE_VERSION 0x041d
04837f64 706struct hci_cp_read_remote_version {
1ebb9252 707 __le16 handle;
66c853cc 708} __packed;
1da177e4 709
df935429
MH
710#define HCI_OP_READ_CLOCK_OFFSET 0x041f
711struct hci_cp_read_clock_offset {
712 __le16 handle;
713} __packed;
714
a9de9248
MH
715#define HCI_OP_SETUP_SYNC_CONN 0x0428
716struct hci_cp_setup_sync_conn {
717 __le16 handle;
718 __le32 tx_bandwidth;
719 __le32 rx_bandwidth;
720 __le16 max_latency;
721 __le16 voice_setting;
722 __u8 retrans_effort;
723 __le16 pkt_type;
66c853cc 724} __packed;
04837f64 725
a9de9248
MH
726#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
727struct hci_cp_accept_sync_conn_req {
728 bdaddr_t bdaddr;
729 __le32 tx_bandwidth;
730 __le32 rx_bandwidth;
731 __le16 max_latency;
732 __le16 content_format;
733 __u8 retrans_effort;
734 __le16 pkt_type;
66c853cc 735} __packed;
a9de9248
MH
736
737#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
738struct hci_cp_reject_sync_conn_req {
739 bdaddr_t bdaddr;
740 __u8 reason;
66c853cc 741} __packed;
a9de9248 742
17fa4b9d
JH
743#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
744struct hci_cp_io_capability_reply {
745 bdaddr_t bdaddr;
746 __u8 capability;
747 __u8 oob_data;
748 __u8 authentication;
749} __packed;
750
a5c29683
JH
751#define HCI_OP_USER_CONFIRM_REPLY 0x042c
752struct hci_cp_user_confirm_reply {
753 bdaddr_t bdaddr;
754} __packed;
755struct hci_rp_user_confirm_reply {
756 __u8 status;
757 bdaddr_t bdaddr;
758} __packed;
759
760#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
761
9ad4019a
BG
762#define HCI_OP_USER_PASSKEY_REPLY 0x042e
763struct hci_cp_user_passkey_reply {
764 bdaddr_t bdaddr;
765 __le32 passkey;
766} __packed;
767
768#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f
769
2763eda6
SJ
770#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
771struct hci_cp_remote_oob_data_reply {
772 bdaddr_t bdaddr;
773 __u8 hash[16];
38da1703 774 __u8 rand[16];
2763eda6
SJ
775} __packed;
776
777#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
778struct hci_cp_remote_oob_data_neg_reply {
779 bdaddr_t bdaddr;
780} __packed;
781
03b555e1
JH
782#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
783struct hci_cp_io_capability_neg_reply {
784 bdaddr_t bdaddr;
785 __u8 reason;
786} __packed;
787
523e93cd
AE
788#define HCI_OP_CREATE_PHY_LINK 0x0435
789struct hci_cp_create_phy_link {
790 __u8 phy_handle;
791 __u8 key_len;
792 __u8 key_type;
793 __u8 key[HCI_AMP_LINK_KEY_SIZE];
794} __packed;
795
796#define HCI_OP_ACCEPT_PHY_LINK 0x0436
797struct hci_cp_accept_phy_link {
798 __u8 phy_handle;
799 __u8 key_len;
800 __u8 key_type;
801 __u8 key[HCI_AMP_LINK_KEY_SIZE];
802} __packed;
803
b078b564 804#define HCI_OP_DISCONN_PHY_LINK 0x0437
523e93cd
AE
805struct hci_cp_disconn_phy_link {
806 __u8 phy_handle;
807 __u8 reason;
808} __packed;
809
b078b564
AE
810struct ext_flow_spec {
811 __u8 id;
812 __u8 stype;
813 __le16 msdu;
814 __le32 sdu_itime;
815 __le32 acc_lat;
816 __le32 flush_to;
817} __packed;
818
819#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
820#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
821struct hci_cp_create_accept_logical_link {
822 __u8 phy_handle;
823 struct ext_flow_spec tx_flow_spec;
824 struct ext_flow_spec rx_flow_spec;
825} __packed;
826
827#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
828struct hci_cp_disconn_logical_link {
829 __le16 log_handle;
830} __packed;
831
832#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
833struct hci_cp_logical_link_cancel {
834 __u8 phy_handle;
835 __u8 flow_spec_id;
836} __packed;
837
838struct hci_rp_logical_link_cancel {
839 __u8 status;
840 __u8 phy_handle;
841 __u8 flow_spec_id;
842} __packed;
843
8c9a041b
DP
844#define HCI_OP_SET_CSB 0x0441
845struct hci_cp_set_csb {
846 __u8 enable;
847 __u8 lt_addr;
848 __u8 lpo_allowed;
849 __le16 packet_type;
850 __le16 interval_min;
851 __le16 interval_max;
852 __le16 csb_sv_tout;
853} __packed;
854struct hci_rp_set_csb {
855 __u8 status;
856 __u8 lt_addr;
857 __le16 interval;
858} __packed;
859
cefded98
DP
860#define HCI_OP_START_SYNC_TRAIN 0x0443
861
e2f99131
MH
862#define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445
863struct hci_cp_remote_oob_ext_data_reply {
864 bdaddr_t bdaddr;
865 __u8 hash192[16];
38da1703 866 __u8 rand192[16];
e2f99131 867 __u8 hash256[16];
38da1703 868 __u8 rand256[16];
e2f99131
MH
869} __packed;
870
a9de9248 871#define HCI_OP_SNIFF_MODE 0x0803
04837f64
MH
872struct hci_cp_sniff_mode {
873 __le16 handle;
874 __le16 max_interval;
875 __le16 min_interval;
876 __le16 attempt;
877 __le16 timeout;
66c853cc 878} __packed;
04837f64 879
a9de9248 880#define HCI_OP_EXIT_SNIFF_MODE 0x0804
04837f64
MH
881struct hci_cp_exit_sniff_mode {
882 __le16 handle;
66c853cc 883} __packed;
04837f64 884
a9de9248 885#define HCI_OP_ROLE_DISCOVERY 0x0809
1da177e4 886struct hci_cp_role_discovery {
1ebb9252 887 __le16 handle;
66c853cc 888} __packed;
1da177e4
LT
889struct hci_rp_role_discovery {
890 __u8 status;
1ebb9252 891 __le16 handle;
1da177e4 892 __u8 role;
66c853cc 893} __packed;
1da177e4 894
a9de9248
MH
895#define HCI_OP_SWITCH_ROLE 0x080b
896struct hci_cp_switch_role {
897 bdaddr_t bdaddr;
898 __u8 role;
66c853cc 899} __packed;
a9de9248
MH
900
901#define HCI_OP_READ_LINK_POLICY 0x080c
1da177e4 902struct hci_cp_read_link_policy {
1ebb9252 903 __le16 handle;
66c853cc 904} __packed;
1da177e4
LT
905struct hci_rp_read_link_policy {
906 __u8 status;
1ebb9252
MH
907 __le16 handle;
908 __le16 policy;
66c853cc 909} __packed;
1da177e4 910
a9de9248 911#define HCI_OP_WRITE_LINK_POLICY 0x080d
1da177e4 912struct hci_cp_write_link_policy {
1ebb9252
MH
913 __le16 handle;
914 __le16 policy;
66c853cc 915} __packed;
1da177e4
LT
916struct hci_rp_write_link_policy {
917 __u8 status;
1ebb9252 918 __le16 handle;
66c853cc 919} __packed;
e4e8e37c
MH
920
921#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
922struct hci_rp_read_def_link_policy {
923 __u8 status;
924 __le16 policy;
66c853cc 925} __packed;
e4e8e37c
MH
926
927#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
928struct hci_cp_write_def_link_policy {
929 __le16 policy;
66c853cc 930} __packed;
1da177e4 931
a9de9248 932#define HCI_OP_SNIFF_SUBRATE 0x0811
04837f64
MH
933struct hci_cp_sniff_subrate {
934 __le16 handle;
935 __le16 max_latency;
936 __le16 min_remote_timeout;
937 __le16 min_local_timeout;
66c853cc 938} __packed;
04837f64 939
a9de9248 940#define HCI_OP_SET_EVENT_MASK 0x0c01
1da177e4 941
a9de9248 942#define HCI_OP_RESET 0x0c03
1da177e4 943
a9de9248
MH
944#define HCI_OP_SET_EVENT_FLT 0x0c05
945struct hci_cp_set_event_flt {
946 __u8 flt_type;
947 __u8 cond_type;
a7e45454 948 __u8 condition[];
66c853cc 949} __packed;
1da177e4 950
a9de9248
MH
951/* Filter types */
952#define HCI_FLT_CLEAR_ALL 0x00
953#define HCI_FLT_INQ_RESULT 0x01
954#define HCI_FLT_CONN_SETUP 0x02
1da177e4 955
a9de9248
MH
956/* CONN_SETUP Condition types */
957#define HCI_CONN_SETUP_ALLOW_ALL 0x00
958#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
959#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
960
961/* CONN_SETUP Conditions */
962#define HCI_CONN_SETUP_AUTO_OFF 0x01
963#define HCI_CONN_SETUP_AUTO_ON 0x02
964
cb962780
MH
965#define HCI_OP_READ_STORED_LINK_KEY 0x0c0d
966struct hci_cp_read_stored_link_key {
967 bdaddr_t bdaddr;
968 __u8 read_all;
969} __packed;
970struct hci_rp_read_stored_link_key {
971 __u8 status;
972 __u8 max_keys;
973 __u8 num_keys;
974} __packed;
975
b0916ea0
JH
976#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
977struct hci_cp_delete_stored_link_key {
978 bdaddr_t bdaddr;
979 __u8 delete_all;
980} __packed;
039d4e41
MH
981struct hci_rp_delete_stored_link_key {
982 __u8 status;
983 __u8 num_keys;
984} __packed;
b0916ea0 985
1f6c6378
JH
986#define HCI_MAX_NAME_LENGTH 248
987
a9de9248
MH
988#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
989struct hci_cp_write_local_name {
1f6c6378 990 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 991} __packed;
a9de9248
MH
992
993#define HCI_OP_READ_LOCAL_NAME 0x0c14
994struct hci_rp_read_local_name {
995 __u8 status;
1f6c6378 996 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 997} __packed;
a9de9248
MH
998
999#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
1000
1001#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
1002
70f23020 1003#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
a9de9248
MH
1004 #define SCAN_DISABLED 0x00
1005 #define SCAN_INQUIRY 0x01
1006 #define SCAN_PAGE 0x02
1007
1008#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
1009
1010#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
1011 #define AUTH_DISABLED 0x00
1012 #define AUTH_ENABLED 0x01
1013
1014#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
1015
1016#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
1017 #define ENCRYPT_DISABLED 0x00
1018 #define ENCRYPT_P2P 0x01
1019 #define ENCRYPT_BOTH 0x02
1020
1021#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
1022struct hci_rp_read_class_of_dev {
1023 __u8 status;
1da177e4 1024 __u8 dev_class[3];
66c853cc 1025} __packed;
1da177e4 1026
a9de9248
MH
1027#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
1028struct hci_cp_write_class_of_dev {
1da177e4 1029 __u8 dev_class[3];
66c853cc 1030} __packed;
a9de9248
MH
1031
1032#define HCI_OP_READ_VOICE_SETTING 0x0c25
1033struct hci_rp_read_voice_setting {
1034 __u8 status;
1035 __le16 voice_setting;
66c853cc 1036} __packed;
a9de9248
MH
1037
1038#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
1039struct hci_cp_write_voice_setting {
1040 __le16 voice_setting;
66c853cc 1041} __packed;
a9de9248
MH
1042
1043#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
1044struct hci_cp_host_buffer_size {
1045 __le16 acl_mtu;
1046 __u8 sco_mtu;
1047 __le16 acl_max_pkt;
1048 __le16 sco_max_pkt;
66c853cc 1049} __packed;
a9de9248 1050
b4cb9fb2
MH
1051#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
1052struct hci_rp_read_num_supported_iac {
1053 __u8 status;
1054 __u8 num_iac;
1055} __packed;
1056
4b836f39
MH
1057#define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39
1058
3d505312
MH
1059#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
1060struct hci_cp_write_current_iac_lap {
1061 __u8 num_iac;
1062 __u8 iac_lap[6];
1063} __packed;
1064
d5859e22
JH
1065#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
1066
80a1e1db
JH
1067#define HCI_MAX_EIR_LENGTH 240
1068
1069#define HCI_OP_WRITE_EIR 0x0c52
1070struct hci_cp_write_eir {
f64b993f
GP
1071 __u8 fec;
1072 __u8 data[HCI_MAX_EIR_LENGTH];
80a1e1db
JH
1073} __packed;
1074
333140b5
MH
1075#define HCI_OP_READ_SSP_MODE 0x0c55
1076struct hci_rp_read_ssp_mode {
1077 __u8 status;
1078 __u8 mode;
66c853cc 1079} __packed;
333140b5
MH
1080
1081#define HCI_OP_WRITE_SSP_MODE 0x0c56
1082struct hci_cp_write_ssp_mode {
1083 __u8 mode;
66c853cc 1084} __packed;
333140b5 1085
c35938b2
SJ
1086#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
1087struct hci_rp_read_local_oob_data {
1088 __u8 status;
1089 __u8 hash[16];
38da1703 1090 __u8 rand[16];
c35938b2
SJ
1091} __packed;
1092
d5859e22 1093#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
91c4e9b1
MH
1094struct hci_rp_read_inq_rsp_tx_power {
1095 __u8 status;
1096 __s8 tx_power;
1097} __packed;
d5859e22 1098
00bce3fb
AM
1099#define HCI_OP_READ_DEF_ERR_DATA_REPORTING 0x0c5a
1100 #define ERR_DATA_REPORTING_DISABLED 0x00
1101 #define ERR_DATA_REPORTING_ENABLED 0x01
1102struct hci_rp_read_def_err_data_reporting {
1103 __u8 status;
1104 __u8 err_data_reporting;
1105} __packed;
1106
1107#define HCI_OP_WRITE_DEF_ERR_DATA_REPORTING 0x0c5b
1108struct hci_cp_write_def_err_data_reporting {
1109 __u8 err_data_reporting;
1110} __packed;
1111
d62e6d67
JH
1112#define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63
1113
7528ca1c
MH
1114#define HCI_OP_READ_LOCATION_DATA 0x0c64
1115
1e89cffb
AE
1116#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
1117struct hci_rp_read_flow_control_mode {
1118 __u8 status;
1119 __u8 mode;
1120} __packed;
1121
f9b49306
AG
1122#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
1123struct hci_cp_write_le_host_supported {
f64b993f
GP
1124 __u8 le;
1125 __u8 simul;
f9b49306
AG
1126} __packed;
1127
d0bf75a5
DP
1128#define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74
1129struct hci_cp_set_reserved_lt_addr {
1130 __u8 lt_addr;
1131} __packed;
1132struct hci_rp_set_reserved_lt_addr {
1133 __u8 status;
1134 __u8 lt_addr;
1135} __packed;
1136
6a20eaf4
DP
1137#define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75
1138struct hci_cp_delete_reserved_lt_addr {
1139 __u8 lt_addr;
1140} __packed;
1141struct hci_rp_delete_reserved_lt_addr {
1142 __u8 status;
1143 __u8 lt_addr;
1144} __packed;
1145
7d1dab49
DP
1146#define HCI_OP_SET_CSB_DATA 0x0c76
1147struct hci_cp_set_csb_data {
1148 __u8 lt_addr;
1149 __u8 fragment;
1150 __u8 data_length;
1151 __u8 data[HCI_MAX_CSB_DATA_SIZE];
1152} __packed;
1153struct hci_rp_set_csb_data {
1154 __u8 status;
1155 __u8 lt_addr;
1156} __packed;
1157
5d4e7e8d
JH
1158#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
1159
a9b07a64
DP
1160#define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78
1161struct hci_cp_write_sync_train_params {
1162 __le16 interval_min;
1163 __le16 interval_max;
1164 __le32 sync_train_tout;
1165 __u8 service_data;
1166} __packed;
1167struct hci_rp_write_sync_train_params {
1168 __u8 status;
1169 __le16 sync_train_int;
1170} __packed;
1171
eb4b95c6
MH
1172#define HCI_OP_READ_SC_SUPPORT 0x0c79
1173struct hci_rp_read_sc_support {
1174 __u8 status;
1175 __u8 support;
1176} __packed;
1177
1178#define HCI_OP_WRITE_SC_SUPPORT 0x0c7a
1179struct hci_cp_write_sc_support {
1180 __u8 support;
1181} __packed;
1182
302975cb
SRK
1183#define HCI_OP_READ_AUTH_PAYLOAD_TO 0x0c7b
1184struct hci_cp_read_auth_payload_to {
1185 __le16 handle;
1186} __packed;
1187struct hci_rp_read_auth_payload_to {
1188 __u8 status;
1189 __le16 handle;
1190 __le16 timeout;
1191} __packed;
1192
1193#define HCI_OP_WRITE_AUTH_PAYLOAD_TO 0x0c7c
1194struct hci_cp_write_auth_payload_to {
1195 __le16 handle;
1196 __le16 timeout;
1197} __packed;
1198struct hci_rp_write_auth_payload_to {
1199 __u8 status;
1200 __le16 handle;
1201} __packed;
1202
e2f99131
MH
1203#define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d
1204struct hci_rp_read_local_oob_ext_data {
1205 __u8 status;
1206 __u8 hash192[16];
38da1703 1207 __u8 rand192[16];
e2f99131 1208 __u8 hash256[16];
38da1703 1209 __u8 rand256[16];
e2f99131
MH
1210} __packed;
1211
a9de9248
MH
1212#define HCI_OP_READ_LOCAL_VERSION 0x1001
1213struct hci_rp_read_local_version {
1214 __u8 status;
1215 __u8 hci_ver;
1216 __le16 hci_rev;
1217 __u8 lmp_ver;
1218 __le16 manufacturer;
1219 __le16 lmp_subver;
66c853cc 1220} __packed;
a9de9248
MH
1221
1222#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
1223struct hci_rp_read_local_commands {
1224 __u8 status;
1225 __u8 commands[64];
66c853cc 1226} __packed;
a9de9248
MH
1227
1228#define HCI_OP_READ_LOCAL_FEATURES 0x1003
1229struct hci_rp_read_local_features {
1230 __u8 status;
1231 __u8 features[8];
66c853cc 1232} __packed;
a9de9248
MH
1233
1234#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
971e3a4b
AG
1235struct hci_cp_read_local_ext_features {
1236 __u8 page;
1237} __packed;
a9de9248
MH
1238struct hci_rp_read_local_ext_features {
1239 __u8 status;
1240 __u8 page;
1241 __u8 max_page;
1242 __u8 features[8];
66c853cc 1243} __packed;
a9de9248
MH
1244
1245#define HCI_OP_READ_BUFFER_SIZE 0x1005
1246struct hci_rp_read_buffer_size {
1247 __u8 status;
1248 __le16 acl_mtu;
1249 __u8 sco_mtu;
1250 __le16 acl_max_pkt;
1251 __le16 sco_max_pkt;
66c853cc 1252} __packed;
a9de9248
MH
1253
1254#define HCI_OP_READ_BD_ADDR 0x1009
1255struct hci_rp_read_bd_addr {
1256 __u8 status;
45bb4bf0 1257 bdaddr_t bdaddr;
66c853cc 1258} __packed;
1da177e4 1259
350ee4cf
AE
1260#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
1261struct hci_rp_read_data_block_size {
1262 __u8 status;
1263 __le16 max_acl_len;
1264 __le16 block_len;
1265 __le16 num_blocks;
1266} __packed;
1267
109e3191
MH
1268#define HCI_OP_READ_LOCAL_CODECS 0x100b
1269
f332ec66
JH
1270#define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
1271struct hci_rp_read_page_scan_activity {
1272 __u8 status;
1273 __le16 interval;
1274 __le16 window;
1275} __packed;
1276
f6422ec6
AJ
1277#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
1278struct hci_cp_write_page_scan_activity {
1279 __le16 interval;
1280 __le16 window;
1281} __packed;
1282
5a134fae
AK
1283#define HCI_OP_READ_TX_POWER 0x0c2d
1284struct hci_cp_read_tx_power {
1285 __le16 handle;
1286 __u8 type;
1287} __packed;
1288struct hci_rp_read_tx_power {
1289 __u8 status;
1290 __le16 handle;
1291 __s8 tx_power;
1292} __packed;
1293
f332ec66
JH
1294#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46
1295struct hci_rp_read_page_scan_type {
1296 __u8 status;
1297 __u8 type;
1298} __packed;
1299
f6422ec6
AJ
1300#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
1301 #define PAGE_SCAN_TYPE_STANDARD 0x00
1302 #define PAGE_SCAN_TYPE_INTERLACED 0x01
1303
5ae76a94
AK
1304#define HCI_OP_READ_RSSI 0x1405
1305struct hci_cp_read_rssi {
1306 __le16 handle;
1307} __packed;
1308struct hci_rp_read_rssi {
1309 __u8 status;
1310 __le16 handle;
1311 __s8 rssi;
1312} __packed;
1313
33f35721
JH
1314#define HCI_OP_READ_CLOCK 0x1407
1315struct hci_cp_read_clock {
1316 __le16 handle;
1317 __u8 which;
1318} __packed;
1319struct hci_rp_read_clock {
1320 __u8 status;
1321 __le16 handle;
1322 __le32 clock;
1323 __le16 accuracy;
1324} __packed;
1325
821f3766
JH
1326#define HCI_OP_READ_ENC_KEY_SIZE 0x1408
1327struct hci_cp_read_enc_key_size {
1328 __le16 handle;
1329} __packed;
1330struct hci_rp_read_enc_key_size {
1331 __u8 status;
1332 __le16 handle;
1333 __u8 key_size;
1334} __packed;
1335
928abaa7
AE
1336#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
1337struct hci_rp_read_local_amp_info {
1338 __u8 status;
1339 __u8 amp_status;
1340 __le32 total_bw;
1341 __le32 max_bw;
1342 __le32 min_latency;
1343 __le32 max_pdu;
1344 __u8 amp_type;
1345 __le16 pal_cap;
1346 __le16 max_assoc_size;
1347 __le32 max_flush_to;
1348 __le32 be_flush_to;
1349} __packed;
1350
523e93cd
AE
1351#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
1352struct hci_cp_read_local_amp_assoc {
1353 __u8 phy_handle;
1354 __le16 len_so_far;
1355 __le16 max_len;
1356} __packed;
1357struct hci_rp_read_local_amp_assoc {
1358 __u8 status;
1359 __u8 phy_handle;
1360 __le16 rem_len;
a7e45454 1361 __u8 frag[];
523e93cd
AE
1362} __packed;
1363
1364#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
1365struct hci_cp_write_remote_amp_assoc {
1366 __u8 phy_handle;
1367 __le16 len_so_far;
1368 __le16 rem_len;
a7e45454 1369 __u8 frag[];
523e93cd
AE
1370} __packed;
1371struct hci_rp_write_remote_amp_assoc {
1372 __u8 status;
1373 __u8 phy_handle;
1374} __packed;
1375
f4fe73ed
MH
1376#define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c
1377
4b4148e9
MH
1378#define HCI_OP_ENABLE_DUT_MODE 0x1803
1379
06f5b778
MH
1380#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
1381
63185f64
VT
1382#define HCI_OP_LE_SET_EVENT_MASK 0x2001
1383struct hci_cp_le_set_event_mask {
1384 __u8 mask[8];
1385} __packed;
1386
1387#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
1388struct hci_rp_le_read_buffer_size {
1389 __u8 status;
1390 __le16 le_mtu;
1391 __u8 le_max_pkt;
1392} __packed;
1393
60e77321
JH
1394#define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003
1395struct hci_rp_le_read_local_features {
1396 __u8 status;
1397 __u8 features[8];
1398} __packed;
1399
d13eafce
MH
1400#define HCI_OP_LE_SET_RANDOM_ADDR 0x2005
1401
1e191893
MH
1402#define HCI_OP_LE_SET_ADV_PARAM 0x2006
1403struct hci_cp_le_set_adv_param {
1404 __le16 min_interval;
1405 __le16 max_interval;
1406 __u8 type;
1407 __u8 own_address_type;
1408 __u8 direct_addr_type;
1409 bdaddr_t direct_addr;
1410 __u8 channel_map;
1411 __u8 filter_policy;
1412} __packed;
1413
8fa19098
JH
1414#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
1415struct hci_rp_le_read_adv_tx_power {
1416 __u8 status;
1417 __s8 tx_power;
1418} __packed;
1419
3f0f524b
JH
1420#define HCI_MAX_AD_LENGTH 31
1421
1422#define HCI_OP_LE_SET_ADV_DATA 0x2008
1423struct hci_cp_le_set_adv_data {
1424 __u8 length;
1425 __u8 data[HCI_MAX_AD_LENGTH];
1426} __packed;
1427
f14d8f64
MH
1428#define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009
1429struct hci_cp_le_set_scan_rsp_data {
1430 __u8 length;
1431 __u8 data[HCI_MAX_AD_LENGTH];
1432} __packed;
1433
c1d5dc4a
JH
1434#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
1435
5df480b5
AG
1436#define LE_SCAN_PASSIVE 0x00
1437#define LE_SCAN_ACTIVE 0x01
1438
07f7fa5d
AG
1439#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
1440struct hci_cp_le_set_scan_param {
1441 __u8 type;
1442 __le16 interval;
1443 __le16 window;
1444 __u8 own_address_type;
1445 __u8 filter_policy;
1446} __packed;
1447
76a388be
AG
1448#define LE_SCAN_DISABLE 0x00
1449#define LE_SCAN_ENABLE 0x01
525e296a
AG
1450#define LE_SCAN_FILTER_DUP_DISABLE 0x00
1451#define LE_SCAN_FILTER_DUP_ENABLE 0x01
68a8aea4 1452
eb9d91f5
AG
1453#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
1454struct hci_cp_le_set_scan_enable {
1455 __u8 enable;
1456 __u8 filter_dup;
1457} __packed;
1458
a7139edd
JH
1459#define HCI_LE_USE_PEER_ADDR 0x00
1460#define HCI_LE_USE_WHITELIST 0x01
1461
63185f64
VT
1462#define HCI_OP_LE_CREATE_CONN 0x200d
1463struct hci_cp_le_create_conn {
1464 __le16 scan_interval;
1465 __le16 scan_window;
1466 __u8 filter_policy;
1467 __u8 peer_addr_type;
1468 bdaddr_t peer_addr;
1469 __u8 own_address_type;
1470 __le16 conn_interval_min;
1471 __le16 conn_interval_max;
1472 __le16 conn_latency;
1473 __le16 supervision_timeout;
1474 __le16 min_ce_len;
1475 __le16 max_ce_len;
1476} __packed;
1477
1478#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
1479
cf1d081f
JH
1480#define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200f
1481struct hci_rp_le_read_white_list_size {
1482 __u8 status;
1483 __u8 size;
1484} __packed;
1485
d9a7b0a5
MH
1486#define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010
1487
1488#define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011
1489struct hci_cp_le_add_to_white_list {
1490 __u8 bdaddr_type;
1491 bdaddr_t bdaddr;
1492} __packed;
1493
1494#define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012
1495struct hci_cp_le_del_from_white_list {
1496 __u8 bdaddr_type;
1497 bdaddr_t bdaddr;
1498} __packed;
1499
2ce603eb
CT
1500#define HCI_OP_LE_CONN_UPDATE 0x2013
1501struct hci_cp_le_conn_update {
1502 __le16 handle;
1503 __le16 conn_interval_min;
1504 __le16 conn_interval_max;
1505 __le16 conn_latency;
1506 __le16 supervision_timeout;
1507 __le16 min_ce_len;
1508 __le16 max_ce_len;
1509} __packed;
1510
0fe29fd1
MH
1511#define HCI_OP_LE_READ_REMOTE_FEATURES 0x2016
1512struct hci_cp_le_read_remote_features {
1513 __le16 handle;
1514} __packed;
1515
a7a595f6
VCG
1516#define HCI_OP_LE_START_ENC 0x2019
1517struct hci_cp_le_start_enc {
1518 __le16 handle;
fe39c7b2 1519 __le64 rand;
a7a595f6
VCG
1520 __le16 ediv;
1521 __u8 ltk[16];
1522} __packed;
1523
1524#define HCI_OP_LE_LTK_REPLY 0x201a
1525struct hci_cp_le_ltk_reply {
1526 __le16 handle;
1527 __u8 ltk[16];
1528} __packed;
1529struct hci_rp_le_ltk_reply {
1530 __u8 status;
1531 __le16 handle;
1532} __packed;
1533
1534#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
1535struct hci_cp_le_ltk_neg_reply {
1536 __le16 handle;
1537} __packed;
1538struct hci_rp_le_ltk_neg_reply {
1539 __u8 status;
1540 __le16 handle;
1541} __packed;
1542
9b008c04
JH
1543#define HCI_OP_LE_READ_SUPPORTED_STATES 0x201c
1544struct hci_rp_le_read_supported_states {
1545 __u8 status;
1546 __u8 le_states[8];
1547} __packed;
1548
8e75b46a
AG
1549#define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020
1550struct hci_cp_le_conn_param_req_reply {
1551 __le16 handle;
1552 __le16 interval_min;
1553 __le16 interval_max;
1554 __le16 latency;
1555 __le16 timeout;
1556 __le16 min_ce_len;
1557 __le16 max_ce_len;
1558} __packed;
1559
1560#define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021
1561struct hci_cp_le_conn_param_req_neg_reply {
1562 __le16 handle;
1563 __u8 reason;
1564} __packed;
1565
94a3bd02
MH
1566#define HCI_OP_LE_SET_DATA_LEN 0x2022
1567struct hci_cp_le_set_data_len {
1568 __le16 handle;
1569 __le16 tx_len;
1570 __le16 tx_time;
1571} __packed;
1572struct hci_rp_le_set_data_len {
1573 __u8 status;
1574 __le16 handle;
1575} __packed;
1576
1577#define HCI_OP_LE_READ_DEF_DATA_LEN 0x2023
1578struct hci_rp_le_read_def_data_len {
1579 __u8 status;
1580 __le16 tx_len;
1581 __le16 tx_time;
1582} __packed;
1583
1584#define HCI_OP_LE_WRITE_DEF_DATA_LEN 0x2024
1585struct hci_cp_le_write_def_data_len {
1586 __le16 tx_len;
1587 __le16 tx_time;
1588} __packed;
1589
b950aa88
AN
1590#define HCI_OP_LE_ADD_TO_RESOLV_LIST 0x2027
1591struct hci_cp_le_add_to_resolv_list {
1592 __u8 bdaddr_type;
1593 bdaddr_t bdaddr;
1594 __u8 peer_irk[16];
1595 __u8 local_irk[16];
1596} __packed;
1597
1598#define HCI_OP_LE_DEL_FROM_RESOLV_LIST 0x2028
1599struct hci_cp_le_del_from_resolv_list {
1600 __u8 bdaddr_type;
1601 bdaddr_t bdaddr;
1602} __packed;
1603
545f2596
AN
1604#define HCI_OP_LE_CLEAR_RESOLV_LIST 0x2029
1605
cfdb0c2d
AN
1606#define HCI_OP_LE_READ_RESOLV_LIST_SIZE 0x202a
1607struct hci_rp_le_read_resolv_list_size {
1608 __u8 status;
1609 __u8 size;
1610} __packed;
1611
aa12af77
AN
1612#define HCI_OP_LE_SET_ADDR_RESOLV_ENABLE 0x202d
1613
94a3bd02
MH
1614#define HCI_OP_LE_READ_MAX_DATA_LEN 0x202f
1615struct hci_rp_le_read_max_data_len {
1616 __u8 status;
1617 __le16 tx_len;
1618 __le16 tx_time;
1619 __le16 rx_len;
1620 __le16 rx_time;
1621} __packed;
1622
de2ba303
MH
1623#define HCI_OP_LE_SET_DEFAULT_PHY 0x2031
1624struct hci_cp_le_set_default_phy {
1625 __u8 all_phys;
1626 __u8 tx_phys;
1627 __u8 rx_phys;
1628} __packed;
1629
6decb5b4
JK
1630#define HCI_LE_SET_PHY_1M 0x01
1631#define HCI_LE_SET_PHY_2M 0x02
1632#define HCI_LE_SET_PHY_CODED 0x04
1633
a2344b9e
JK
1634#define HCI_OP_LE_SET_EXT_SCAN_PARAMS 0x2041
1635struct hci_cp_le_set_ext_scan_params {
1636 __u8 own_addr_type;
1637 __u8 filter_policy;
1638 __u8 scanning_phys;
a7e45454 1639 __u8 data[];
a2344b9e
JK
1640} __packed;
1641
45bdd86e
JK
1642#define LE_SCAN_PHY_1M 0x01
1643#define LE_SCAN_PHY_2M 0x02
1644#define LE_SCAN_PHY_CODED 0x04
a2344b9e
JK
1645
1646struct hci_cp_le_scan_phy_params {
1647 __u8 type;
1648 __le16 interval;
1649 __le16 window;
1650} __packed;
1651
1652#define HCI_OP_LE_SET_EXT_SCAN_ENABLE 0x2042
1653struct hci_cp_le_set_ext_scan_enable {
1654 __u8 enable;
1655 __u8 filter_dup;
1656 __le16 duration;
1657 __le16 period;
1658} __packed;
1659
4d94f95d
JK
1660#define HCI_OP_LE_EXT_CREATE_CONN 0x2043
1661struct hci_cp_le_ext_create_conn {
1662 __u8 filter_policy;
1663 __u8 own_addr_type;
1664 __u8 peer_addr_type;
1665 bdaddr_t peer_addr;
1666 __u8 phys;
a7e45454 1667 __u8 data[];
4d94f95d
JK
1668} __packed;
1669
1670struct hci_cp_le_ext_conn_param {
1671 __le16 scan_interval;
1672 __le16 scan_window;
1673 __le16 conn_interval_min;
1674 __le16 conn_interval_max;
1675 __le16 conn_latency;
1676 __le16 supervision_timeout;
1677 __le16 min_ce_len;
1678 __le16 max_ce_len;
1679} __packed;
1680
6b49bcb4
JK
1681#define HCI_OP_LE_READ_NUM_SUPPORTED_ADV_SETS 0x203b
1682struct hci_rp_le_read_num_supported_adv_sets {
1683 __u8 status;
1684 __u8 num_of_sets;
1685} __packed;
1686
de181e88
JK
1687#define HCI_OP_LE_SET_EXT_ADV_PARAMS 0x2036
1688struct hci_cp_le_set_ext_adv_params {
1689 __u8 handle;
1690 __le16 evt_properties;
1691 __u8 min_interval[3];
1692 __u8 max_interval[3];
1693 __u8 channel_map;
1694 __u8 own_addr_type;
1695 __u8 peer_addr_type;
1696 bdaddr_t peer_addr;
1697 __u8 filter_policy;
1698 __u8 tx_power;
1699 __u8 primary_phy;
1700 __u8 secondary_max_skip;
1701 __u8 secondary_phy;
1702 __u8 sid;
1703 __u8 notif_enable;
1704} __packed;
1705
1706#define HCI_ADV_PHY_1M 0X01
85a721a8
JK
1707#define HCI_ADV_PHY_2M 0x02
1708#define HCI_ADV_PHY_CODED 0x03
de181e88
JK
1709
1710struct hci_rp_le_set_ext_adv_params {
1711 __u8 status;
1712 __u8 tx_power;
1713} __packed;
1714
1715#define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039
1716struct hci_cp_le_set_ext_adv_enable {
1717 __u8 enable;
1718 __u8 num_of_sets;
a7e45454 1719 __u8 data[];
de181e88
JK
1720} __packed;
1721
1722struct hci_cp_ext_adv_set {
1723 __u8 handle;
1724 __le16 duration;
1725 __u8 max_events;
1726} __packed;
1727
a0fb3726
JK
1728#define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037
1729struct hci_cp_le_set_ext_adv_data {
1730 __u8 handle;
1731 __u8 operation;
1732 __u8 frag_pref;
1733 __u8 length;
1734 __u8 data[HCI_MAX_AD_LENGTH];
1735} __packed;
1736
1737#define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038
1738struct hci_cp_le_set_ext_scan_rsp_data {
1739 __u8 handle;
1740 __u8 operation;
1741 __u8 frag_pref;
1742 __u8 length;
1743 __u8 data[HCI_MAX_AD_LENGTH];
1744} __packed;
1745
1746#define LE_SET_ADV_DATA_OP_COMPLETE 0x03
1747
1748#define LE_SET_ADV_DATA_NO_FRAG 0x01
1749
a9e45698
SN
1750#define HCI_OP_LE_REMOVE_ADV_SET 0x203c
1751
45b7749f
JK
1752#define HCI_OP_LE_CLEAR_ADV_SETS 0x203d
1753
a73c046a
JK
1754#define HCI_OP_LE_SET_ADV_SET_RAND_ADDR 0x2035
1755struct hci_cp_le_set_adv_set_rand_addr {
1756 __u8 handle;
1757 bdaddr_t bdaddr;
1758} __packed;
1759
4de0fc59
LAD
1760#define HCI_OP_LE_READ_BUFFER_SIZE_V2 0x2060
1761struct hci_rp_le_read_buffer_size_v2 {
1762 __u8 status;
1763 __le16 acl_mtu;
1764 __u8 acl_max_pkt;
1765 __le16 iso_mtu;
1766 __u8 iso_max_pkt;
1767} __packed;
1768
1769#define HCI_OP_LE_READ_ISO_TX_SYNC 0x2061
1770struct hci_cp_le_read_iso_tx_sync {
1771 __le16 handle;
1772} __packed;
1773
1774struct hci_rp_le_read_iso_tx_sync {
1775 __u8 status;
1776 __le16 handle;
1777 __le16 seq;
1778 __le32 imestamp;
1779 __u8 offset[3];
1780} __packed;
1781
1782#define HCI_OP_LE_SET_CIG_PARAMS 0x2062
1783struct hci_cis_params {
1784 __u8 cis_id;
1785 __le16 m_sdu;
1786 __le16 s_sdu;
1787 __u8 m_phy;
1788 __u8 s_phy;
1789 __u8 m_rtn;
1790 __u8 s_rtn;
1791} __packed;
1792
1793struct hci_cp_le_set_cig_params {
1794 __u8 cig_id;
1795 __u8 m_interval[3];
1796 __u8 s_interval[3];
1797 __u8 sca;
1798 __u8 packing;
1799 __u8 framing;
1800 __le16 m_latency;
1801 __le16 s_latency;
1802 __u8 num_cis;
a7e45454 1803 struct hci_cis_params cis[];
4de0fc59
LAD
1804} __packed;
1805
1806struct hci_rp_le_set_cig_params {
1807 __u8 status;
1808 __u8 cig_id;
1809 __u8 num_handles;
a7e45454 1810 __le16 handle[];
4de0fc59
LAD
1811} __packed;
1812
1813#define HCI_OP_LE_CREATE_CIS 0x2064
1814struct hci_cis {
1815 __le16 cis_handle;
1816 __le16 acl_handle;
1817} __packed;
1818
1819struct hci_cp_le_create_cis {
1820 __u8 num_cis;
a7e45454 1821 struct hci_cis cis[];
4de0fc59
LAD
1822} __packed;
1823
1824#define HCI_OP_LE_REMOVE_CIG 0x2065
1825struct hci_cp_le_remove_cig {
1826 __u8 cig_id;
1827} __packed;
1828
1829#define HCI_OP_LE_ACCEPT_CIS 0x2066
1830struct hci_cp_le_accept_cis {
1831 __le16 handle;
1832} __packed;
1833
1834#define HCI_OP_LE_REJECT_CIS 0x2067
1835struct hci_cp_le_reject_cis {
1836 __le16 handle;
1837 __u8 reason;
1838} __packed;
1839
a9de9248
MH
1840/* ---- HCI Events ---- */
1841#define HCI_EV_INQUIRY_COMPLETE 0x01
1842
1843#define HCI_EV_INQUIRY_RESULT 0x02
1844struct inquiry_info {
21d9e30e
MH
1845 bdaddr_t bdaddr;
1846 __u8 pscan_rep_mode;
1847 __u8 pscan_period_mode;
a9de9248 1848 __u8 pscan_mode;
21d9e30e 1849 __u8 dev_class[3];
1ebb9252 1850 __le16 clock_offset;
66c853cc 1851} __packed;
21d9e30e 1852
a9de9248 1853#define HCI_EV_CONN_COMPLETE 0x03
1da177e4
LT
1854struct hci_ev_conn_complete {
1855 __u8 status;
1ebb9252 1856 __le16 handle;
1da177e4
LT
1857 bdaddr_t bdaddr;
1858 __u8 link_type;
1859 __u8 encr_mode;
66c853cc 1860} __packed;
1da177e4 1861
a9de9248 1862#define HCI_EV_CONN_REQUEST 0x04
1da177e4
LT
1863struct hci_ev_conn_request {
1864 bdaddr_t bdaddr;
1865 __u8 dev_class[3];
1866 __u8 link_type;
66c853cc 1867} __packed;
1da177e4 1868
a9de9248 1869#define HCI_EV_DISCONN_COMPLETE 0x05
1da177e4
LT
1870struct hci_ev_disconn_complete {
1871 __u8 status;
1ebb9252 1872 __le16 handle;
1da177e4 1873 __u8 reason;
66c853cc 1874} __packed;
1da177e4 1875
a9de9248 1876#define HCI_EV_AUTH_COMPLETE 0x06
1da177e4
LT
1877struct hci_ev_auth_complete {
1878 __u8 status;
1ebb9252 1879 __le16 handle;
66c853cc 1880} __packed;
1da177e4 1881
a9de9248
MH
1882#define HCI_EV_REMOTE_NAME 0x07
1883struct hci_ev_remote_name {
1884 __u8 status;
1885 bdaddr_t bdaddr;
1f6c6378 1886 __u8 name[HCI_MAX_NAME_LENGTH];
66c853cc 1887} __packed;
a9de9248
MH
1888
1889#define HCI_EV_ENCRYPT_CHANGE 0x08
1da177e4
LT
1890struct hci_ev_encrypt_change {
1891 __u8 status;
1ebb9252 1892 __le16 handle;
1da177e4 1893 __u8 encrypt;
66c853cc 1894} __packed;
1da177e4 1895
a9de9248
MH
1896#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1897struct hci_ev_change_link_key_complete {
1898 __u8 status;
1899 __le16 handle;
66c853cc 1900} __packed;
a9de9248
MH
1901
1902#define HCI_EV_REMOTE_FEATURES 0x0b
1903struct hci_ev_remote_features {
1904 __u8 status;
1905 __le16 handle;
1906 __u8 features[8];
66c853cc 1907} __packed;
a9de9248
MH
1908
1909#define HCI_EV_REMOTE_VERSION 0x0c
1910struct hci_ev_remote_version {
1da177e4 1911 __u8 status;
1ebb9252 1912 __le16 handle;
a9de9248
MH
1913 __u8 lmp_ver;
1914 __le16 manufacturer;
1915 __le16 lmp_subver;
66c853cc 1916} __packed;
1da177e4 1917
a9de9248 1918#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1da177e4
LT
1919struct hci_qos {
1920 __u8 service_type;
1921 __u32 token_rate;
1922 __u32 peak_bandwidth;
1923 __u32 latency;
1924 __u32 delay_variation;
66c853cc 1925} __packed;
1da177e4
LT
1926struct hci_ev_qos_setup_complete {
1927 __u8 status;
1ebb9252 1928 __le16 handle;
1da177e4 1929 struct hci_qos qos;
66c853cc 1930} __packed;
1da177e4 1931
a9de9248 1932#define HCI_EV_CMD_COMPLETE 0x0e
1da177e4
LT
1933struct hci_ev_cmd_complete {
1934 __u8 ncmd;
1ebb9252 1935 __le16 opcode;
66c853cc 1936} __packed;
1da177e4 1937
a9de9248 1938#define HCI_EV_CMD_STATUS 0x0f
1da177e4
LT
1939struct hci_ev_cmd_status {
1940 __u8 status;
1941 __u8 ncmd;
1ebb9252 1942 __le16 opcode;
66c853cc 1943} __packed;
1da177e4 1944
24dfa343
MH
1945#define HCI_EV_HARDWARE_ERROR 0x10
1946struct hci_ev_hardware_error {
1947 __u8 code;
1948} __packed;
1949
a9de9248 1950#define HCI_EV_ROLE_CHANGE 0x12
1da177e4
LT
1951struct hci_ev_role_change {
1952 __u8 status;
1953 bdaddr_t bdaddr;
1954 __u8 role;
66c853cc 1955} __packed;
1da177e4 1956
a9de9248 1957#define HCI_EV_NUM_COMP_PKTS 0x13
613a1c0c
AE
1958struct hci_comp_pkts_info {
1959 __le16 handle;
1960 __le16 count;
1961} __packed;
1962
a9de9248
MH
1963struct hci_ev_num_comp_pkts {
1964 __u8 num_hndl;
a7e45454 1965 struct hci_comp_pkts_info handles[];
66c853cc 1966} __packed;
a9de9248
MH
1967
1968#define HCI_EV_MODE_CHANGE 0x14
1da177e4
LT
1969struct hci_ev_mode_change {
1970 __u8 status;
1ebb9252 1971 __le16 handle;
1da177e4 1972 __u8 mode;
1ebb9252 1973 __le16 interval;
66c853cc 1974} __packed;
1da177e4 1975
a9de9248 1976#define HCI_EV_PIN_CODE_REQ 0x16
1da177e4
LT
1977struct hci_ev_pin_code_req {
1978 bdaddr_t bdaddr;
66c853cc 1979} __packed;
1da177e4 1980
a9de9248 1981#define HCI_EV_LINK_KEY_REQ 0x17
1da177e4
LT
1982struct hci_ev_link_key_req {
1983 bdaddr_t bdaddr;
66c853cc 1984} __packed;
1da177e4 1985
a9de9248 1986#define HCI_EV_LINK_KEY_NOTIFY 0x18
1da177e4
LT
1987struct hci_ev_link_key_notify {
1988 bdaddr_t bdaddr;
9b3b4460 1989 __u8 link_key[HCI_LINK_KEY_SIZE];
a9de9248 1990 __u8 key_type;
66c853cc 1991} __packed;
1da177e4 1992
a9de9248
MH
1993#define HCI_EV_CLOCK_OFFSET 0x1c
1994struct hci_ev_clock_offset {
1da177e4 1995 __u8 status;
1ebb9252 1996 __le16 handle;
a9de9248 1997 __le16 clock_offset;
66c853cc 1998} __packed;
1da177e4 1999
a8746417
MH
2000#define HCI_EV_PKT_TYPE_CHANGE 0x1d
2001struct hci_ev_pkt_type_change {
2002 __u8 status;
2003 __le16 handle;
2004 __le16 pkt_type;
66c853cc 2005} __packed;
a8746417 2006
a9de9248
MH
2007#define HCI_EV_PSCAN_REP_MODE 0x20
2008struct hci_ev_pscan_rep_mode {
2009 bdaddr_t bdaddr;
2010 __u8 pscan_rep_mode;
66c853cc 2011} __packed;
a9de9248
MH
2012
2013#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
2014struct inquiry_info_with_rssi {
2015 bdaddr_t bdaddr;
2016 __u8 pscan_rep_mode;
2017 __u8 pscan_period_mode;
2018 __u8 dev_class[3];
2019 __le16 clock_offset;
2020 __s8 rssi;
66c853cc 2021} __packed;
a9de9248
MH
2022struct inquiry_info_with_rssi_and_pscan_mode {
2023 bdaddr_t bdaddr;
2024 __u8 pscan_rep_mode;
2025 __u8 pscan_period_mode;
2026 __u8 pscan_mode;
2027 __u8 dev_class[3];
2028 __le16 clock_offset;
2029 __s8 rssi;
66c853cc 2030} __packed;
a9de9248
MH
2031
2032#define HCI_EV_REMOTE_EXT_FEATURES 0x23
2033struct hci_ev_remote_ext_features {
1da177e4 2034 __u8 status;
1ebb9252 2035 __le16 handle;
a9de9248
MH
2036 __u8 page;
2037 __u8 max_page;
2038 __u8 features[8];
66c853cc 2039} __packed;
1da177e4 2040
a9de9248
MH
2041#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
2042struct hci_ev_sync_conn_complete {
1da177e4 2043 __u8 status;
1ebb9252 2044 __le16 handle;
a9de9248
MH
2045 bdaddr_t bdaddr;
2046 __u8 link_type;
2047 __u8 tx_interval;
2048 __u8 retrans_window;
2049 __le16 rx_pkt_len;
2050 __le16 tx_pkt_len;
2051 __u8 air_mode;
66c853cc 2052} __packed;
1da177e4 2053
a9de9248
MH
2054#define HCI_EV_SYNC_CONN_CHANGED 0x2d
2055struct hci_ev_sync_conn_changed {
2056 __u8 status;
2057 __le16 handle;
2058 __u8 tx_interval;
2059 __u8 retrans_window;
2060 __le16 rx_pkt_len;
2061 __le16 tx_pkt_len;
66c853cc 2062} __packed;
85a1e930 2063
a9de9248 2064#define HCI_EV_SNIFF_SUBRATE 0x2e
04837f64
MH
2065struct hci_ev_sniff_subrate {
2066 __u8 status;
2067 __le16 handle;
2068 __le16 max_tx_latency;
2069 __le16 max_rx_latency;
2070 __le16 max_remote_timeout;
2071 __le16 max_local_timeout;
66c853cc 2072} __packed;
04837f64 2073
a9de9248
MH
2074#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
2075struct extended_inquiry_info {
2076 bdaddr_t bdaddr;
2077 __u8 pscan_rep_mode;
2078 __u8 pscan_period_mode;
2079 __u8 dev_class[3];
2080 __le16 clock_offset;
2081 __s8 rssi;
2082 __u8 data[240];
66c853cc 2083} __packed;
a9de9248 2084
1c2e0041
JH
2085#define HCI_EV_KEY_REFRESH_COMPLETE 0x30
2086struct hci_ev_key_refresh_complete {
2087 __u8 status;
2088 __le16 handle;
2089} __packed;
2090
0493684e
MH
2091#define HCI_EV_IO_CAPA_REQUEST 0x31
2092struct hci_ev_io_capa_request {
2093 bdaddr_t bdaddr;
66c853cc 2094} __packed;
0493684e 2095
03b555e1
JH
2096#define HCI_EV_IO_CAPA_REPLY 0x32
2097struct hci_ev_io_capa_reply {
2098 bdaddr_t bdaddr;
2099 __u8 capability;
2100 __u8 oob_data;
2101 __u8 authentication;
2102} __packed;
2103
a5c29683
JH
2104#define HCI_EV_USER_CONFIRM_REQUEST 0x33
2105struct hci_ev_user_confirm_req {
2106 bdaddr_t bdaddr;
2107 __le32 passkey;
2108} __packed;
2109
9ad4019a
BG
2110#define HCI_EV_USER_PASSKEY_REQUEST 0x34
2111struct hci_ev_user_passkey_req {
2112 bdaddr_t bdaddr;
2113} __packed;
2114
2763eda6
SJ
2115#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
2116struct hci_ev_remote_oob_data_request {
2117 bdaddr_t bdaddr;
2118} __packed;
2119
0493684e
MH
2120#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
2121struct hci_ev_simple_pair_complete {
2122 __u8 status;
2123 bdaddr_t bdaddr;
66c853cc 2124} __packed;
0493684e 2125
92a25256
JH
2126#define HCI_EV_USER_PASSKEY_NOTIFY 0x3b
2127struct hci_ev_user_passkey_notify {
2128 bdaddr_t bdaddr;
2129 __le32 passkey;
2130} __packed;
2131
2132#define HCI_KEYPRESS_STARTED 0
2133#define HCI_KEYPRESS_ENTERED 1
2134#define HCI_KEYPRESS_ERASED 2
2135#define HCI_KEYPRESS_CLEARED 3
2136#define HCI_KEYPRESS_COMPLETED 4
2137
2138#define HCI_EV_KEYPRESS_NOTIFY 0x3c
2139struct hci_ev_keypress_notify {
2140 bdaddr_t bdaddr;
2141 __u8 type;
2142} __packed;
2143
41a96212
MH
2144#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
2145struct hci_ev_remote_host_features {
2146 bdaddr_t bdaddr;
2147 __u8 features[8];
66c853cc 2148} __packed;
41a96212 2149
63185f64
VT
2150#define HCI_EV_LE_META 0x3e
2151struct hci_ev_le_meta {
2152 __u8 subevent;
2153} __packed;
2154
523e93cd
AE
2155#define HCI_EV_PHY_LINK_COMPLETE 0x40
2156struct hci_ev_phy_link_complete {
2157 __u8 status;
2158 __u8 phy_handle;
2159} __packed;
2160
2161#define HCI_EV_CHANNEL_SELECTED 0x41
2162struct hci_ev_channel_selected {
2163 __u8 phy_handle;
2164} __packed;
2165
2166#define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42
2167struct hci_ev_disconn_phy_link_complete {
2168 __u8 status;
2169 __u8 phy_handle;
2170 __u8 reason;
2171} __packed;
2172
2173#define HCI_EV_LOGICAL_LINK_COMPLETE 0x45
2174struct hci_ev_logical_link_complete {
2175 __u8 status;
2176 __le16 handle;
2177 __u8 phy_handle;
2178 __u8 flow_spec_id;
2179} __packed;
2180
2181#define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46
2182struct hci_ev_disconn_logical_link_complete {
2183 __u8 status;
2184 __le16 handle;
2185 __u8 reason;
2186} __packed;
2187
25e89e99
AE
2188#define HCI_EV_NUM_COMP_BLOCKS 0x48
2189struct hci_comp_blocks_info {
2190 __le16 handle;
2191 __le16 pkts;
2192 __le16 blocks;
2193} __packed;
2194
2195struct hci_ev_num_comp_blocks {
2196 __le16 num_blocks;
2197 __u8 num_hndl;
a7e45454 2198 struct hci_comp_blocks_info handles[];
25e89e99
AE
2199} __packed;
2200
2b359445
DP
2201#define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F
2202struct hci_ev_sync_train_complete {
2203 __u8 status;
2204} __packed;
2205
2ed01805
DP
2206#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
2207
63185f64
VT
2208#define HCI_EV_LE_CONN_COMPLETE 0x01
2209struct hci_ev_le_conn_complete {
2210 __u8 status;
2211 __le16 handle;
2212 __u8 role;
2213 __u8 bdaddr_type;
2214 bdaddr_t bdaddr;
2215 __le16 interval;
2216 __le16 latency;
2217 __le16 supervision_timeout;
2218 __u8 clk_accurancy;
2219} __packed;
2220
2331fd46
MH
2221/* Advertising report event types */
2222#define LE_ADV_IND 0x00
2223#define LE_ADV_DIRECT_IND 0x01
2224#define LE_ADV_SCAN_IND 0x02
2225#define LE_ADV_NONCONN_IND 0x03
2226#define LE_ADV_SCAN_RSP 0x04
c215e939
JK
2227#define LE_ADV_INVALID 0x05
2228
2229/* Legacy event types in extended adv report */
2230#define LE_LEGACY_ADV_IND 0x0013
2231#define LE_LEGACY_ADV_DIRECT_IND 0x0015
2232#define LE_LEGACY_ADV_SCAN_IND 0x0012
2233#define LE_LEGACY_NONCONN_IND 0x0010
2234#define LE_LEGACY_SCAN_RSP_ADV 0x001b
2235#define LE_LEGACY_SCAN_RSP_ADV_SCAN 0x001a
2331fd46 2236
b2cc9761
JK
2237/* Extended Advertising event types */
2238#define LE_EXT_ADV_NON_CONN_IND 0x0000
2239#define LE_EXT_ADV_CONN_IND 0x0001
2240#define LE_EXT_ADV_SCAN_IND 0x0002
2241#define LE_EXT_ADV_DIRECT_IND 0x0004
2242#define LE_EXT_ADV_SCAN_RSP 0x0008
2243#define LE_EXT_ADV_LEGACY_PDU 0x0010
2244
2331fd46
MH
2245#define ADDR_LE_DEV_PUBLIC 0x00
2246#define ADDR_LE_DEV_RANDOM 0x01
2247
2248#define HCI_EV_LE_ADVERTISING_REPORT 0x02
2249struct hci_ev_le_advertising_info {
2250 __u8 evt_type;
2251 __u8 bdaddr_type;
2252 bdaddr_t bdaddr;
2253 __u8 length;
a7e45454 2254 __u8 data[];
2331fd46
MH
2255} __packed;
2256
1855d92d
MH
2257#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
2258struct hci_ev_le_conn_update_complete {
2259 __u8 status;
2260 __le16 handle;
2261 __le16 interval;
2262 __le16 latency;
2263 __le16 supervision_timeout;
2264} __packed;
2265
0fe29fd1
MH
2266#define HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04
2267struct hci_ev_le_remote_feat_complete {
2268 __u8 status;
2269 __le16 handle;
2270 __u8 features[8];
2271} __packed;
2272
a7a595f6
VCG
2273#define HCI_EV_LE_LTK_REQ 0x05
2274struct hci_ev_le_ltk_req {
2275 __le16 handle;
fe39c7b2 2276 __le64 rand;
a7a595f6
VCG
2277 __le16 ediv;
2278} __packed;
2279
8e75b46a
AG
2280#define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06
2281struct hci_ev_le_remote_conn_param_req {
2282 __le16 handle;
2283 __le16 interval_min;
2284 __le16 interval_max;
2285 __le16 latency;
2286 __le16 timeout;
2287} __packed;
2288
94a3bd02
MH
2289#define HCI_EV_LE_DATA_LEN_CHANGE 0x07
2290struct hci_ev_le_data_len_change {
2291 __le16 handle;
2292 __le16 tx_len;
2293 __le16 tx_time;
2294 __le16 rx_len;
2295 __le16 rx_time;
2296} __packed;
2297
32c9d43f
MH
2298#define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B
2299struct hci_ev_le_direct_adv_info {
2300 __u8 evt_type;
2301 __u8 bdaddr_type;
2302 bdaddr_t bdaddr;
2303 __u8 direct_addr_type;
2304 bdaddr_t direct_addr;
2305 __s8 rssi;
2306} __packed;
2307
1efd927d
LAD
2308#define HCI_EV_LE_PHY_UPDATE_COMPLETE 0x0c
2309struct hci_ev_le_phy_update_complete {
2310 __u8 status;
4de0fc59 2311 __le16 handle;
1efd927d
LAD
2312 __u8 tx_phy;
2313 __u8 rx_phy;
2314} __packed;
2315
c215e939
JK
2316#define HCI_EV_LE_EXT_ADV_REPORT 0x0d
2317struct hci_ev_le_ext_adv_report {
2318 __le16 evt_type;
2319 __u8 bdaddr_type;
2320 bdaddr_t bdaddr;
2321 __u8 primary_phy;
2322 __u8 secondary_phy;
2323 __u8 sid;
2324 __u8 tx_power;
2325 __s8 rssi;
2326 __le16 interval;
2327 __u8 direct_addr_type;
2328 bdaddr_t direct_addr;
2329 __u8 length;
a7e45454 2330 __u8 data[];
c215e939
JK
2331} __packed;
2332
4d94f95d
JK
2333#define HCI_EV_LE_ENHANCED_CONN_COMPLETE 0x0a
2334struct hci_ev_le_enh_conn_complete {
2335 __u8 status;
2336 __le16 handle;
2337 __u8 role;
2338 __u8 bdaddr_type;
2339 bdaddr_t bdaddr;
2340 bdaddr_t local_rpa;
2341 bdaddr_t peer_rpa;
2342 __le16 interval;
2343 __le16 latency;
2344 __le16 supervision_timeout;
2345 __u8 clk_accurancy;
2346} __packed;
2347
acf0aeae
JK
2348#define HCI_EV_LE_EXT_ADV_SET_TERM 0x12
2349struct hci_evt_le_ext_adv_set_term {
2350 __u8 status;
2351 __u8 handle;
2352 __le16 conn_handle;
2353 __u8 num_evts;
2354} __packed;
2355
4de0fc59
LAD
2356#define HCI_EVT_LE_CIS_ESTABLISHED 0x19
2357struct hci_evt_le_cis_established {
2358 __u8 status;
2359 __le16 handle;
2360 __u8 cig_sync_delay[3];
2361 __u8 cis_sync_delay[3];
2362 __u8 m_latency[3];
2363 __u8 s_latency[3];
2364 __u8 m_phy;
2365 __u8 s_phy;
2366 __u8 nse;
2367 __u8 m_bn;
2368 __u8 s_bn;
2369 __u8 m_ft;
2370 __u8 s_ft;
2371 __le16 m_mtu;
2372 __le16 s_mtu;
2373 __le16 interval;
2374} __packed;
2375
2376#define HCI_EVT_LE_CIS_REQ 0x1a
2377struct hci_evt_le_cis_req {
2378 __le16 acl_handle;
2379 __le16 cis_handle;
2380 __u8 cig_id;
2381 __u8 cis_id;
2382} __packed;
2383
e4cc5a18
MH
2384#define HCI_EV_VENDOR 0xff
2385
1da177e4 2386/* Internal events generated by Bluetooth stack */
a9de9248 2387#define HCI_EV_STACK_INTERNAL 0xfd
1da177e4
LT
2388struct hci_ev_stack_internal {
2389 __u16 type;
a7e45454 2390 __u8 data[];
66c853cc 2391} __packed;
1da177e4 2392
a9de9248 2393#define HCI_EV_SI_DEVICE 0x01
1da177e4
LT
2394struct hci_ev_si_device {
2395 __u16 event;
2396 __u16 dev_id;
66c853cc 2397} __packed;
1da177e4
LT
2398
2399#define HCI_EV_SI_SECURITY 0x02
2400struct hci_ev_si_security {
2401 __u16 event;
2402 __u16 proto;
2403 __u16 subproto;
2404 __u8 incoming;
66c853cc 2405} __packed;
1da177e4
LT
2406
2407/* ---- HCI Packet structures ---- */
2408#define HCI_COMMAND_HDR_SIZE 3
2409#define HCI_EVENT_HDR_SIZE 2
2410#define HCI_ACL_HDR_SIZE 4
2411#define HCI_SCO_HDR_SIZE 3
4de0fc59 2412#define HCI_ISO_HDR_SIZE 4
1da177e4
LT
2413
2414struct hci_command_hdr {
a9de9248 2415 __le16 opcode; /* OCF & OGF */
70f23020 2416 __u8 plen;
66c853cc 2417} __packed;
1da177e4
LT
2418
2419struct hci_event_hdr {
a9de9248
MH
2420 __u8 evt;
2421 __u8 plen;
66c853cc 2422} __packed;
1da177e4
LT
2423
2424struct hci_acl_hdr {
a9de9248
MH
2425 __le16 handle; /* Handle & Flags(PB, BC) */
2426 __le16 dlen;
66c853cc 2427} __packed;
1da177e4
LT
2428
2429struct hci_sco_hdr {
a9de9248
MH
2430 __le16 handle;
2431 __u8 dlen;
66c853cc 2432} __packed;
1da177e4 2433
4de0fc59
LAD
2434struct hci_iso_hdr {
2435 __le16 handle;
2436 __le16 dlen;
a7e45454 2437 __u8 data[];
4de0fc59
LAD
2438} __packed;
2439
2440/* ISO data packet status flags */
2441#define HCI_ISO_STATUS_VALID 0x00
2442#define HCI_ISO_STATUS_INVALID 0x01
2443#define HCI_ISO_STATUS_NOP 0x02
2444
2445#define HCI_ISO_DATA_HDR_SIZE 4
2446struct hci_iso_data_hdr {
2447 __le16 sn;
2448 __le16 slen;
2449};
2450
2451#define HCI_ISO_TS_DATA_HDR_SIZE 8
2452struct hci_iso_ts_data_hdr {
2453 __le32 ts;
2454 __le16 sn;
2455 __le16 slen;
2456};
2457
2a123b86
ACM
2458static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
2459{
a9de9248 2460 return (struct hci_event_hdr *) skb->data;
2a123b86
ACM
2461}
2462
2463static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
2464{
a9de9248 2465 return (struct hci_acl_hdr *) skb->data;
2a123b86
ACM
2466}
2467
2468static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
2469{
a9de9248 2470 return (struct hci_sco_hdr *) skb->data;
2a123b86 2471}
2a123b86 2472
1da177e4 2473/* Command opcode pack/unpack */
c3c7ea65 2474#define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10)))
1da177e4
LT
2475#define hci_opcode_ogf(op) (op >> 10)
2476#define hci_opcode_ocf(op) (op & 0x03ff)
2477
2478/* ACL handle and flags pack/unpack */
c3c7ea65 2479#define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12)))
1da177e4
LT
2480#define hci_handle(h) (h & 0x0fff)
2481#define hci_flags(h) (h >> 12)
2482
4de0fc59
LAD
2483/* ISO handle and flags pack/unpack */
2484#define hci_iso_flags_pb(f) (f & 0x0003)
2485#define hci_iso_flags_ts(f) ((f >> 2) & 0x0001)
2486#define hci_iso_flags_pack(pb, ts) ((pb & 0x03) | ((ts & 0x01) << 2))
2487
2488/* ISO data length and flags pack/unpack */
2489#define hci_iso_data_len_pack(h, f) ((__u16) ((h) | ((f) << 14)))
2490#define hci_iso_data_len(h) ((h) & 0x3fff)
2491#define hci_iso_data_flags(h) ((h) >> 14)
2492
1da177e4 2493#endif /* __HCI_H */