xref: /openbmc/linux/include/net/bluetooth/hci.h (revision d0bf75a51b172fdd9dd90bfa03c0f5de473b6c94)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds    BlueZ - Bluetooth protocol stack for Linux
31da177e4SLinus Torvalds    Copyright (C) 2000-2001 Qualcomm Incorporated
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
61da177e4SLinus Torvalds 
71da177e4SLinus Torvalds    This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds    it under the terms of the GNU General Public License version 2 as
91da177e4SLinus Torvalds    published by the Free Software Foundation;
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
121da177e4SLinus Torvalds    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131da177e4SLinus Torvalds    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
141da177e4SLinus Torvalds    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
151da177e4SLinus Torvalds    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
161da177e4SLinus Torvalds    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171da177e4SLinus Torvalds    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
181da177e4SLinus Torvalds    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
211da177e4SLinus Torvalds    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
221da177e4SLinus Torvalds    SOFTWARE IS DISCLAIMED.
231da177e4SLinus Torvalds */
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds #ifndef __HCI_H
261da177e4SLinus Torvalds #define __HCI_H
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE	1024
291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE	255
301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE	260
311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE	(HCI_MAX_ACL_SIZE + 4)
321da177e4SLinus Torvalds 
339b3b4460SAndrei Emeltchenko #define HCI_LINK_KEY_SIZE	16
34523e93cdSAndrei Emeltchenko #define HCI_AMP_LINK_KEY_SIZE	(2 * HCI_LINK_KEY_SIZE)
359b3b4460SAndrei Emeltchenko 
36903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE	672
37903e4541SAndrei Emeltchenko 
381da177e4SLinus Torvalds /* HCI dev events */
391da177e4SLinus Torvalds #define HCI_DEV_REG			1
401da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
411da177e4SLinus Torvalds #define HCI_DEV_UP			3
421da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
431da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
441da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds /* HCI notify events */
471da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
481da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
491da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
501da177e4SLinus Torvalds 
51c13854ceSMarcel Holtmann /* HCI bus types */
520ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
531da177e4SLinus Torvalds #define HCI_USB		1
541da177e4SLinus Torvalds #define HCI_PCCARD	2
551da177e4SLinus Torvalds #define HCI_UART	3
561da177e4SLinus Torvalds #define HCI_RS232	4
571da177e4SLinus Torvalds #define HCI_PCI		5
580ac53939SMarcel Holtmann #define HCI_SDIO	6
591da177e4SLinus Torvalds 
60943da25dSMarcel Holtmann /* HCI controller types */
61943da25dSMarcel Holtmann #define HCI_BREDR	0x00
628f1e1742SDavid Vrabel #define HCI_AMP		0x01
63943da25dSMarcel Holtmann 
648598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
658598d064SAndrei Emeltchenko #define HCI_BREDR_ID	0
668598d064SAndrei Emeltchenko 
67ab846ec4SAndrei Emeltchenko /* AMP controller status */
68ab846ec4SAndrei Emeltchenko #define AMP_CTRL_POWERED_DOWN			0x00
69ab846ec4SAndrei Emeltchenko #define AMP_CTRL_BLUETOOTH_ONLY			0x01
70ab846ec4SAndrei Emeltchenko #define AMP_CTRL_NO_CAPACITY			0x02
71ab846ec4SAndrei Emeltchenko #define AMP_CTRL_LOW_CAPACITY			0x03
72ab846ec4SAndrei Emeltchenko #define AMP_CTRL_MEDIUM_CAPACITY		0x04
73ab846ec4SAndrei Emeltchenko #define AMP_CTRL_HIGH_CAPACITY			0x05
74ab846ec4SAndrei Emeltchenko #define AMP_CTRL_FULL_CAPACITY			0x06
75ab846ec4SAndrei Emeltchenko 
761da177e4SLinus Torvalds /* HCI device quirks */
771da177e4SLinus Torvalds enum {
78a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
79da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
80da1f5198SMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE
811da177e4SLinus Torvalds };
821da177e4SLinus Torvalds 
831da177e4SLinus Torvalds /* HCI device flags */
841da177e4SLinus Torvalds enum {
851da177e4SLinus Torvalds 	HCI_UP,
861da177e4SLinus Torvalds 	HCI_INIT,
871da177e4SLinus Torvalds 	HCI_RUNNING,
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds 	HCI_PSCAN,
901da177e4SLinus Torvalds 	HCI_ISCAN,
911da177e4SLinus Torvalds 	HCI_AUTH,
921da177e4SLinus Torvalds 	HCI_ENCRYPT,
931da177e4SLinus Torvalds 	HCI_INQUIRY,
941da177e4SLinus Torvalds 
951da177e4SLinus Torvalds 	HCI_RAW,
96ab81cbf9SJohan Hedberg 
9710572132SGustavo F. Padovan 	HCI_RESET,
981da177e4SLinus Torvalds };
991da177e4SLinus Torvalds 
100d23264a8SAndre Guedes /*
101d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
102d23264a8SAndre Guedes  * states from the controller.
103d23264a8SAndre Guedes  */
104d23264a8SAndre Guedes enum {
105a8b2d5c2SJohan Hedberg 	HCI_SETUP,
106a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1075e130367SJohan Hedberg 	HCI_RFKILLED,
108a8b2d5c2SJohan Hedberg 	HCI_MGMT,
109a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
110a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
111a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
11294324962SJohan Hovold 	HCI_UNREGISTER,
1130736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
114a8b2d5c2SJohan Hedberg 
115d23264a8SAndre Guedes 	HCI_LE_SCAN,
11684bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
1176d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
11806199cf8SJohan Hedberg 	HCI_LE_ENABLED,
11933f8f526SJohan Hedberg 	HCI_LE_PERIPHERAL,
1205e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1215e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
12247990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
12321693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1241a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
12556f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
126d23264a8SAndre Guedes };
127d23264a8SAndre Guedes 
1282cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
1292cc6fb00SJohan Hedberg  * or the HCI device is closed.
1302cc6fb00SJohan Hedberg  */
1311a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
1321a4d3c4bSJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE))
1332cc6fb00SJohan Hedberg 
1341da177e4SLinus Torvalds /* HCI ioctl defines */
1351da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1361da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1371da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1381da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1391da177e4SLinus Torvalds 
1401da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1411da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1421da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1431da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
14440be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1451da177e4SLinus Torvalds 
1461da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1471da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1481da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1491da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1501da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1511da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1521da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1531da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1541da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1551da177e4SLinus Torvalds 
156f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
157f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
158f0358568SJohan Hedberg 
1591da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1601da177e4SLinus Torvalds 
1611da177e4SLinus Torvalds /* HCI timeouts */
1625f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1635f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1645f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
165d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
1665f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1679345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1681da177e4SLinus Torvalds 
1695b7f9909SMarcel Holtmann /* HCI data types */
1701da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1711da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1721da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1731da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1741da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1751da177e4SLinus Torvalds 
1765b7f9909SMarcel Holtmann /* HCI packet types */
1771da177e4SLinus Torvalds #define HCI_DM1		0x0008
1781da177e4SLinus Torvalds #define HCI_DM3		0x0400
1791da177e4SLinus Torvalds #define HCI_DM5		0x4000
1801da177e4SLinus Torvalds #define HCI_DH1		0x0010
1811da177e4SLinus Torvalds #define HCI_DH3		0x0800
1821da177e4SLinus Torvalds #define HCI_DH5		0x8000
1831da177e4SLinus Torvalds 
1841da177e4SLinus Torvalds #define HCI_HV1		0x0020
1851da177e4SLinus Torvalds #define HCI_HV2		0x0040
1861da177e4SLinus Torvalds #define HCI_HV3		0x0080
1871da177e4SLinus Torvalds 
1881da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1891da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1901da177e4SLinus Torvalds 
1915b7f9909SMarcel Holtmann /* eSCO packet types */
1925b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1935b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1945b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1955b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1965b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1975b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
198efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
199efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
200efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
201efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2025b7f9909SMarcel Holtmann 
203a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
204efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
205a8746417SMarcel Holtmann 
2061da177e4SLinus Torvalds /* ACL flags */
207e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2081da177e4SLinus Torvalds #define ACL_CONT		0x01
2091da177e4SLinus Torvalds #define ACL_START		0x02
210d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2111da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2121da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2131da177e4SLinus Torvalds 
2141da177e4SLinus Torvalds /* Baseband links */
2151da177e4SLinus Torvalds #define SCO_LINK	0x00
2161da177e4SLinus Torvalds #define ACL_LINK	0x01
2175b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
218fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
219fcd89c09SVille Tervo #define LE_LINK		0x80
2203161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2211da177e4SLinus Torvalds 
2221da177e4SLinus Torvalds /* LMP features */
2231da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2241da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2251da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2261da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2271da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2281da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2291da177e4SLinus Torvalds #define LMP_HOLD	0x40
23004837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2311da177e4SLinus Torvalds 
2321da177e4SLinus Torvalds #define LMP_PARK	0x01
2331da177e4SLinus Torvalds #define LMP_RSSI	0x02
2341da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2351da177e4SLinus Torvalds #define LMP_SCO		0x08
2361da177e4SLinus Torvalds #define LMP_HV2		0x10
2371da177e4SLinus Torvalds #define LMP_HV3		0x20
2381da177e4SLinus Torvalds #define LMP_ULAW	0x40
2391da177e4SLinus Torvalds #define LMP_ALAW	0x80
2401da177e4SLinus Torvalds 
2411da177e4SLinus Torvalds #define LMP_CVSD	0x01
2421da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2431da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
24407a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2451da177e4SLinus Torvalds 
246d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2475b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2485b7f9909SMarcel Holtmann 
2495b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2505b7f9909SMarcel Holtmann #define LMP_EV5		0x02
25169ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
252d5859e22SJohan Hedberg #define LMP_LE		0x40
2535b7f9909SMarcel Holtmann 
25404837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
255d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
256efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
257efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
258efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
25904837f64SMarcel Holtmann 
260d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
261e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
262769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
263e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
264769be974SMarcel Holtmann 
265d5859e22SJohan Hedberg #define LMP_LSTO	0x01
266d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
267971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
268d5859e22SJohan Hedberg 
269eead27daSAndre Guedes /* Extended LMP features */
270cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
271eead27daSAndre Guedes #define LMP_HOST_LE		0x02
272cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
273eead27daSAndre Guedes 
27404837f64SMarcel Holtmann /* Connection modes */
27504837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
27604837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
27704837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
27804837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
27904837f64SMarcel Holtmann 
2801da177e4SLinus Torvalds /* Link policies */
2811da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2821da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2831da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2841da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2851da177e4SLinus Torvalds 
28604837f64SMarcel Holtmann /* Link modes */
2871da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2881da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2891da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2901da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2911da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2921da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2931da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2941da177e4SLinus Torvalds 
29540be492fSMarcel Holtmann /* Authentication types */
29640be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
29740be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
29840be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
29940be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
30040be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
30140be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
30240be492fSMarcel Holtmann 
303a77b15a6SMikel Astiz /* I/O capabilities */
304a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
305a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
306a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
307a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
308a77b15a6SMikel Astiz 
309b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
310b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
311b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
312b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
313b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
314b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
315b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
316b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
317b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
318b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
319b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
320b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
321b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
322b6020ba0SWaldemar Rymarkiewicz 
3239f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3249f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
325cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3269f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3279f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
328cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
329cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3309f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3319f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3329f5a0d7bSAndrei Emeltchenko 
3332455a3eaSAndrei Emeltchenko /* Flow control modes */
3342455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3352455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3362455a3eaSAndrei Emeltchenko 
337bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
338bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
339bbaf444aSJohan Hedberg 
34032748db0SJohan Hedberg /* Extended Inquiry Response field types */
34132748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
34232748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
34332748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
34432748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
34532748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
34632748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
34732748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
34832748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
34932748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
35032748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3519ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3529ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3539ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
35432748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
35532748db0SJohan Hedberg 
3563f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
3573f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
3583f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
3593f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
3603f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
3613f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
3623f0f524bSJohan Hedberg 
3631da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3646bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3656bd32326SVille Tervo 
366a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
367a9de9248SMarcel Holtmann struct hci_cp_inquiry {
368a9de9248SMarcel Holtmann 	__u8     lap[3];
369a9de9248SMarcel Holtmann 	__u8     length;
370a9de9248SMarcel Holtmann 	__u8     num_rsp;
37166c853ccSGustavo F. Padovan } __packed;
3721da177e4SLinus Torvalds 
373a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
374a9de9248SMarcel Holtmann 
37579d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
37679d6e068SAndre Guedes 
377a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
378a9de9248SMarcel Holtmann 
379a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
380a9de9248SMarcel Holtmann struct hci_cp_create_conn {
381a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
382a9de9248SMarcel Holtmann 	__le16   pkt_type;
383a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
384a9de9248SMarcel Holtmann 	__u8     pscan_mode;
385a9de9248SMarcel Holtmann 	__le16   clock_offset;
386a9de9248SMarcel Holtmann 	__u8     role_switch;
38766c853ccSGustavo F. Padovan } __packed;
3881da177e4SLinus Torvalds 
389a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
390a9de9248SMarcel Holtmann struct hci_cp_disconnect {
391a9de9248SMarcel Holtmann 	__le16   handle;
392a9de9248SMarcel Holtmann 	__u8     reason;
39366c853ccSGustavo F. Padovan } __packed;
3941da177e4SLinus Torvalds 
395a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
396a9de9248SMarcel Holtmann struct hci_cp_add_sco {
397a9de9248SMarcel Holtmann 	__le16   handle;
398a9de9248SMarcel Holtmann 	__le16   pkt_type;
39966c853ccSGustavo F. Padovan } __packed;
400a9de9248SMarcel Holtmann 
401a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
402a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4031da177e4SLinus Torvalds 	bdaddr_t bdaddr;
40466c853ccSGustavo F. Padovan } __packed;
4051da177e4SLinus Torvalds 
406a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
407a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
408a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
409a9de9248SMarcel Holtmann 	__u8     role;
41066c853ccSGustavo F. Padovan } __packed;
4111da177e4SLinus Torvalds 
412a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
413a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
414a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
415a9de9248SMarcel Holtmann 	__u8     reason;
41666c853ccSGustavo F. Padovan } __packed;
4171da177e4SLinus Torvalds 
418a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
419a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
420a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4219b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
42266c853ccSGustavo F. Padovan } __packed;
4231da177e4SLinus Torvalds 
424a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
425a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
426a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
42766c853ccSGustavo F. Padovan } __packed;
4281da177e4SLinus Torvalds 
429a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
430a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
431a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
432a9de9248SMarcel Holtmann 	__u8     pin_len;
433a9de9248SMarcel Holtmann 	__u8     pin_code[16];
43466c853ccSGustavo F. Padovan } __packed;
435980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
436980e1a53SJohan Hedberg 	__u8     status;
437980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
438980e1a53SJohan Hedberg } __packed;
439a9de9248SMarcel Holtmann 
440a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
441a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
442a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
44366c853ccSGustavo F. Padovan } __packed;
444980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
445980e1a53SJohan Hedberg 	__u8     status;
446980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
447980e1a53SJohan Hedberg } __packed;
448a9de9248SMarcel Holtmann 
449a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
450a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
451a9de9248SMarcel Holtmann 	__le16   handle;
452a9de9248SMarcel Holtmann 	__le16   pkt_type;
45366c853ccSGustavo F. Padovan } __packed;
454a9de9248SMarcel Holtmann 
455a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
456a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
457a9de9248SMarcel Holtmann 	__le16   handle;
45866c853ccSGustavo F. Padovan } __packed;
459a9de9248SMarcel Holtmann 
460a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
461a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
462a9de9248SMarcel Holtmann 	__le16   handle;
463a9de9248SMarcel Holtmann 	__u8     encrypt;
46466c853ccSGustavo F. Padovan } __packed;
465a9de9248SMarcel Holtmann 
466a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
467a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
468a9de9248SMarcel Holtmann 	__le16   handle;
46966c853ccSGustavo F. Padovan } __packed;
470a9de9248SMarcel Holtmann 
471a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
472a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
473a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
474a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
475a9de9248SMarcel Holtmann 	__u8     pscan_mode;
476a9de9248SMarcel Holtmann 	__le16   clock_offset;
47766c853ccSGustavo F. Padovan } __packed;
478a9de9248SMarcel Holtmann 
479a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
480a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
481a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
48266c853ccSGustavo F. Padovan } __packed;
483a9de9248SMarcel Holtmann 
484a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
485a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
486a9de9248SMarcel Holtmann 	__le16   handle;
48766c853ccSGustavo F. Padovan } __packed;
488a9de9248SMarcel Holtmann 
489a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
490a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
491a9de9248SMarcel Holtmann 	__le16   handle;
492a9de9248SMarcel Holtmann 	__u8     page;
49366c853ccSGustavo F. Padovan } __packed;
494a9de9248SMarcel Holtmann 
495a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
496a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
497a9de9248SMarcel Holtmann 	__le16   handle;
49866c853ccSGustavo F. Padovan } __packed;
499a9de9248SMarcel Holtmann 
500a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
501a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
502a9de9248SMarcel Holtmann 	__le16   handle;
503a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
504a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
505a9de9248SMarcel Holtmann 	__le16   max_latency;
506a9de9248SMarcel Holtmann 	__le16   voice_setting;
507a9de9248SMarcel Holtmann 	__u8     retrans_effort;
508a9de9248SMarcel Holtmann 	__le16   pkt_type;
50966c853ccSGustavo F. Padovan } __packed;
510a9de9248SMarcel Holtmann 
511a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
512a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
513a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
514a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
515a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
516a9de9248SMarcel Holtmann 	__le16   max_latency;
517a9de9248SMarcel Holtmann 	__le16   content_format;
518a9de9248SMarcel Holtmann 	__u8     retrans_effort;
519a9de9248SMarcel Holtmann 	__le16   pkt_type;
52066c853ccSGustavo F. Padovan } __packed;
521a9de9248SMarcel Holtmann 
522a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
523a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
524a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
525a9de9248SMarcel Holtmann 	__u8     reason;
52666c853ccSGustavo F. Padovan } __packed;
527a9de9248SMarcel Holtmann 
52817fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
52917fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
53017fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
53117fa4b9dSJohan Hedberg 	__u8     capability;
53217fa4b9dSJohan Hedberg 	__u8     oob_data;
53317fa4b9dSJohan Hedberg 	__u8     authentication;
53417fa4b9dSJohan Hedberg } __packed;
53517fa4b9dSJohan Hedberg 
536a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
537a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
538a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
539a5c29683SJohan Hedberg } __packed;
540a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
541a5c29683SJohan Hedberg 	__u8     status;
542a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
543a5c29683SJohan Hedberg } __packed;
544a5c29683SJohan Hedberg 
545a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
546a5c29683SJohan Hedberg 
5479ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5489ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5499ad4019aSBrian Gix 	bdaddr_t bdaddr;
5509ad4019aSBrian Gix 	__le32	passkey;
5519ad4019aSBrian Gix } __packed;
5529ad4019aSBrian Gix 
5539ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5549ad4019aSBrian Gix 
5552763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5562763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5572763eda6SSzymon Janc 	bdaddr_t bdaddr;
5582763eda6SSzymon Janc 	__u8     hash[16];
5592763eda6SSzymon Janc 	__u8     randomizer[16];
5602763eda6SSzymon Janc } __packed;
5612763eda6SSzymon Janc 
5622763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5632763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5642763eda6SSzymon Janc 	bdaddr_t bdaddr;
5652763eda6SSzymon Janc } __packed;
5662763eda6SSzymon Janc 
56703b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
56803b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
56903b555e1SJohan Hedberg 	bdaddr_t bdaddr;
57003b555e1SJohan Hedberg 	__u8     reason;
57103b555e1SJohan Hedberg } __packed;
57203b555e1SJohan Hedberg 
573523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
574523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
575523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
576523e93cdSAndrei Emeltchenko 	__u8     key_len;
577523e93cdSAndrei Emeltchenko 	__u8     key_type;
578523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
579523e93cdSAndrei Emeltchenko } __packed;
580523e93cdSAndrei Emeltchenko 
581523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
582523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
583523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
584523e93cdSAndrei Emeltchenko 	__u8     key_len;
585523e93cdSAndrei Emeltchenko 	__u8     key_type;
586523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
587523e93cdSAndrei Emeltchenko } __packed;
588523e93cdSAndrei Emeltchenko 
589523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
590523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
591523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
592523e93cdSAndrei Emeltchenko 	__u8     reason;
593b078b564SAndrei Emeltchenko } __packed;
594b078b564SAndrei Emeltchenko 
595b078b564SAndrei Emeltchenko struct ext_flow_spec {
596b078b564SAndrei Emeltchenko 	__u8       id;
597b078b564SAndrei Emeltchenko 	__u8       stype;
598b078b564SAndrei Emeltchenko 	__le16     msdu;
599b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
600b078b564SAndrei Emeltchenko 	__le32     acc_lat;
601b078b564SAndrei Emeltchenko 	__le32     flush_to;
602b078b564SAndrei Emeltchenko } __packed;
603b078b564SAndrei Emeltchenko 
604b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
605b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
606b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
607b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
608b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
609b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
610b078b564SAndrei Emeltchenko } __packed;
611b078b564SAndrei Emeltchenko 
612b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
613b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
614b078b564SAndrei Emeltchenko 	__le16   log_handle;
615b078b564SAndrei Emeltchenko } __packed;
616b078b564SAndrei Emeltchenko 
617b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
618b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
619b078b564SAndrei Emeltchenko 	__u8     phy_handle;
620b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
621b078b564SAndrei Emeltchenko } __packed;
622b078b564SAndrei Emeltchenko 
623b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
624b078b564SAndrei Emeltchenko 	__u8     status;
625b078b564SAndrei Emeltchenko 	__u8     phy_handle;
626b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
627523e93cdSAndrei Emeltchenko } __packed;
628523e93cdSAndrei Emeltchenko 
629a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
630a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
631a9de9248SMarcel Holtmann 	__le16   handle;
632a9de9248SMarcel Holtmann 	__le16   max_interval;
633a9de9248SMarcel Holtmann 	__le16   min_interval;
634a9de9248SMarcel Holtmann 	__le16   attempt;
635a9de9248SMarcel Holtmann 	__le16   timeout;
63666c853ccSGustavo F. Padovan } __packed;
637a9de9248SMarcel Holtmann 
638a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
639a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
640a9de9248SMarcel Holtmann 	__le16   handle;
64166c853ccSGustavo F. Padovan } __packed;
642a9de9248SMarcel Holtmann 
643a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
644a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
645a9de9248SMarcel Holtmann 	__le16   handle;
64666c853ccSGustavo F. Padovan } __packed;
647a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
648a9de9248SMarcel Holtmann 	__u8     status;
649a9de9248SMarcel Holtmann 	__le16   handle;
650a9de9248SMarcel Holtmann 	__u8     role;
65166c853ccSGustavo F. Padovan } __packed;
652a9de9248SMarcel Holtmann 
653a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
654a9de9248SMarcel Holtmann struct hci_cp_switch_role {
655a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
656a9de9248SMarcel Holtmann 	__u8     role;
65766c853ccSGustavo F. Padovan } __packed;
658a9de9248SMarcel Holtmann 
659a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
660a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
661a9de9248SMarcel Holtmann 	__le16   handle;
66266c853ccSGustavo F. Padovan } __packed;
663a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
664a9de9248SMarcel Holtmann 	__u8     status;
665a9de9248SMarcel Holtmann 	__le16   handle;
666a9de9248SMarcel Holtmann 	__le16   policy;
66766c853ccSGustavo F. Padovan } __packed;
668a9de9248SMarcel Holtmann 
669a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
670a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
671a9de9248SMarcel Holtmann 	__le16   handle;
672a9de9248SMarcel Holtmann 	__le16   policy;
67366c853ccSGustavo F. Padovan } __packed;
674a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
675a9de9248SMarcel Holtmann 	__u8     status;
676a9de9248SMarcel Holtmann 	__le16   handle;
67766c853ccSGustavo F. Padovan } __packed;
678a9de9248SMarcel Holtmann 
679e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
680e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
681e4e8e37cSMarcel Holtmann 	__u8     status;
682e4e8e37cSMarcel Holtmann 	__le16   policy;
68366c853ccSGustavo F. Padovan } __packed;
684e4e8e37cSMarcel Holtmann 
685e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
686e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
687e4e8e37cSMarcel Holtmann 	__le16   policy;
68866c853ccSGustavo F. Padovan } __packed;
689e4e8e37cSMarcel Holtmann 
690a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
691a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
692a9de9248SMarcel Holtmann 	__le16   handle;
693a9de9248SMarcel Holtmann 	__le16   max_latency;
694a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
695a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
69666c853ccSGustavo F. Padovan } __packed;
697a9de9248SMarcel Holtmann 
698a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
699a9de9248SMarcel Holtmann 
700a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
701a9de9248SMarcel Holtmann 
702a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
7031da177e4SLinus Torvalds struct hci_cp_set_event_flt {
7041da177e4SLinus Torvalds 	__u8     flt_type;
7051da177e4SLinus Torvalds 	__u8     cond_type;
7061da177e4SLinus Torvalds 	__u8     condition[0];
70766c853ccSGustavo F. Padovan } __packed;
7081da177e4SLinus Torvalds 
7091da177e4SLinus Torvalds /* Filter types */
7101da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
7111da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
7121da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
7131da177e4SLinus Torvalds 
7141da177e4SLinus Torvalds /* CONN_SETUP Condition types */
7151da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
7161da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
7171da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
7181da177e4SLinus Torvalds 
7191da177e4SLinus Torvalds /* CONN_SETUP Conditions */
7201da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
7211da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
7221da177e4SLinus Torvalds 
723b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
724b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
725b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
726b0916ea0SJohan Hedberg 	__u8     delete_all;
727b0916ea0SJohan Hedberg } __packed;
728b0916ea0SJohan Hedberg 
7291f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
7301f6c6378SJohan Hedberg 
731a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
732a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
7331f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
73466c853ccSGustavo F. Padovan } __packed;
735a9de9248SMarcel Holtmann 
736a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
737a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
738a9de9248SMarcel Holtmann 	__u8     status;
7391f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
74066c853ccSGustavo F. Padovan } __packed;
741a9de9248SMarcel Holtmann 
742a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
743a9de9248SMarcel Holtmann 
744a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
745a9de9248SMarcel Holtmann 
746a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
747a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
748a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
749a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
750a9de9248SMarcel Holtmann 
751a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
752a9de9248SMarcel Holtmann 
753a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
754a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
755a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
756a9de9248SMarcel Holtmann 
757a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
758a9de9248SMarcel Holtmann 
759a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
760a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
761a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
762a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
763a9de9248SMarcel Holtmann 
764a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
765a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
7661da177e4SLinus Torvalds 	__u8     status;
7671da177e4SLinus Torvalds 	__u8     dev_class[3];
76866c853ccSGustavo F. Padovan } __packed;
7691da177e4SLinus Torvalds 
770a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
771a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
7721da177e4SLinus Torvalds 	__u8     dev_class[3];
77366c853ccSGustavo F. Padovan } __packed;
7741da177e4SLinus Torvalds 
775a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
7761da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
7771da177e4SLinus Torvalds 	__u8     status;
7781ebb9252SMarcel Holtmann 	__le16   voice_setting;
77966c853ccSGustavo F. Padovan } __packed;
7801da177e4SLinus Torvalds 
781a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
7821da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
7831ebb9252SMarcel Holtmann 	__le16   voice_setting;
78466c853ccSGustavo F. Padovan } __packed;
7851da177e4SLinus Torvalds 
786a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
7871da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
7881ebb9252SMarcel Holtmann 	__le16   acl_mtu;
7891da177e4SLinus Torvalds 	__u8     sco_mtu;
7901ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
7911ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
79266c853ccSGustavo F. Padovan } __packed;
7931da177e4SLinus Torvalds 
794d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
795d5859e22SJohan Hedberg 
79680a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
79780a1e1dbSJohan Hedberg 
79880a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
79980a1e1dbSJohan Hedberg struct hci_cp_write_eir {
800816a11d5SJohan Hedberg 	__u8	fec;
801816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
80280a1e1dbSJohan Hedberg } __packed;
80380a1e1dbSJohan Hedberg 
804333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
805333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
806333140b5SMarcel Holtmann 	__u8     status;
807333140b5SMarcel Holtmann 	__u8     mode;
80866c853ccSGustavo F. Padovan } __packed;
809333140b5SMarcel Holtmann 
810333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
811333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
812333140b5SMarcel Holtmann 	__u8     mode;
81366c853ccSGustavo F. Padovan } __packed;
814333140b5SMarcel Holtmann 
815c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
816c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
817c35938b2SSzymon Janc 	__u8     status;
818c35938b2SSzymon Janc 	__u8     hash[16];
819c35938b2SSzymon Janc 	__u8     randomizer[16];
820c35938b2SSzymon Janc } __packed;
821c35938b2SSzymon Janc 
822d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
82391c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
82491c4e9b1SMarcel Holtmann 	__u8     status;
82591c4e9b1SMarcel Holtmann 	__s8     tx_power;
82691c4e9b1SMarcel Holtmann } __packed;
827d5859e22SJohan Hedberg 
828d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
829d62e6d67SJohan Hedberg 
8301e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
8311e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
8321e89cffbSAndrei Emeltchenko 	__u8     status;
8331e89cffbSAndrei Emeltchenko 	__u8     mode;
8341e89cffbSAndrei Emeltchenko } __packed;
8351e89cffbSAndrei Emeltchenko 
836f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
837f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
838f9b49306SAndre Guedes 	__u8	le;
839f9b49306SAndre Guedes 	__u8	simul;
840f9b49306SAndre Guedes } __packed;
841f9b49306SAndre Guedes 
842*d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
843*d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
844*d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
845*d0bf75a5SDoHyun Pyun } __packed;
846*d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
847*d0bf75a5SDoHyun Pyun 	__u8	status;
848*d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
849*d0bf75a5SDoHyun Pyun } __packed;
850*d0bf75a5SDoHyun Pyun 
8515d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
8525d4e7e8dSJohan Hedberg 
853a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
854a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
8551da177e4SLinus Torvalds 	__u8     status;
856a9de9248SMarcel Holtmann 	__u8     hci_ver;
857a9de9248SMarcel Holtmann 	__le16   hci_rev;
858a9de9248SMarcel Holtmann 	__u8     lmp_ver;
859a9de9248SMarcel Holtmann 	__le16   manufacturer;
860a9de9248SMarcel Holtmann 	__le16   lmp_subver;
86166c853ccSGustavo F. Padovan } __packed;
8621da177e4SLinus Torvalds 
863a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
864a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
8651da177e4SLinus Torvalds 	__u8     status;
866a9de9248SMarcel Holtmann 	__u8     commands[64];
86766c853ccSGustavo F. Padovan } __packed;
8681da177e4SLinus Torvalds 
869a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
870a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
871a9de9248SMarcel Holtmann 	__u8     status;
872a9de9248SMarcel Holtmann 	__u8     features[8];
87366c853ccSGustavo F. Padovan } __packed;
874a9de9248SMarcel Holtmann 
875a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
876971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
877971e3a4bSAndre Guedes 	__u8     page;
878971e3a4bSAndre Guedes } __packed;
879a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
880a9de9248SMarcel Holtmann 	__u8     status;
881a9de9248SMarcel Holtmann 	__u8     page;
882a9de9248SMarcel Holtmann 	__u8     max_page;
883a9de9248SMarcel Holtmann 	__u8     features[8];
88466c853ccSGustavo F. Padovan } __packed;
885a9de9248SMarcel Holtmann 
886a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
887a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
888a9de9248SMarcel Holtmann 	__u8     status;
889a9de9248SMarcel Holtmann 	__le16   acl_mtu;
890a9de9248SMarcel Holtmann 	__u8     sco_mtu;
891a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
892a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
89366c853ccSGustavo F. Padovan } __packed;
894a9de9248SMarcel Holtmann 
895a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
896a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
897a9de9248SMarcel Holtmann 	__u8     status;
8981da177e4SLinus Torvalds 	bdaddr_t bdaddr;
89966c853ccSGustavo F. Padovan } __packed;
9001da177e4SLinus Torvalds 
901350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
902350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
903350ee4cfSAndrei Emeltchenko 	__u8     status;
904350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
905350ee4cfSAndrei Emeltchenko 	__le16   block_len;
906350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
907350ee4cfSAndrei Emeltchenko } __packed;
908350ee4cfSAndrei Emeltchenko 
909f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
910f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
911f332ec66SJohan Hedberg 	__u8     status;
912f332ec66SJohan Hedberg 	__le16   interval;
913f332ec66SJohan Hedberg 	__le16   window;
914f332ec66SJohan Hedberg } __packed;
915f332ec66SJohan Hedberg 
916f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
917f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
918f6422ec6SAntti Julku 	__le16   interval;
919f6422ec6SAntti Julku 	__le16   window;
920f6422ec6SAntti Julku } __packed;
921f6422ec6SAntti Julku 
922f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
923f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
924f332ec66SJohan Hedberg 	__u8     status;
925f332ec66SJohan Hedberg 	__u8     type;
926f332ec66SJohan Hedberg } __packed;
927f332ec66SJohan Hedberg 
928f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
929f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
930f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
931f6422ec6SAntti Julku 
932928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
933928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
934928abaa7SAndrei Emeltchenko 	__u8     status;
935928abaa7SAndrei Emeltchenko 	__u8     amp_status;
936928abaa7SAndrei Emeltchenko 	__le32   total_bw;
937928abaa7SAndrei Emeltchenko 	__le32   max_bw;
938928abaa7SAndrei Emeltchenko 	__le32   min_latency;
939928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
940928abaa7SAndrei Emeltchenko 	__u8     amp_type;
941928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
942928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
943928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
944928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
945928abaa7SAndrei Emeltchenko } __packed;
946928abaa7SAndrei Emeltchenko 
947523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
948523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
949523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
950523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
951523e93cdSAndrei Emeltchenko 	__le16   max_len;
952523e93cdSAndrei Emeltchenko } __packed;
953523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
954523e93cdSAndrei Emeltchenko 	__u8     status;
955523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
956523e93cdSAndrei Emeltchenko 	__le16   rem_len;
957523e93cdSAndrei Emeltchenko 	__u8     frag[0];
958523e93cdSAndrei Emeltchenko } __packed;
959523e93cdSAndrei Emeltchenko 
960523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
961523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
962523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
963523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
964523e93cdSAndrei Emeltchenko 	__le16   rem_len;
965523e93cdSAndrei Emeltchenko 	__u8     frag[0];
966523e93cdSAndrei Emeltchenko } __packed;
967523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
968523e93cdSAndrei Emeltchenko 	__u8     status;
969523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
970523e93cdSAndrei Emeltchenko } __packed;
971523e93cdSAndrei Emeltchenko 
97263185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
97363185f64SVille Tervo struct hci_cp_le_set_event_mask {
97463185f64SVille Tervo 	__u8     mask[8];
97563185f64SVille Tervo } __packed;
97663185f64SVille Tervo 
97763185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
97863185f64SVille Tervo struct hci_rp_le_read_buffer_size {
97963185f64SVille Tervo 	__u8     status;
98063185f64SVille Tervo 	__le16   le_mtu;
98163185f64SVille Tervo 	__u8     le_max_pkt;
98263185f64SVille Tervo } __packed;
98363185f64SVille Tervo 
98460e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
98560e77321SJohan Hedberg struct hci_rp_le_read_local_features {
98660e77321SJohan Hedberg 	__u8     status;
98760e77321SJohan Hedberg 	__u8     features[8];
98860e77321SJohan Hedberg } __packed;
98960e77321SJohan Hedberg 
990d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
991d13eafceSMarcel Holtmann 
9928fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
9938fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
9948fa19098SJohan Hedberg 	__u8	status;
9958fa19098SJohan Hedberg 	__s8	tx_power;
9968fa19098SJohan Hedberg } __packed;
9978fa19098SJohan Hedberg 
9983f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
9993f0f524bSJohan Hedberg 
10003f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
10013f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
10023f0f524bSJohan Hedberg 	__u8	length;
10033f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
10043f0f524bSJohan Hedberg } __packed;
10053f0f524bSJohan Hedberg 
1006c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1007c1d5dc4aSJohan Hedberg 
10085df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
10095df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
10105df480b5SAndre Guedes 
101107f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
101207f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
101307f7fa5dSAndre Guedes 	__u8    type;
101407f7fa5dSAndre Guedes 	__le16  interval;
101507f7fa5dSAndre Guedes 	__le16  window;
101607f7fa5dSAndre Guedes 	__u8    own_address_type;
101707f7fa5dSAndre Guedes 	__u8    filter_policy;
101807f7fa5dSAndre Guedes } __packed;
101907f7fa5dSAndre Guedes 
102076a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
102176a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1022525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1023525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
102468a8aea4SAndrei Emeltchenko 
1025eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1026eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1027eb9d91f5SAndre Guedes 	__u8     enable;
1028eb9d91f5SAndre Guedes 	__u8     filter_dup;
1029eb9d91f5SAndre Guedes } __packed;
1030eb9d91f5SAndre Guedes 
103163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
103263185f64SVille Tervo struct hci_cp_le_create_conn {
103363185f64SVille Tervo 	__le16   scan_interval;
103463185f64SVille Tervo 	__le16   scan_window;
103563185f64SVille Tervo 	__u8     filter_policy;
103663185f64SVille Tervo 	__u8     peer_addr_type;
103763185f64SVille Tervo 	bdaddr_t peer_addr;
103863185f64SVille Tervo 	__u8     own_address_type;
103963185f64SVille Tervo 	__le16   conn_interval_min;
104063185f64SVille Tervo 	__le16   conn_interval_max;
104163185f64SVille Tervo 	__le16   conn_latency;
104263185f64SVille Tervo 	__le16   supervision_timeout;
104363185f64SVille Tervo 	__le16   min_ce_len;
104463185f64SVille Tervo 	__le16   max_ce_len;
104563185f64SVille Tervo } __packed;
104663185f64SVille Tervo 
104763185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
104863185f64SVille Tervo 
1049cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1050cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1051cf1d081fSJohan Hedberg 	__u8	status;
1052cf1d081fSJohan Hedberg 	__u8	size;
1053cf1d081fSJohan Hedberg } __packed;
1054cf1d081fSJohan Hedberg 
10552ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
10562ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
10572ce603ebSClaudio Takahasi 	__le16   handle;
10582ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
10592ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
10602ce603ebSClaudio Takahasi 	__le16   conn_latency;
10612ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
10622ce603ebSClaudio Takahasi 	__le16   min_ce_len;
10632ce603ebSClaudio Takahasi 	__le16   max_ce_len;
10642ce603ebSClaudio Takahasi } __packed;
10652ce603ebSClaudio Takahasi 
1066a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1067a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1068a7a595f6SVinicius Costa Gomes 	__le16	handle;
1069a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
1070a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1071a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1072a7a595f6SVinicius Costa Gomes } __packed;
1073a7a595f6SVinicius Costa Gomes 
1074a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1075a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1076a7a595f6SVinicius Costa Gomes 	__le16	handle;
1077a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1078a7a595f6SVinicius Costa Gomes } __packed;
1079a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1080a7a595f6SVinicius Costa Gomes 	__u8	status;
1081a7a595f6SVinicius Costa Gomes 	__le16	handle;
1082a7a595f6SVinicius Costa Gomes } __packed;
1083a7a595f6SVinicius Costa Gomes 
1084a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1085a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1086a7a595f6SVinicius Costa Gomes 	__le16	handle;
1087a7a595f6SVinicius Costa Gomes } __packed;
1088a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1089a7a595f6SVinicius Costa Gomes 	__u8	status;
1090a7a595f6SVinicius Costa Gomes 	__le16	handle;
1091a7a595f6SVinicius Costa Gomes } __packed;
1092a7a595f6SVinicius Costa Gomes 
10939b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
10949b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
10959b008c04SJohan Hedberg 	__u8	status;
10969b008c04SJohan Hedberg 	__u8	le_states[8];
10979b008c04SJohan Hedberg } __packed;
10989b008c04SJohan Hedberg 
10991da177e4SLinus Torvalds /* ---- HCI Events ---- */
11001da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
11011da177e4SLinus Torvalds 
11021da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
11031da177e4SLinus Torvalds struct inquiry_info {
11041da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11051da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
11061da177e4SLinus Torvalds 	__u8     pscan_period_mode;
11071da177e4SLinus Torvalds 	__u8     pscan_mode;
11081da177e4SLinus Torvalds 	__u8     dev_class[3];
11091ebb9252SMarcel Holtmann 	__le16   clock_offset;
111066c853ccSGustavo F. Padovan } __packed;
11111da177e4SLinus Torvalds 
11121da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
11131da177e4SLinus Torvalds struct hci_ev_conn_complete {
11141da177e4SLinus Torvalds 	__u8     status;
11151ebb9252SMarcel Holtmann 	__le16   handle;
11161da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11171da177e4SLinus Torvalds 	__u8     link_type;
11181da177e4SLinus Torvalds 	__u8     encr_mode;
111966c853ccSGustavo F. Padovan } __packed;
11201da177e4SLinus Torvalds 
11211da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
11221da177e4SLinus Torvalds struct hci_ev_conn_request {
11231da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11241da177e4SLinus Torvalds 	__u8     dev_class[3];
11251da177e4SLinus Torvalds 	__u8     link_type;
112666c853ccSGustavo F. Padovan } __packed;
11271da177e4SLinus Torvalds 
11281da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
11291da177e4SLinus Torvalds struct hci_ev_disconn_complete {
11301da177e4SLinus Torvalds 	__u8     status;
11311ebb9252SMarcel Holtmann 	__le16   handle;
11321da177e4SLinus Torvalds 	__u8     reason;
113366c853ccSGustavo F. Padovan } __packed;
11341da177e4SLinus Torvalds 
11351da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
11361da177e4SLinus Torvalds struct hci_ev_auth_complete {
11371da177e4SLinus Torvalds 	__u8     status;
11381ebb9252SMarcel Holtmann 	__le16   handle;
113966c853ccSGustavo F. Padovan } __packed;
11401da177e4SLinus Torvalds 
1141a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1142a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1143a9de9248SMarcel Holtmann 	__u8     status;
1144a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
11451f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
114666c853ccSGustavo F. Padovan } __packed;
1147a9de9248SMarcel Holtmann 
11481da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
11491da177e4SLinus Torvalds struct hci_ev_encrypt_change {
11501da177e4SLinus Torvalds 	__u8     status;
11511ebb9252SMarcel Holtmann 	__le16   handle;
11521da177e4SLinus Torvalds 	__u8     encrypt;
115366c853ccSGustavo F. Padovan } __packed;
11541da177e4SLinus Torvalds 
1155a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1156a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
11571da177e4SLinus Torvalds 	__u8     status;
11581ebb9252SMarcel Holtmann 	__le16   handle;
115966c853ccSGustavo F. Padovan } __packed;
11601da177e4SLinus Torvalds 
1161a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1162a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1163a9de9248SMarcel Holtmann 	__u8     status;
1164a9de9248SMarcel Holtmann 	__le16   handle;
1165a9de9248SMarcel Holtmann 	__u8     features[8];
116666c853ccSGustavo F. Padovan } __packed;
1167a9de9248SMarcel Holtmann 
1168a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1169a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1170a9de9248SMarcel Holtmann 	__u8     status;
1171a9de9248SMarcel Holtmann 	__le16   handle;
1172a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1173a9de9248SMarcel Holtmann 	__le16   manufacturer;
1174a9de9248SMarcel Holtmann 	__le16   lmp_subver;
117566c853ccSGustavo F. Padovan } __packed;
1176a9de9248SMarcel Holtmann 
1177a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
11781da177e4SLinus Torvalds struct hci_qos {
11791da177e4SLinus Torvalds 	__u8     service_type;
11801da177e4SLinus Torvalds 	__u32    token_rate;
11811da177e4SLinus Torvalds 	__u32    peak_bandwidth;
11821da177e4SLinus Torvalds 	__u32    latency;
11831da177e4SLinus Torvalds 	__u32    delay_variation;
118466c853ccSGustavo F. Padovan } __packed;
11851da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
11861da177e4SLinus Torvalds 	__u8     status;
11871ebb9252SMarcel Holtmann 	__le16   handle;
11881da177e4SLinus Torvalds 	struct   hci_qos qos;
118966c853ccSGustavo F. Padovan } __packed;
11901da177e4SLinus Torvalds 
1191a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
11921da177e4SLinus Torvalds struct hci_ev_cmd_complete {
11931da177e4SLinus Torvalds 	__u8     ncmd;
11941ebb9252SMarcel Holtmann 	__le16   opcode;
119566c853ccSGustavo F. Padovan } __packed;
11961da177e4SLinus Torvalds 
1197a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
11981da177e4SLinus Torvalds struct hci_ev_cmd_status {
11991da177e4SLinus Torvalds 	__u8     status;
12001da177e4SLinus Torvalds 	__u8     ncmd;
12011ebb9252SMarcel Holtmann 	__le16   opcode;
120266c853ccSGustavo F. Padovan } __packed;
12031da177e4SLinus Torvalds 
12041da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
12051da177e4SLinus Torvalds struct hci_ev_role_change {
12061da177e4SLinus Torvalds 	__u8     status;
12071da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12081da177e4SLinus Torvalds 	__u8     role;
120966c853ccSGustavo F. Padovan } __packed;
12101da177e4SLinus Torvalds 
1211a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1212613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1213613a1c0cSAndrei Emeltchenko 	__le16   handle;
1214613a1c0cSAndrei Emeltchenko 	__le16   count;
1215613a1c0cSAndrei Emeltchenko } __packed;
1216613a1c0cSAndrei Emeltchenko 
1217a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1218a9de9248SMarcel Holtmann 	__u8     num_hndl;
1219613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
122066c853ccSGustavo F. Padovan } __packed;
1221a9de9248SMarcel Holtmann 
12221da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
12231da177e4SLinus Torvalds struct hci_ev_mode_change {
12241da177e4SLinus Torvalds 	__u8     status;
12251ebb9252SMarcel Holtmann 	__le16   handle;
12261da177e4SLinus Torvalds 	__u8     mode;
12271ebb9252SMarcel Holtmann 	__le16   interval;
122866c853ccSGustavo F. Padovan } __packed;
12291da177e4SLinus Torvalds 
12301da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
12311da177e4SLinus Torvalds struct hci_ev_pin_code_req {
12321da177e4SLinus Torvalds 	bdaddr_t bdaddr;
123366c853ccSGustavo F. Padovan } __packed;
12341da177e4SLinus Torvalds 
12351da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
12361da177e4SLinus Torvalds struct hci_ev_link_key_req {
12371da177e4SLinus Torvalds 	bdaddr_t bdaddr;
123866c853ccSGustavo F. Padovan } __packed;
12391da177e4SLinus Torvalds 
12401da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
12411da177e4SLinus Torvalds struct hci_ev_link_key_notify {
12421da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12439b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
12441da177e4SLinus Torvalds 	__u8     key_type;
124566c853ccSGustavo F. Padovan } __packed;
12461da177e4SLinus Torvalds 
1247a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
12481da177e4SLinus Torvalds struct hci_ev_clock_offset {
12491da177e4SLinus Torvalds 	__u8     status;
12501ebb9252SMarcel Holtmann 	__le16   handle;
12511ebb9252SMarcel Holtmann 	__le16   clock_offset;
125266c853ccSGustavo F. Padovan } __packed;
12531da177e4SLinus Torvalds 
1254a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1255a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1256a8746417SMarcel Holtmann 	__u8     status;
1257a8746417SMarcel Holtmann 	__le16   handle;
1258a8746417SMarcel Holtmann 	__le16   pkt_type;
125966c853ccSGustavo F. Padovan } __packed;
1260a8746417SMarcel Holtmann 
126185a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
126285a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
126385a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
126485a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
126566c853ccSGustavo F. Padovan } __packed;
126685a1e930SMarcel Holtmann 
1267a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1268a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1269a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1270a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1271a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1272a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1273a9de9248SMarcel Holtmann 	__le16   clock_offset;
1274a9de9248SMarcel Holtmann 	__s8     rssi;
127566c853ccSGustavo F. Padovan } __packed;
1276a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1277a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1278a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1279a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1280a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1281a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1282a9de9248SMarcel Holtmann 	__le16   clock_offset;
1283a9de9248SMarcel Holtmann 	__s8     rssi;
128466c853ccSGustavo F. Padovan } __packed;
1285a9de9248SMarcel Holtmann 
1286a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1287a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1288a9de9248SMarcel Holtmann 	__u8     status;
1289a9de9248SMarcel Holtmann 	__le16   handle;
1290a9de9248SMarcel Holtmann 	__u8     page;
1291a9de9248SMarcel Holtmann 	__u8     max_page;
1292a9de9248SMarcel Holtmann 	__u8     features[8];
129366c853ccSGustavo F. Padovan } __packed;
1294a9de9248SMarcel Holtmann 
1295a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1296a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1297a9de9248SMarcel Holtmann 	__u8     status;
1298a9de9248SMarcel Holtmann 	__le16   handle;
1299a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1300a9de9248SMarcel Holtmann 	__u8     link_type;
1301a9de9248SMarcel Holtmann 	__u8     tx_interval;
1302a9de9248SMarcel Holtmann 	__u8     retrans_window;
1303a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1304a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1305a9de9248SMarcel Holtmann 	__u8     air_mode;
130666c853ccSGustavo F. Padovan } __packed;
1307a9de9248SMarcel Holtmann 
1308a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1309a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1310a9de9248SMarcel Holtmann 	__u8     status;
1311a9de9248SMarcel Holtmann 	__le16   handle;
1312a9de9248SMarcel Holtmann 	__u8     tx_interval;
1313a9de9248SMarcel Holtmann 	__u8     retrans_window;
1314a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1315a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
131666c853ccSGustavo F. Padovan } __packed;
1317a9de9248SMarcel Holtmann 
1318a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
131904837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
132004837f64SMarcel Holtmann 	__u8     status;
132104837f64SMarcel Holtmann 	__le16   handle;
132204837f64SMarcel Holtmann 	__le16   max_tx_latency;
132304837f64SMarcel Holtmann 	__le16   max_rx_latency;
132404837f64SMarcel Holtmann 	__le16   max_remote_timeout;
132504837f64SMarcel Holtmann 	__le16   max_local_timeout;
132666c853ccSGustavo F. Padovan } __packed;
132704837f64SMarcel Holtmann 
1328a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1329a9de9248SMarcel Holtmann struct extended_inquiry_info {
1330a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1331a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1332a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1333a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1334a9de9248SMarcel Holtmann 	__le16   clock_offset;
1335a9de9248SMarcel Holtmann 	__s8     rssi;
1336a9de9248SMarcel Holtmann 	__u8     data[240];
133766c853ccSGustavo F. Padovan } __packed;
1338a9de9248SMarcel Holtmann 
13391c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
13401c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
13411c2e0041SJohan Hedberg 	__u8	status;
13421c2e0041SJohan Hedberg 	__le16	handle;
13431c2e0041SJohan Hedberg } __packed;
13441c2e0041SJohan Hedberg 
13450493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
13460493684eSMarcel Holtmann struct hci_ev_io_capa_request {
13470493684eSMarcel Holtmann 	bdaddr_t bdaddr;
134866c853ccSGustavo F. Padovan } __packed;
13490493684eSMarcel Holtmann 
135003b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
135103b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
135203b555e1SJohan Hedberg 	bdaddr_t bdaddr;
135303b555e1SJohan Hedberg 	__u8     capability;
135403b555e1SJohan Hedberg 	__u8     oob_data;
135503b555e1SJohan Hedberg 	__u8     authentication;
135603b555e1SJohan Hedberg } __packed;
135703b555e1SJohan Hedberg 
1358a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1359a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1360a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1361a5c29683SJohan Hedberg 	__le32		passkey;
1362a5c29683SJohan Hedberg } __packed;
1363a5c29683SJohan Hedberg 
13649ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
13659ad4019aSBrian Gix struct hci_ev_user_passkey_req {
13669ad4019aSBrian Gix 	bdaddr_t	bdaddr;
13679ad4019aSBrian Gix } __packed;
13689ad4019aSBrian Gix 
13692763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
13702763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
13712763eda6SSzymon Janc 	bdaddr_t bdaddr;
13722763eda6SSzymon Janc } __packed;
13732763eda6SSzymon Janc 
13740493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
13750493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
13760493684eSMarcel Holtmann 	__u8     status;
13770493684eSMarcel Holtmann 	bdaddr_t bdaddr;
137866c853ccSGustavo F. Padovan } __packed;
13790493684eSMarcel Holtmann 
138092a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
138192a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
138292a25256SJohan Hedberg 	bdaddr_t	bdaddr;
138392a25256SJohan Hedberg 	__le32		passkey;
138492a25256SJohan Hedberg } __packed;
138592a25256SJohan Hedberg 
138692a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
138792a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
138892a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
138992a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
139092a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
139192a25256SJohan Hedberg 
139292a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
139392a25256SJohan Hedberg struct hci_ev_keypress_notify {
139492a25256SJohan Hedberg 	bdaddr_t	bdaddr;
139592a25256SJohan Hedberg 	__u8		type;
139692a25256SJohan Hedberg } __packed;
139792a25256SJohan Hedberg 
139841a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
139941a96212SMarcel Holtmann struct hci_ev_remote_host_features {
140041a96212SMarcel Holtmann 	bdaddr_t bdaddr;
140141a96212SMarcel Holtmann 	__u8     features[8];
140266c853ccSGustavo F. Padovan } __packed;
140341a96212SMarcel Holtmann 
140463185f64SVille Tervo #define HCI_EV_LE_META			0x3e
140563185f64SVille Tervo struct hci_ev_le_meta {
140663185f64SVille Tervo 	__u8     subevent;
140763185f64SVille Tervo } __packed;
140863185f64SVille Tervo 
1409523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1410523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1411523e93cdSAndrei Emeltchenko 	__u8     status;
1412523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1413523e93cdSAndrei Emeltchenko } __packed;
1414523e93cdSAndrei Emeltchenko 
1415523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1416523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1417523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1418523e93cdSAndrei Emeltchenko } __packed;
1419523e93cdSAndrei Emeltchenko 
1420523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1421523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1422523e93cdSAndrei Emeltchenko 	__u8     status;
1423523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1424523e93cdSAndrei Emeltchenko 	__u8     reason;
1425523e93cdSAndrei Emeltchenko } __packed;
1426523e93cdSAndrei Emeltchenko 
1427523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1428523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1429523e93cdSAndrei Emeltchenko 	__u8     status;
1430523e93cdSAndrei Emeltchenko 	__le16   handle;
1431523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1432523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1433523e93cdSAndrei Emeltchenko } __packed;
1434523e93cdSAndrei Emeltchenko 
1435523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1436523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1437523e93cdSAndrei Emeltchenko 	__u8     status;
1438523e93cdSAndrei Emeltchenko 	__le16   handle;
1439523e93cdSAndrei Emeltchenko 	__u8     reason;
1440523e93cdSAndrei Emeltchenko } __packed;
1441523e93cdSAndrei Emeltchenko 
144225e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
144325e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
144425e89e99SAndrei Emeltchenko 	__le16   handle;
144525e89e99SAndrei Emeltchenko 	__le16   pkts;
144625e89e99SAndrei Emeltchenko 	__le16   blocks;
144725e89e99SAndrei Emeltchenko } __packed;
144825e89e99SAndrei Emeltchenko 
144925e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
145025e89e99SAndrei Emeltchenko 	__le16   num_blocks;
145125e89e99SAndrei Emeltchenko 	__u8     num_hndl;
145225e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
145325e89e99SAndrei Emeltchenko } __packed;
145425e89e99SAndrei Emeltchenko 
145563185f64SVille Tervo /* Low energy meta events */
1456b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1457b9b343d2SAndre Guedes 
145863185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
145963185f64SVille Tervo struct hci_ev_le_conn_complete {
146063185f64SVille Tervo 	__u8     status;
146163185f64SVille Tervo 	__le16   handle;
146263185f64SVille Tervo 	__u8     role;
146363185f64SVille Tervo 	__u8     bdaddr_type;
146463185f64SVille Tervo 	bdaddr_t bdaddr;
146563185f64SVille Tervo 	__le16   interval;
146663185f64SVille Tervo 	__le16   latency;
146763185f64SVille Tervo 	__le16   supervision_timeout;
146863185f64SVille Tervo 	__u8     clk_accurancy;
146963185f64SVille Tervo } __packed;
147063185f64SVille Tervo 
1471a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1472a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1473a7a595f6SVinicius Costa Gomes 	__le16	handle;
1474a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1475a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1476a7a595f6SVinicius Costa Gomes } __packed;
1477a7a595f6SVinicius Costa Gomes 
147857a56fd4SAnderson Briglia /* Advertising report event types */
147957a56fd4SAnderson Briglia #define ADV_IND		0x00
148057a56fd4SAnderson Briglia #define ADV_DIRECT_IND	0x01
148157a56fd4SAnderson Briglia #define ADV_SCAN_IND	0x02
148257a56fd4SAnderson Briglia #define ADV_NONCONN_IND	0x03
148357a56fd4SAnderson Briglia #define ADV_SCAN_RSP	0x04
148457a56fd4SAnderson Briglia 
148557a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
148657a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
148757a56fd4SAnderson Briglia 
148857a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
148957a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
149057a56fd4SAnderson Briglia 	__u8	 evt_type;
149157a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
149257a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
149357a56fd4SAnderson Briglia 	__u8	 length;
149457a56fd4SAnderson Briglia 	__u8	 data[0];
149557a56fd4SAnderson Briglia } __packed;
149657a56fd4SAnderson Briglia 
14971da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1498a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
14991da177e4SLinus Torvalds struct hci_ev_stack_internal {
15001da177e4SLinus Torvalds 	__u16    type;
15011da177e4SLinus Torvalds 	__u8     data[0];
150266c853ccSGustavo F. Padovan } __packed;
15031da177e4SLinus Torvalds 
15041da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
15051da177e4SLinus Torvalds struct hci_ev_si_device {
15061da177e4SLinus Torvalds 	__u16    event;
15071da177e4SLinus Torvalds 	__u16    dev_id;
150866c853ccSGustavo F. Padovan } __packed;
15091da177e4SLinus Torvalds 
15101da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
15111da177e4SLinus Torvalds struct hci_ev_si_security {
15121da177e4SLinus Torvalds 	__u16    event;
15131da177e4SLinus Torvalds 	__u16    proto;
15141da177e4SLinus Torvalds 	__u16    subproto;
15151da177e4SLinus Torvalds 	__u8     incoming;
151666c853ccSGustavo F. Padovan } __packed;
15171da177e4SLinus Torvalds 
15181da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
15191da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
15201da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
15211da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
15221da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
15231da177e4SLinus Torvalds 
15241da177e4SLinus Torvalds struct hci_command_hdr {
15251ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
15261da177e4SLinus Torvalds 	__u8	plen;
152766c853ccSGustavo F. Padovan } __packed;
15281da177e4SLinus Torvalds 
15291da177e4SLinus Torvalds struct hci_event_hdr {
15301da177e4SLinus Torvalds 	__u8	evt;
15311da177e4SLinus Torvalds 	__u8	plen;
153266c853ccSGustavo F. Padovan } __packed;
15331da177e4SLinus Torvalds 
15341da177e4SLinus Torvalds struct hci_acl_hdr {
15351ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
15361ebb9252SMarcel Holtmann 	__le16	dlen;
153766c853ccSGustavo F. Padovan } __packed;
15381da177e4SLinus Torvalds 
15391da177e4SLinus Torvalds struct hci_sco_hdr {
15401ebb9252SMarcel Holtmann 	__le16	handle;
15411da177e4SLinus Torvalds 	__u8	dlen;
154266c853ccSGustavo F. Padovan } __packed;
15431da177e4SLinus Torvalds 
15442a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
15452a123b86SArnaldo Carvalho de Melo {
15462a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
15472a123b86SArnaldo Carvalho de Melo }
15482a123b86SArnaldo Carvalho de Melo 
15492a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
15502a123b86SArnaldo Carvalho de Melo {
15512a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
15522a123b86SArnaldo Carvalho de Melo }
15532a123b86SArnaldo Carvalho de Melo 
15542a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
15552a123b86SArnaldo Carvalho de Melo {
15562a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
15572a123b86SArnaldo Carvalho de Melo }
15582a123b86SArnaldo Carvalho de Melo 
15591da177e4SLinus Torvalds /* Command opcode pack/unpack */
1560c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
15611da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
15621da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
15631da177e4SLinus Torvalds 
15641da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1565c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
15661da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
15671da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
15681da177e4SLinus Torvalds 
15691da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
15701da177e4SLinus Torvalds 
15711da177e4SLinus Torvalds /* Socket options */
15721da177e4SLinus Torvalds #define HCI_DATA_DIR	1
15731da177e4SLinus Torvalds #define HCI_FILTER	2
15741da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
15751da177e4SLinus Torvalds 
15761da177e4SLinus Torvalds /* CMSG flags */
15771da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
15781da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
15791da177e4SLinus Torvalds 
15801da177e4SLinus Torvalds struct sockaddr_hci {
15811da177e4SLinus Torvalds 	sa_family_t    hci_family;
15821da177e4SLinus Torvalds 	unsigned short hci_dev;
1583c02178d2SJohan Hedberg 	unsigned short hci_channel;
15841da177e4SLinus Torvalds };
15851da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
15861da177e4SLinus Torvalds 
1587c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
158823500189SMarcel Holtmann #define HCI_CHANNEL_USER	1
1589cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
159066f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1591c02178d2SJohan Hedberg 
15921da177e4SLinus Torvalds struct hci_filter {
15931da177e4SLinus Torvalds 	unsigned long type_mask;
15941da177e4SLinus Torvalds 	unsigned long event_mask[2];
1595905f3ed6SAl Viro 	__le16 opcode;
15961da177e4SLinus Torvalds };
15971da177e4SLinus Torvalds 
15981da177e4SLinus Torvalds struct hci_ufilter {
15991da177e4SLinus Torvalds 	__u32  type_mask;
16001da177e4SLinus Torvalds 	__u32  event_mask[2];
1601905f3ed6SAl Viro 	__le16 opcode;
16021da177e4SLinus Torvalds };
16031da177e4SLinus Torvalds 
16041da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
16051da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
16061da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
16071da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
16081da177e4SLinus Torvalds 
16091da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
16101da177e4SLinus Torvalds struct hci_dev_stats {
16111da177e4SLinus Torvalds 	__u32 err_rx;
16121da177e4SLinus Torvalds 	__u32 err_tx;
16131da177e4SLinus Torvalds 	__u32 cmd_tx;
16141da177e4SLinus Torvalds 	__u32 evt_rx;
16151da177e4SLinus Torvalds 	__u32 acl_tx;
16161da177e4SLinus Torvalds 	__u32 acl_rx;
16171da177e4SLinus Torvalds 	__u32 sco_tx;
16181da177e4SLinus Torvalds 	__u32 sco_rx;
16191da177e4SLinus Torvalds 	__u32 byte_rx;
16201da177e4SLinus Torvalds 	__u32 byte_tx;
16211da177e4SLinus Torvalds };
16221da177e4SLinus Torvalds 
16231da177e4SLinus Torvalds struct hci_dev_info {
16241da177e4SLinus Torvalds 	__u16 dev_id;
16251da177e4SLinus Torvalds 	char  name[8];
16261da177e4SLinus Torvalds 
16271da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16281da177e4SLinus Torvalds 
16291da177e4SLinus Torvalds 	__u32 flags;
16301da177e4SLinus Torvalds 	__u8  type;
16311da177e4SLinus Torvalds 
16321da177e4SLinus Torvalds 	__u8  features[8];
16331da177e4SLinus Torvalds 
16341da177e4SLinus Torvalds 	__u32 pkt_type;
16351da177e4SLinus Torvalds 	__u32 link_policy;
16361da177e4SLinus Torvalds 	__u32 link_mode;
16371da177e4SLinus Torvalds 
16381da177e4SLinus Torvalds 	__u16 acl_mtu;
16391da177e4SLinus Torvalds 	__u16 acl_pkts;
16401da177e4SLinus Torvalds 	__u16 sco_mtu;
16411da177e4SLinus Torvalds 	__u16 sco_pkts;
16421da177e4SLinus Torvalds 
16431da177e4SLinus Torvalds 	struct hci_dev_stats stat;
16441da177e4SLinus Torvalds };
16451da177e4SLinus Torvalds 
16461da177e4SLinus Torvalds struct hci_conn_info {
16471da177e4SLinus Torvalds 	__u16    handle;
16481da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16491da177e4SLinus Torvalds 	__u8     type;
16501da177e4SLinus Torvalds 	__u8     out;
16511da177e4SLinus Torvalds 	__u16    state;
16521da177e4SLinus Torvalds 	__u32    link_mode;
16531da177e4SLinus Torvalds };
16541da177e4SLinus Torvalds 
16551da177e4SLinus Torvalds struct hci_dev_req {
16561da177e4SLinus Torvalds 	__u16  dev_id;
16571da177e4SLinus Torvalds 	__u32  dev_opt;
16581da177e4SLinus Torvalds };
16591da177e4SLinus Torvalds 
16601da177e4SLinus Torvalds struct hci_dev_list_req {
16611da177e4SLinus Torvalds 	__u16  dev_num;
16621da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
16631da177e4SLinus Torvalds };
16641da177e4SLinus Torvalds 
16651da177e4SLinus Torvalds struct hci_conn_list_req {
16661da177e4SLinus Torvalds 	__u16  dev_id;
16671da177e4SLinus Torvalds 	__u16  conn_num;
16681da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
16691da177e4SLinus Torvalds };
16701da177e4SLinus Torvalds 
16711da177e4SLinus Torvalds struct hci_conn_info_req {
16721da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16731da177e4SLinus Torvalds 	__u8     type;
16741da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
16751da177e4SLinus Torvalds };
16761da177e4SLinus Torvalds 
167740be492fSMarcel Holtmann struct hci_auth_info_req {
167840be492fSMarcel Holtmann 	bdaddr_t bdaddr;
167940be492fSMarcel Holtmann 	__u8     type;
168040be492fSMarcel Holtmann };
168140be492fSMarcel Holtmann 
16821da177e4SLinus Torvalds struct hci_inquiry_req {
16831da177e4SLinus Torvalds 	__u16 dev_id;
16841da177e4SLinus Torvalds 	__u16 flags;
16851da177e4SLinus Torvalds 	__u8  lap[3];
16861da177e4SLinus Torvalds 	__u8  length;
16871da177e4SLinus Torvalds 	__u8  num_rsp;
16881da177e4SLinus Torvalds };
16891da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
16901da177e4SLinus Torvalds 
16918b281b9cSFabio Estevam extern bool enable_hs;
16928830f514SAndrei Emeltchenko 
16931da177e4SLinus Torvalds #endif /* __HCI_H */
1694