xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 23500189d7e03a071f0746f43f2cce875a62c91c)
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,
107a8b2d5c2SJohan Hedberg 	HCI_MGMT,
108a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
109a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
110a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
11194324962SJohan Hovold 	HCI_UNREGISTER,
1120736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
113a8b2d5c2SJohan Hedberg 
114d23264a8SAndre Guedes 	HCI_LE_SCAN,
11584bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
1166d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
11706199cf8SJohan Hedberg 	HCI_LE_ENABLED,
11833f8f526SJohan Hedberg 	HCI_LE_PERIPHERAL,
1195e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1205e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
12147990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
12221693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1231a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
124d23264a8SAndre Guedes };
125d23264a8SAndre Guedes 
1262cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
1272cc6fb00SJohan Hedberg  * or the HCI device is closed.
1282cc6fb00SJohan Hedberg  */
1291a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
1301a4d3c4bSJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE))
1312cc6fb00SJohan Hedberg 
1321da177e4SLinus Torvalds /* HCI ioctl defines */
1331da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1341da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1351da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1361da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1371da177e4SLinus Torvalds 
1381da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1391da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1401da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1411da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
14240be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1431da177e4SLinus Torvalds 
1441da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1451da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1461da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1471da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1481da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1491da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1501da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1511da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1521da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1531da177e4SLinus Torvalds 
154f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
155f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
156f0358568SJohan Hedberg 
1571da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1581da177e4SLinus Torvalds 
1591da177e4SLinus Torvalds /* HCI timeouts */
1605f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1615f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1625f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
163d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
1645f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1659345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1661da177e4SLinus Torvalds 
1675b7f9909SMarcel Holtmann /* HCI data types */
1681da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1691da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1701da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1711da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1721da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1731da177e4SLinus Torvalds 
1745b7f9909SMarcel Holtmann /* HCI packet types */
1751da177e4SLinus Torvalds #define HCI_DM1		0x0008
1761da177e4SLinus Torvalds #define HCI_DM3		0x0400
1771da177e4SLinus Torvalds #define HCI_DM5		0x4000
1781da177e4SLinus Torvalds #define HCI_DH1		0x0010
1791da177e4SLinus Torvalds #define HCI_DH3		0x0800
1801da177e4SLinus Torvalds #define HCI_DH5		0x8000
1811da177e4SLinus Torvalds 
1821da177e4SLinus Torvalds #define HCI_HV1		0x0020
1831da177e4SLinus Torvalds #define HCI_HV2		0x0040
1841da177e4SLinus Torvalds #define HCI_HV3		0x0080
1851da177e4SLinus Torvalds 
1861da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1871da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1881da177e4SLinus Torvalds 
1895b7f9909SMarcel Holtmann /* eSCO packet types */
1905b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1915b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1925b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1935b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1945b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1955b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
196efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
197efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
198efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
199efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2005b7f9909SMarcel Holtmann 
201a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
202efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
203a8746417SMarcel Holtmann 
2041da177e4SLinus Torvalds /* ACL flags */
205e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2061da177e4SLinus Torvalds #define ACL_CONT		0x01
2071da177e4SLinus Torvalds #define ACL_START		0x02
208d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2091da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2101da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2111da177e4SLinus Torvalds 
2121da177e4SLinus Torvalds /* Baseband links */
2131da177e4SLinus Torvalds #define SCO_LINK	0x00
2141da177e4SLinus Torvalds #define ACL_LINK	0x01
2155b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
216fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
217fcd89c09SVille Tervo #define LE_LINK		0x80
2183161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2191da177e4SLinus Torvalds 
2201da177e4SLinus Torvalds /* LMP features */
2211da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2221da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2231da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2241da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2251da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2261da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2271da177e4SLinus Torvalds #define LMP_HOLD	0x40
22804837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2291da177e4SLinus Torvalds 
2301da177e4SLinus Torvalds #define LMP_PARK	0x01
2311da177e4SLinus Torvalds #define LMP_RSSI	0x02
2321da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2331da177e4SLinus Torvalds #define LMP_SCO		0x08
2341da177e4SLinus Torvalds #define LMP_HV2		0x10
2351da177e4SLinus Torvalds #define LMP_HV3		0x20
2361da177e4SLinus Torvalds #define LMP_ULAW	0x40
2371da177e4SLinus Torvalds #define LMP_ALAW	0x80
2381da177e4SLinus Torvalds 
2391da177e4SLinus Torvalds #define LMP_CVSD	0x01
2401da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2411da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
24207a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2431da177e4SLinus Torvalds 
244d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2455b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2465b7f9909SMarcel Holtmann 
2475b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2485b7f9909SMarcel Holtmann #define LMP_EV5		0x02
24969ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
250d5859e22SJohan Hedberg #define LMP_LE		0x40
2515b7f9909SMarcel Holtmann 
25204837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
253d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
254efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
255efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
256efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
25704837f64SMarcel Holtmann 
258d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
259e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
260769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
261e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
262769be974SMarcel Holtmann 
263d5859e22SJohan Hedberg #define LMP_LSTO	0x01
264d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
265971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
266d5859e22SJohan Hedberg 
267eead27daSAndre Guedes /* Extended LMP features */
268cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
269eead27daSAndre Guedes #define LMP_HOST_LE		0x02
270cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
271eead27daSAndre Guedes 
27204837f64SMarcel Holtmann /* Connection modes */
27304837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
27404837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
27504837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
27604837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
27704837f64SMarcel Holtmann 
2781da177e4SLinus Torvalds /* Link policies */
2791da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2801da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2811da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2821da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2831da177e4SLinus Torvalds 
28404837f64SMarcel Holtmann /* Link modes */
2851da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2861da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2871da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2881da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2891da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2901da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2911da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2921da177e4SLinus Torvalds 
29340be492fSMarcel Holtmann /* Authentication types */
29440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
29540be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
29640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
29740be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
29840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
29940be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
30040be492fSMarcel Holtmann 
301a77b15a6SMikel Astiz /* I/O capabilities */
302a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
303a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
304a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
305a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
306a77b15a6SMikel Astiz 
307b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
308b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
309b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
310b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
311b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
312b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
313b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
314b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
315b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
316b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
317b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
318b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
319b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
320b6020ba0SWaldemar Rymarkiewicz 
3219f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3229f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
323cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3249f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3259f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
326cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
327cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3289f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3299f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3309f5a0d7bSAndrei Emeltchenko 
3312455a3eaSAndrei Emeltchenko /* Flow control modes */
3322455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3332455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3342455a3eaSAndrei Emeltchenko 
335bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
336bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
337bbaf444aSJohan Hedberg 
33832748db0SJohan Hedberg /* Extended Inquiry Response field types */
33932748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
34032748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
34132748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
34232748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
34332748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
34432748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
34532748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
34632748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
34732748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
34832748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3499ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3509ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3519ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
35232748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
35332748db0SJohan Hedberg 
3543f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
3553f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
3563f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
3573f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
3583f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
3593f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
3603f0f524bSJohan Hedberg 
3611da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3626bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3636bd32326SVille Tervo 
364a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
365a9de9248SMarcel Holtmann struct hci_cp_inquiry {
366a9de9248SMarcel Holtmann 	__u8     lap[3];
367a9de9248SMarcel Holtmann 	__u8     length;
368a9de9248SMarcel Holtmann 	__u8     num_rsp;
36966c853ccSGustavo F. Padovan } __packed;
3701da177e4SLinus Torvalds 
371a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
372a9de9248SMarcel Holtmann 
37379d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
37479d6e068SAndre Guedes 
375a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
376a9de9248SMarcel Holtmann 
377a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
378a9de9248SMarcel Holtmann struct hci_cp_create_conn {
379a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
380a9de9248SMarcel Holtmann 	__le16   pkt_type;
381a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
382a9de9248SMarcel Holtmann 	__u8     pscan_mode;
383a9de9248SMarcel Holtmann 	__le16   clock_offset;
384a9de9248SMarcel Holtmann 	__u8     role_switch;
38566c853ccSGustavo F. Padovan } __packed;
3861da177e4SLinus Torvalds 
387a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
388a9de9248SMarcel Holtmann struct hci_cp_disconnect {
389a9de9248SMarcel Holtmann 	__le16   handle;
390a9de9248SMarcel Holtmann 	__u8     reason;
39166c853ccSGustavo F. Padovan } __packed;
3921da177e4SLinus Torvalds 
393a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
394a9de9248SMarcel Holtmann struct hci_cp_add_sco {
395a9de9248SMarcel Holtmann 	__le16   handle;
396a9de9248SMarcel Holtmann 	__le16   pkt_type;
39766c853ccSGustavo F. Padovan } __packed;
398a9de9248SMarcel Holtmann 
399a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
400a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4011da177e4SLinus Torvalds 	bdaddr_t bdaddr;
40266c853ccSGustavo F. Padovan } __packed;
4031da177e4SLinus Torvalds 
404a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
405a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
406a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
407a9de9248SMarcel Holtmann 	__u8     role;
40866c853ccSGustavo F. Padovan } __packed;
4091da177e4SLinus Torvalds 
410a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
411a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
412a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
413a9de9248SMarcel Holtmann 	__u8     reason;
41466c853ccSGustavo F. Padovan } __packed;
4151da177e4SLinus Torvalds 
416a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
417a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
418a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4199b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
42066c853ccSGustavo F. Padovan } __packed;
4211da177e4SLinus Torvalds 
422a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
423a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
424a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
42566c853ccSGustavo F. Padovan } __packed;
4261da177e4SLinus Torvalds 
427a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
428a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
429a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
430a9de9248SMarcel Holtmann 	__u8     pin_len;
431a9de9248SMarcel Holtmann 	__u8     pin_code[16];
43266c853ccSGustavo F. Padovan } __packed;
433980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
434980e1a53SJohan Hedberg 	__u8     status;
435980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
436980e1a53SJohan Hedberg } __packed;
437a9de9248SMarcel Holtmann 
438a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
439a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
440a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
44166c853ccSGustavo F. Padovan } __packed;
442980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
443980e1a53SJohan Hedberg 	__u8     status;
444980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
445980e1a53SJohan Hedberg } __packed;
446a9de9248SMarcel Holtmann 
447a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
448a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
449a9de9248SMarcel Holtmann 	__le16   handle;
450a9de9248SMarcel Holtmann 	__le16   pkt_type;
45166c853ccSGustavo F. Padovan } __packed;
452a9de9248SMarcel Holtmann 
453a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
454a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
455a9de9248SMarcel Holtmann 	__le16   handle;
45666c853ccSGustavo F. Padovan } __packed;
457a9de9248SMarcel Holtmann 
458a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
459a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
460a9de9248SMarcel Holtmann 	__le16   handle;
461a9de9248SMarcel Holtmann 	__u8     encrypt;
46266c853ccSGustavo F. Padovan } __packed;
463a9de9248SMarcel Holtmann 
464a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
465a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
466a9de9248SMarcel Holtmann 	__le16   handle;
46766c853ccSGustavo F. Padovan } __packed;
468a9de9248SMarcel Holtmann 
469a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
470a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
471a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
472a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
473a9de9248SMarcel Holtmann 	__u8     pscan_mode;
474a9de9248SMarcel Holtmann 	__le16   clock_offset;
47566c853ccSGustavo F. Padovan } __packed;
476a9de9248SMarcel Holtmann 
477a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
478a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
479a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
48066c853ccSGustavo F. Padovan } __packed;
481a9de9248SMarcel Holtmann 
482a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
483a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
484a9de9248SMarcel Holtmann 	__le16   handle;
48566c853ccSGustavo F. Padovan } __packed;
486a9de9248SMarcel Holtmann 
487a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
488a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
489a9de9248SMarcel Holtmann 	__le16   handle;
490a9de9248SMarcel Holtmann 	__u8     page;
49166c853ccSGustavo F. Padovan } __packed;
492a9de9248SMarcel Holtmann 
493a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
494a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
495a9de9248SMarcel Holtmann 	__le16   handle;
49666c853ccSGustavo F. Padovan } __packed;
497a9de9248SMarcel Holtmann 
498a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
499a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
500a9de9248SMarcel Holtmann 	__le16   handle;
501a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
502a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
503a9de9248SMarcel Holtmann 	__le16   max_latency;
504a9de9248SMarcel Holtmann 	__le16   voice_setting;
505a9de9248SMarcel Holtmann 	__u8     retrans_effort;
506a9de9248SMarcel Holtmann 	__le16   pkt_type;
50766c853ccSGustavo F. Padovan } __packed;
508a9de9248SMarcel Holtmann 
509a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
510a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
511a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
512a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
513a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
514a9de9248SMarcel Holtmann 	__le16   max_latency;
515a9de9248SMarcel Holtmann 	__le16   content_format;
516a9de9248SMarcel Holtmann 	__u8     retrans_effort;
517a9de9248SMarcel Holtmann 	__le16   pkt_type;
51866c853ccSGustavo F. Padovan } __packed;
519a9de9248SMarcel Holtmann 
520a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
521a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
522a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
523a9de9248SMarcel Holtmann 	__u8     reason;
52466c853ccSGustavo F. Padovan } __packed;
525a9de9248SMarcel Holtmann 
52617fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
52717fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
52817fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
52917fa4b9dSJohan Hedberg 	__u8     capability;
53017fa4b9dSJohan Hedberg 	__u8     oob_data;
53117fa4b9dSJohan Hedberg 	__u8     authentication;
53217fa4b9dSJohan Hedberg } __packed;
53317fa4b9dSJohan Hedberg 
534a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
535a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
536a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
537a5c29683SJohan Hedberg } __packed;
538a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
539a5c29683SJohan Hedberg 	__u8     status;
540a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
541a5c29683SJohan Hedberg } __packed;
542a5c29683SJohan Hedberg 
543a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
544a5c29683SJohan Hedberg 
5459ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5469ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5479ad4019aSBrian Gix 	bdaddr_t bdaddr;
5489ad4019aSBrian Gix 	__le32	passkey;
5499ad4019aSBrian Gix } __packed;
5509ad4019aSBrian Gix 
5519ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5529ad4019aSBrian Gix 
5532763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5542763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5552763eda6SSzymon Janc 	bdaddr_t bdaddr;
5562763eda6SSzymon Janc 	__u8     hash[16];
5572763eda6SSzymon Janc 	__u8     randomizer[16];
5582763eda6SSzymon Janc } __packed;
5592763eda6SSzymon Janc 
5602763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5612763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5622763eda6SSzymon Janc 	bdaddr_t bdaddr;
5632763eda6SSzymon Janc } __packed;
5642763eda6SSzymon Janc 
56503b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
56603b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
56703b555e1SJohan Hedberg 	bdaddr_t bdaddr;
56803b555e1SJohan Hedberg 	__u8     reason;
56903b555e1SJohan Hedberg } __packed;
57003b555e1SJohan Hedberg 
571523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
572523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
573523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
574523e93cdSAndrei Emeltchenko 	__u8     key_len;
575523e93cdSAndrei Emeltchenko 	__u8     key_type;
576523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
577523e93cdSAndrei Emeltchenko } __packed;
578523e93cdSAndrei Emeltchenko 
579523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
580523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
581523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
582523e93cdSAndrei Emeltchenko 	__u8     key_len;
583523e93cdSAndrei Emeltchenko 	__u8     key_type;
584523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
585523e93cdSAndrei Emeltchenko } __packed;
586523e93cdSAndrei Emeltchenko 
587523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
588523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
589523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
590523e93cdSAndrei Emeltchenko 	__u8     reason;
591b078b564SAndrei Emeltchenko } __packed;
592b078b564SAndrei Emeltchenko 
593b078b564SAndrei Emeltchenko struct ext_flow_spec {
594b078b564SAndrei Emeltchenko 	__u8       id;
595b078b564SAndrei Emeltchenko 	__u8       stype;
596b078b564SAndrei Emeltchenko 	__le16     msdu;
597b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
598b078b564SAndrei Emeltchenko 	__le32     acc_lat;
599b078b564SAndrei Emeltchenko 	__le32     flush_to;
600b078b564SAndrei Emeltchenko } __packed;
601b078b564SAndrei Emeltchenko 
602b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
603b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
604b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
605b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
606b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
607b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
608b078b564SAndrei Emeltchenko } __packed;
609b078b564SAndrei Emeltchenko 
610b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
611b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
612b078b564SAndrei Emeltchenko 	__le16   log_handle;
613b078b564SAndrei Emeltchenko } __packed;
614b078b564SAndrei Emeltchenko 
615b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
616b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
617b078b564SAndrei Emeltchenko 	__u8     phy_handle;
618b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
619b078b564SAndrei Emeltchenko } __packed;
620b078b564SAndrei Emeltchenko 
621b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
622b078b564SAndrei Emeltchenko 	__u8     status;
623b078b564SAndrei Emeltchenko 	__u8     phy_handle;
624b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
625523e93cdSAndrei Emeltchenko } __packed;
626523e93cdSAndrei Emeltchenko 
627a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
628a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
629a9de9248SMarcel Holtmann 	__le16   handle;
630a9de9248SMarcel Holtmann 	__le16   max_interval;
631a9de9248SMarcel Holtmann 	__le16   min_interval;
632a9de9248SMarcel Holtmann 	__le16   attempt;
633a9de9248SMarcel Holtmann 	__le16   timeout;
63466c853ccSGustavo F. Padovan } __packed;
635a9de9248SMarcel Holtmann 
636a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
637a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
638a9de9248SMarcel Holtmann 	__le16   handle;
63966c853ccSGustavo F. Padovan } __packed;
640a9de9248SMarcel Holtmann 
641a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
642a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
643a9de9248SMarcel Holtmann 	__le16   handle;
64466c853ccSGustavo F. Padovan } __packed;
645a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
646a9de9248SMarcel Holtmann 	__u8     status;
647a9de9248SMarcel Holtmann 	__le16   handle;
648a9de9248SMarcel Holtmann 	__u8     role;
64966c853ccSGustavo F. Padovan } __packed;
650a9de9248SMarcel Holtmann 
651a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
652a9de9248SMarcel Holtmann struct hci_cp_switch_role {
653a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
654a9de9248SMarcel Holtmann 	__u8     role;
65566c853ccSGustavo F. Padovan } __packed;
656a9de9248SMarcel Holtmann 
657a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
658a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
659a9de9248SMarcel Holtmann 	__le16   handle;
66066c853ccSGustavo F. Padovan } __packed;
661a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
662a9de9248SMarcel Holtmann 	__u8     status;
663a9de9248SMarcel Holtmann 	__le16   handle;
664a9de9248SMarcel Holtmann 	__le16   policy;
66566c853ccSGustavo F. Padovan } __packed;
666a9de9248SMarcel Holtmann 
667a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
668a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
669a9de9248SMarcel Holtmann 	__le16   handle;
670a9de9248SMarcel Holtmann 	__le16   policy;
67166c853ccSGustavo F. Padovan } __packed;
672a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
673a9de9248SMarcel Holtmann 	__u8     status;
674a9de9248SMarcel Holtmann 	__le16   handle;
67566c853ccSGustavo F. Padovan } __packed;
676a9de9248SMarcel Holtmann 
677e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
678e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
679e4e8e37cSMarcel Holtmann 	__u8     status;
680e4e8e37cSMarcel Holtmann 	__le16   policy;
68166c853ccSGustavo F. Padovan } __packed;
682e4e8e37cSMarcel Holtmann 
683e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
684e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
685e4e8e37cSMarcel Holtmann 	__le16   policy;
68666c853ccSGustavo F. Padovan } __packed;
687e4e8e37cSMarcel Holtmann 
688a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
689a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
690a9de9248SMarcel Holtmann 	__le16   handle;
691a9de9248SMarcel Holtmann 	__le16   max_latency;
692a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
693a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
69466c853ccSGustavo F. Padovan } __packed;
695a9de9248SMarcel Holtmann 
696a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
697a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
698a9de9248SMarcel Holtmann 	__u8     mask[8];
69966c853ccSGustavo F. Padovan } __packed;
700a9de9248SMarcel Holtmann 
701a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
702a9de9248SMarcel Holtmann 
703a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
7041da177e4SLinus Torvalds struct hci_cp_set_event_flt {
7051da177e4SLinus Torvalds 	__u8     flt_type;
7061da177e4SLinus Torvalds 	__u8     cond_type;
7071da177e4SLinus Torvalds 	__u8     condition[0];
70866c853ccSGustavo F. Padovan } __packed;
7091da177e4SLinus Torvalds 
7101da177e4SLinus Torvalds /* Filter types */
7111da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
7121da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
7131da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
7141da177e4SLinus Torvalds 
7151da177e4SLinus Torvalds /* CONN_SETUP Condition types */
7161da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
7171da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
7181da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
7191da177e4SLinus Torvalds 
7201da177e4SLinus Torvalds /* CONN_SETUP Conditions */
7211da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
7221da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
7231da177e4SLinus Torvalds 
724b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
725b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
726b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
727b0916ea0SJohan Hedberg 	__u8     delete_all;
728b0916ea0SJohan Hedberg } __packed;
729b0916ea0SJohan Hedberg 
7301f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
7311f6c6378SJohan Hedberg 
732a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
733a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
7341f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
73566c853ccSGustavo F. Padovan } __packed;
736a9de9248SMarcel Holtmann 
737a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
738a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
739a9de9248SMarcel Holtmann 	__u8     status;
7401f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
74166c853ccSGustavo F. Padovan } __packed;
742a9de9248SMarcel Holtmann 
743a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
744a9de9248SMarcel Holtmann 
745a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
746a9de9248SMarcel Holtmann 
747a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
748a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
749a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
750a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
751a9de9248SMarcel Holtmann 
752a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
753a9de9248SMarcel Holtmann 
754a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
755a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
756a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
757a9de9248SMarcel Holtmann 
758a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
759a9de9248SMarcel Holtmann 
760a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
761a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
762a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
763a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
764a9de9248SMarcel Holtmann 
765a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
766a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
7671da177e4SLinus Torvalds 	__u8     status;
7681da177e4SLinus Torvalds 	__u8     dev_class[3];
76966c853ccSGustavo F. Padovan } __packed;
7701da177e4SLinus Torvalds 
771a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
772a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
7731da177e4SLinus Torvalds 	__u8     dev_class[3];
77466c853ccSGustavo F. Padovan } __packed;
7751da177e4SLinus Torvalds 
776a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
7771da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
7781da177e4SLinus Torvalds 	__u8     status;
7791ebb9252SMarcel Holtmann 	__le16   voice_setting;
78066c853ccSGustavo F. Padovan } __packed;
7811da177e4SLinus Torvalds 
782a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
7831da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
7841ebb9252SMarcel Holtmann 	__le16   voice_setting;
78566c853ccSGustavo F. Padovan } __packed;
7861da177e4SLinus Torvalds 
787a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
7881da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
7891ebb9252SMarcel Holtmann 	__le16   acl_mtu;
7901da177e4SLinus Torvalds 	__u8     sco_mtu;
7911ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
7921ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
79366c853ccSGustavo F. Padovan } __packed;
7941da177e4SLinus Torvalds 
795d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
796d5859e22SJohan Hedberg 
79780a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
79880a1e1dbSJohan Hedberg 
79980a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
80080a1e1dbSJohan Hedberg struct hci_cp_write_eir {
801816a11d5SJohan Hedberg 	__u8	fec;
802816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
80380a1e1dbSJohan Hedberg } __packed;
80480a1e1dbSJohan Hedberg 
805333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
806333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
807333140b5SMarcel Holtmann 	__u8     status;
808333140b5SMarcel Holtmann 	__u8     mode;
80966c853ccSGustavo F. Padovan } __packed;
810333140b5SMarcel Holtmann 
811333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
812333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
813333140b5SMarcel Holtmann 	__u8     mode;
81466c853ccSGustavo F. Padovan } __packed;
815333140b5SMarcel Holtmann 
816c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
817c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
818c35938b2SSzymon Janc 	__u8     status;
819c35938b2SSzymon Janc 	__u8     hash[16];
820c35938b2SSzymon Janc 	__u8     randomizer[16];
821c35938b2SSzymon Janc } __packed;
822c35938b2SSzymon Janc 
823d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
82491c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
82591c4e9b1SMarcel Holtmann 	__u8     status;
82691c4e9b1SMarcel Holtmann 	__s8     tx_power;
82791c4e9b1SMarcel Holtmann } __packed;
828d5859e22SJohan Hedberg 
8291e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
8301e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
8311e89cffbSAndrei Emeltchenko 	__u8     status;
8321e89cffbSAndrei Emeltchenko 	__u8     mode;
8331e89cffbSAndrei Emeltchenko } __packed;
8341e89cffbSAndrei Emeltchenko 
835f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
836f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
837f9b49306SAndre Guedes 	__u8	le;
838f9b49306SAndre Guedes 	__u8	simul;
839f9b49306SAndre Guedes } __packed;
840f9b49306SAndre Guedes 
841a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
842a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
8431da177e4SLinus Torvalds 	__u8     status;
844a9de9248SMarcel Holtmann 	__u8     hci_ver;
845a9de9248SMarcel Holtmann 	__le16   hci_rev;
846a9de9248SMarcel Holtmann 	__u8     lmp_ver;
847a9de9248SMarcel Holtmann 	__le16   manufacturer;
848a9de9248SMarcel Holtmann 	__le16   lmp_subver;
84966c853ccSGustavo F. Padovan } __packed;
8501da177e4SLinus Torvalds 
851a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
852a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
8531da177e4SLinus Torvalds 	__u8     status;
854a9de9248SMarcel Holtmann 	__u8     commands[64];
85566c853ccSGustavo F. Padovan } __packed;
8561da177e4SLinus Torvalds 
857a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
858a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
859a9de9248SMarcel Holtmann 	__u8     status;
860a9de9248SMarcel Holtmann 	__u8     features[8];
86166c853ccSGustavo F. Padovan } __packed;
862a9de9248SMarcel Holtmann 
863a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
864971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
865971e3a4bSAndre Guedes 	__u8     page;
866971e3a4bSAndre Guedes } __packed;
867a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
868a9de9248SMarcel Holtmann 	__u8     status;
869a9de9248SMarcel Holtmann 	__u8     page;
870a9de9248SMarcel Holtmann 	__u8     max_page;
871a9de9248SMarcel Holtmann 	__u8     features[8];
87266c853ccSGustavo F. Padovan } __packed;
873a9de9248SMarcel Holtmann 
874a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
875a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
876a9de9248SMarcel Holtmann 	__u8     status;
877a9de9248SMarcel Holtmann 	__le16   acl_mtu;
878a9de9248SMarcel Holtmann 	__u8     sco_mtu;
879a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
880a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
88166c853ccSGustavo F. Padovan } __packed;
882a9de9248SMarcel Holtmann 
883a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
884a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
885a9de9248SMarcel Holtmann 	__u8     status;
8861da177e4SLinus Torvalds 	bdaddr_t bdaddr;
88766c853ccSGustavo F. Padovan } __packed;
8881da177e4SLinus Torvalds 
889350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
890350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
891350ee4cfSAndrei Emeltchenko 	__u8     status;
892350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
893350ee4cfSAndrei Emeltchenko 	__le16   block_len;
894350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
895350ee4cfSAndrei Emeltchenko } __packed;
896350ee4cfSAndrei Emeltchenko 
897f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
898f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
899f332ec66SJohan Hedberg 	__u8     status;
900f332ec66SJohan Hedberg 	__le16   interval;
901f332ec66SJohan Hedberg 	__le16   window;
902f332ec66SJohan Hedberg } __packed;
903f332ec66SJohan Hedberg 
904f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
905f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
906f6422ec6SAntti Julku 	__le16   interval;
907f6422ec6SAntti Julku 	__le16   window;
908f6422ec6SAntti Julku } __packed;
909f6422ec6SAntti Julku 
910f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
911f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
912f332ec66SJohan Hedberg 	__u8     status;
913f332ec66SJohan Hedberg 	__u8     type;
914f332ec66SJohan Hedberg } __packed;
915f332ec66SJohan Hedberg 
916f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
917f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
918f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
919f6422ec6SAntti Julku 
920928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
921928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
922928abaa7SAndrei Emeltchenko 	__u8     status;
923928abaa7SAndrei Emeltchenko 	__u8     amp_status;
924928abaa7SAndrei Emeltchenko 	__le32   total_bw;
925928abaa7SAndrei Emeltchenko 	__le32   max_bw;
926928abaa7SAndrei Emeltchenko 	__le32   min_latency;
927928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
928928abaa7SAndrei Emeltchenko 	__u8     amp_type;
929928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
930928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
931928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
932928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
933928abaa7SAndrei Emeltchenko } __packed;
934928abaa7SAndrei Emeltchenko 
935523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
936523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
937523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
938523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
939523e93cdSAndrei Emeltchenko 	__le16   max_len;
940523e93cdSAndrei Emeltchenko } __packed;
941523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
942523e93cdSAndrei Emeltchenko 	__u8     status;
943523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
944523e93cdSAndrei Emeltchenko 	__le16   rem_len;
945523e93cdSAndrei Emeltchenko 	__u8     frag[0];
946523e93cdSAndrei Emeltchenko } __packed;
947523e93cdSAndrei Emeltchenko 
948523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
949523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
950523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
951523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
952523e93cdSAndrei Emeltchenko 	__le16   rem_len;
953523e93cdSAndrei Emeltchenko 	__u8     frag[0];
954523e93cdSAndrei Emeltchenko } __packed;
955523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
956523e93cdSAndrei Emeltchenko 	__u8     status;
957523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
958523e93cdSAndrei Emeltchenko } __packed;
959523e93cdSAndrei Emeltchenko 
96063185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
96163185f64SVille Tervo struct hci_cp_le_set_event_mask {
96263185f64SVille Tervo 	__u8     mask[8];
96363185f64SVille Tervo } __packed;
96463185f64SVille Tervo 
96563185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
96663185f64SVille Tervo struct hci_rp_le_read_buffer_size {
96763185f64SVille Tervo 	__u8     status;
96863185f64SVille Tervo 	__le16   le_mtu;
96963185f64SVille Tervo 	__u8     le_max_pkt;
97063185f64SVille Tervo } __packed;
97163185f64SVille Tervo 
97260e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
97360e77321SJohan Hedberg struct hci_rp_le_read_local_features {
97460e77321SJohan Hedberg 	__u8     status;
97560e77321SJohan Hedberg 	__u8     features[8];
97660e77321SJohan Hedberg } __packed;
97760e77321SJohan Hedberg 
9788fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
9798fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
9808fa19098SJohan Hedberg 	__u8	status;
9818fa19098SJohan Hedberg 	__s8	tx_power;
9828fa19098SJohan Hedberg } __packed;
9838fa19098SJohan Hedberg 
9843f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
9853f0f524bSJohan Hedberg 
9863f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
9873f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
9883f0f524bSJohan Hedberg 	__u8	length;
9893f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
9903f0f524bSJohan Hedberg } __packed;
9913f0f524bSJohan Hedberg 
992c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
993c1d5dc4aSJohan Hedberg 
9945df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
9955df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
9965df480b5SAndre Guedes 
99707f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
99807f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
99907f7fa5dSAndre Guedes 	__u8    type;
100007f7fa5dSAndre Guedes 	__le16  interval;
100107f7fa5dSAndre Guedes 	__le16  window;
100207f7fa5dSAndre Guedes 	__u8    own_address_type;
100307f7fa5dSAndre Guedes 	__u8    filter_policy;
100407f7fa5dSAndre Guedes } __packed;
100507f7fa5dSAndre Guedes 
100676a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
100776a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1008525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1009525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
101068a8aea4SAndrei Emeltchenko 
1011eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1012eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1013eb9d91f5SAndre Guedes 	__u8     enable;
1014eb9d91f5SAndre Guedes 	__u8     filter_dup;
1015eb9d91f5SAndre Guedes } __packed;
1016eb9d91f5SAndre Guedes 
101763185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
101863185f64SVille Tervo struct hci_cp_le_create_conn {
101963185f64SVille Tervo 	__le16   scan_interval;
102063185f64SVille Tervo 	__le16   scan_window;
102163185f64SVille Tervo 	__u8     filter_policy;
102263185f64SVille Tervo 	__u8     peer_addr_type;
102363185f64SVille Tervo 	bdaddr_t peer_addr;
102463185f64SVille Tervo 	__u8     own_address_type;
102563185f64SVille Tervo 	__le16   conn_interval_min;
102663185f64SVille Tervo 	__le16   conn_interval_max;
102763185f64SVille Tervo 	__le16   conn_latency;
102863185f64SVille Tervo 	__le16   supervision_timeout;
102963185f64SVille Tervo 	__le16   min_ce_len;
103063185f64SVille Tervo 	__le16   max_ce_len;
103163185f64SVille Tervo } __packed;
103263185f64SVille Tervo 
103363185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
103463185f64SVille Tervo 
1035cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1036cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1037cf1d081fSJohan Hedberg 	__u8	status;
1038cf1d081fSJohan Hedberg 	__u8	size;
1039cf1d081fSJohan Hedberg } __packed;
1040cf1d081fSJohan Hedberg 
10412ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
10422ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
10432ce603ebSClaudio Takahasi 	__le16   handle;
10442ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
10452ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
10462ce603ebSClaudio Takahasi 	__le16   conn_latency;
10472ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
10482ce603ebSClaudio Takahasi 	__le16   min_ce_len;
10492ce603ebSClaudio Takahasi 	__le16   max_ce_len;
10502ce603ebSClaudio Takahasi } __packed;
10512ce603ebSClaudio Takahasi 
1052a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1053a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1054a7a595f6SVinicius Costa Gomes 	__le16	handle;
1055a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
1056a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1057a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1058a7a595f6SVinicius Costa Gomes } __packed;
1059a7a595f6SVinicius Costa Gomes 
1060a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1061a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1062a7a595f6SVinicius Costa Gomes 	__le16	handle;
1063a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1064a7a595f6SVinicius Costa Gomes } __packed;
1065a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1066a7a595f6SVinicius Costa Gomes 	__u8	status;
1067a7a595f6SVinicius Costa Gomes 	__le16	handle;
1068a7a595f6SVinicius Costa Gomes } __packed;
1069a7a595f6SVinicius Costa Gomes 
1070a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1071a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1072a7a595f6SVinicius Costa Gomes 	__le16	handle;
1073a7a595f6SVinicius Costa Gomes } __packed;
1074a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1075a7a595f6SVinicius Costa Gomes 	__u8	status;
1076a7a595f6SVinicius Costa Gomes 	__le16	handle;
1077a7a595f6SVinicius Costa Gomes } __packed;
1078a7a595f6SVinicius Costa Gomes 
10799b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
10809b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
10819b008c04SJohan Hedberg 	__u8	status;
10829b008c04SJohan Hedberg 	__u8	le_states[8];
10839b008c04SJohan Hedberg } __packed;
10849b008c04SJohan Hedberg 
10851da177e4SLinus Torvalds /* ---- HCI Events ---- */
10861da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
10871da177e4SLinus Torvalds 
10881da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
10891da177e4SLinus Torvalds struct inquiry_info {
10901da177e4SLinus Torvalds 	bdaddr_t bdaddr;
10911da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
10921da177e4SLinus Torvalds 	__u8     pscan_period_mode;
10931da177e4SLinus Torvalds 	__u8     pscan_mode;
10941da177e4SLinus Torvalds 	__u8     dev_class[3];
10951ebb9252SMarcel Holtmann 	__le16   clock_offset;
109666c853ccSGustavo F. Padovan } __packed;
10971da177e4SLinus Torvalds 
10981da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
10991da177e4SLinus Torvalds struct hci_ev_conn_complete {
11001da177e4SLinus Torvalds 	__u8     status;
11011ebb9252SMarcel Holtmann 	__le16   handle;
11021da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11031da177e4SLinus Torvalds 	__u8     link_type;
11041da177e4SLinus Torvalds 	__u8     encr_mode;
110566c853ccSGustavo F. Padovan } __packed;
11061da177e4SLinus Torvalds 
11071da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
11081da177e4SLinus Torvalds struct hci_ev_conn_request {
11091da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11101da177e4SLinus Torvalds 	__u8     dev_class[3];
11111da177e4SLinus Torvalds 	__u8     link_type;
111266c853ccSGustavo F. Padovan } __packed;
11131da177e4SLinus Torvalds 
11141da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
11151da177e4SLinus Torvalds struct hci_ev_disconn_complete {
11161da177e4SLinus Torvalds 	__u8     status;
11171ebb9252SMarcel Holtmann 	__le16   handle;
11181da177e4SLinus Torvalds 	__u8     reason;
111966c853ccSGustavo F. Padovan } __packed;
11201da177e4SLinus Torvalds 
11211da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
11221da177e4SLinus Torvalds struct hci_ev_auth_complete {
11231da177e4SLinus Torvalds 	__u8     status;
11241ebb9252SMarcel Holtmann 	__le16   handle;
112566c853ccSGustavo F. Padovan } __packed;
11261da177e4SLinus Torvalds 
1127a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1128a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1129a9de9248SMarcel Holtmann 	__u8     status;
1130a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
11311f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
113266c853ccSGustavo F. Padovan } __packed;
1133a9de9248SMarcel Holtmann 
11341da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
11351da177e4SLinus Torvalds struct hci_ev_encrypt_change {
11361da177e4SLinus Torvalds 	__u8     status;
11371ebb9252SMarcel Holtmann 	__le16   handle;
11381da177e4SLinus Torvalds 	__u8     encrypt;
113966c853ccSGustavo F. Padovan } __packed;
11401da177e4SLinus Torvalds 
1141a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1142a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
11431da177e4SLinus Torvalds 	__u8     status;
11441ebb9252SMarcel Holtmann 	__le16   handle;
114566c853ccSGustavo F. Padovan } __packed;
11461da177e4SLinus Torvalds 
1147a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1148a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1149a9de9248SMarcel Holtmann 	__u8     status;
1150a9de9248SMarcel Holtmann 	__le16   handle;
1151a9de9248SMarcel Holtmann 	__u8     features[8];
115266c853ccSGustavo F. Padovan } __packed;
1153a9de9248SMarcel Holtmann 
1154a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1155a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1156a9de9248SMarcel Holtmann 	__u8     status;
1157a9de9248SMarcel Holtmann 	__le16   handle;
1158a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1159a9de9248SMarcel Holtmann 	__le16   manufacturer;
1160a9de9248SMarcel Holtmann 	__le16   lmp_subver;
116166c853ccSGustavo F. Padovan } __packed;
1162a9de9248SMarcel Holtmann 
1163a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
11641da177e4SLinus Torvalds struct hci_qos {
11651da177e4SLinus Torvalds 	__u8     service_type;
11661da177e4SLinus Torvalds 	__u32    token_rate;
11671da177e4SLinus Torvalds 	__u32    peak_bandwidth;
11681da177e4SLinus Torvalds 	__u32    latency;
11691da177e4SLinus Torvalds 	__u32    delay_variation;
117066c853ccSGustavo F. Padovan } __packed;
11711da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
11721da177e4SLinus Torvalds 	__u8     status;
11731ebb9252SMarcel Holtmann 	__le16   handle;
11741da177e4SLinus Torvalds 	struct   hci_qos qos;
117566c853ccSGustavo F. Padovan } __packed;
11761da177e4SLinus Torvalds 
1177a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
11781da177e4SLinus Torvalds struct hci_ev_cmd_complete {
11791da177e4SLinus Torvalds 	__u8     ncmd;
11801ebb9252SMarcel Holtmann 	__le16   opcode;
118166c853ccSGustavo F. Padovan } __packed;
11821da177e4SLinus Torvalds 
1183a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
11841da177e4SLinus Torvalds struct hci_ev_cmd_status {
11851da177e4SLinus Torvalds 	__u8     status;
11861da177e4SLinus Torvalds 	__u8     ncmd;
11871ebb9252SMarcel Holtmann 	__le16   opcode;
118866c853ccSGustavo F. Padovan } __packed;
11891da177e4SLinus Torvalds 
11901da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
11911da177e4SLinus Torvalds struct hci_ev_role_change {
11921da177e4SLinus Torvalds 	__u8     status;
11931da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11941da177e4SLinus Torvalds 	__u8     role;
119566c853ccSGustavo F. Padovan } __packed;
11961da177e4SLinus Torvalds 
1197a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1198613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1199613a1c0cSAndrei Emeltchenko 	__le16   handle;
1200613a1c0cSAndrei Emeltchenko 	__le16   count;
1201613a1c0cSAndrei Emeltchenko } __packed;
1202613a1c0cSAndrei Emeltchenko 
1203a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1204a9de9248SMarcel Holtmann 	__u8     num_hndl;
1205613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
120666c853ccSGustavo F. Padovan } __packed;
1207a9de9248SMarcel Holtmann 
12081da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
12091da177e4SLinus Torvalds struct hci_ev_mode_change {
12101da177e4SLinus Torvalds 	__u8     status;
12111ebb9252SMarcel Holtmann 	__le16   handle;
12121da177e4SLinus Torvalds 	__u8     mode;
12131ebb9252SMarcel Holtmann 	__le16   interval;
121466c853ccSGustavo F. Padovan } __packed;
12151da177e4SLinus Torvalds 
12161da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
12171da177e4SLinus Torvalds struct hci_ev_pin_code_req {
12181da177e4SLinus Torvalds 	bdaddr_t bdaddr;
121966c853ccSGustavo F. Padovan } __packed;
12201da177e4SLinus Torvalds 
12211da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
12221da177e4SLinus Torvalds struct hci_ev_link_key_req {
12231da177e4SLinus Torvalds 	bdaddr_t bdaddr;
122466c853ccSGustavo F. Padovan } __packed;
12251da177e4SLinus Torvalds 
12261da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
12271da177e4SLinus Torvalds struct hci_ev_link_key_notify {
12281da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12299b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
12301da177e4SLinus Torvalds 	__u8     key_type;
123166c853ccSGustavo F. Padovan } __packed;
12321da177e4SLinus Torvalds 
1233a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
12341da177e4SLinus Torvalds struct hci_ev_clock_offset {
12351da177e4SLinus Torvalds 	__u8     status;
12361ebb9252SMarcel Holtmann 	__le16   handle;
12371ebb9252SMarcel Holtmann 	__le16   clock_offset;
123866c853ccSGustavo F. Padovan } __packed;
12391da177e4SLinus Torvalds 
1240a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1241a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1242a8746417SMarcel Holtmann 	__u8     status;
1243a8746417SMarcel Holtmann 	__le16   handle;
1244a8746417SMarcel Holtmann 	__le16   pkt_type;
124566c853ccSGustavo F. Padovan } __packed;
1246a8746417SMarcel Holtmann 
124785a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
124885a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
124985a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
125085a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
125166c853ccSGustavo F. Padovan } __packed;
125285a1e930SMarcel Holtmann 
1253a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1254a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1255a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1256a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1257a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1258a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1259a9de9248SMarcel Holtmann 	__le16   clock_offset;
1260a9de9248SMarcel Holtmann 	__s8     rssi;
126166c853ccSGustavo F. Padovan } __packed;
1262a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1263a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1264a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1265a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1266a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1267a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1268a9de9248SMarcel Holtmann 	__le16   clock_offset;
1269a9de9248SMarcel Holtmann 	__s8     rssi;
127066c853ccSGustavo F. Padovan } __packed;
1271a9de9248SMarcel Holtmann 
1272a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1273a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1274a9de9248SMarcel Holtmann 	__u8     status;
1275a9de9248SMarcel Holtmann 	__le16   handle;
1276a9de9248SMarcel Holtmann 	__u8     page;
1277a9de9248SMarcel Holtmann 	__u8     max_page;
1278a9de9248SMarcel Holtmann 	__u8     features[8];
127966c853ccSGustavo F. Padovan } __packed;
1280a9de9248SMarcel Holtmann 
1281a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1282a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1283a9de9248SMarcel Holtmann 	__u8     status;
1284a9de9248SMarcel Holtmann 	__le16   handle;
1285a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1286a9de9248SMarcel Holtmann 	__u8     link_type;
1287a9de9248SMarcel Holtmann 	__u8     tx_interval;
1288a9de9248SMarcel Holtmann 	__u8     retrans_window;
1289a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1290a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1291a9de9248SMarcel Holtmann 	__u8     air_mode;
129266c853ccSGustavo F. Padovan } __packed;
1293a9de9248SMarcel Holtmann 
1294a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1295a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1296a9de9248SMarcel Holtmann 	__u8     status;
1297a9de9248SMarcel Holtmann 	__le16   handle;
1298a9de9248SMarcel Holtmann 	__u8     tx_interval;
1299a9de9248SMarcel Holtmann 	__u8     retrans_window;
1300a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1301a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
130266c853ccSGustavo F. Padovan } __packed;
1303a9de9248SMarcel Holtmann 
1304a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
130504837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
130604837f64SMarcel Holtmann 	__u8     status;
130704837f64SMarcel Holtmann 	__le16   handle;
130804837f64SMarcel Holtmann 	__le16   max_tx_latency;
130904837f64SMarcel Holtmann 	__le16   max_rx_latency;
131004837f64SMarcel Holtmann 	__le16   max_remote_timeout;
131104837f64SMarcel Holtmann 	__le16   max_local_timeout;
131266c853ccSGustavo F. Padovan } __packed;
131304837f64SMarcel Holtmann 
1314a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1315a9de9248SMarcel Holtmann struct extended_inquiry_info {
1316a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1317a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1318a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1319a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1320a9de9248SMarcel Holtmann 	__le16   clock_offset;
1321a9de9248SMarcel Holtmann 	__s8     rssi;
1322a9de9248SMarcel Holtmann 	__u8     data[240];
132366c853ccSGustavo F. Padovan } __packed;
1324a9de9248SMarcel Holtmann 
13251c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
13261c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
13271c2e0041SJohan Hedberg 	__u8	status;
13281c2e0041SJohan Hedberg 	__le16	handle;
13291c2e0041SJohan Hedberg } __packed;
13301c2e0041SJohan Hedberg 
13310493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
13320493684eSMarcel Holtmann struct hci_ev_io_capa_request {
13330493684eSMarcel Holtmann 	bdaddr_t bdaddr;
133466c853ccSGustavo F. Padovan } __packed;
13350493684eSMarcel Holtmann 
133603b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
133703b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
133803b555e1SJohan Hedberg 	bdaddr_t bdaddr;
133903b555e1SJohan Hedberg 	__u8     capability;
134003b555e1SJohan Hedberg 	__u8     oob_data;
134103b555e1SJohan Hedberg 	__u8     authentication;
134203b555e1SJohan Hedberg } __packed;
134303b555e1SJohan Hedberg 
1344a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1345a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1346a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1347a5c29683SJohan Hedberg 	__le32		passkey;
1348a5c29683SJohan Hedberg } __packed;
1349a5c29683SJohan Hedberg 
13509ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
13519ad4019aSBrian Gix struct hci_ev_user_passkey_req {
13529ad4019aSBrian Gix 	bdaddr_t	bdaddr;
13539ad4019aSBrian Gix } __packed;
13549ad4019aSBrian Gix 
13552763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
13562763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
13572763eda6SSzymon Janc 	bdaddr_t bdaddr;
13582763eda6SSzymon Janc } __packed;
13592763eda6SSzymon Janc 
13600493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
13610493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
13620493684eSMarcel Holtmann 	__u8     status;
13630493684eSMarcel Holtmann 	bdaddr_t bdaddr;
136466c853ccSGustavo F. Padovan } __packed;
13650493684eSMarcel Holtmann 
136692a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
136792a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
136892a25256SJohan Hedberg 	bdaddr_t	bdaddr;
136992a25256SJohan Hedberg 	__le32		passkey;
137092a25256SJohan Hedberg } __packed;
137192a25256SJohan Hedberg 
137292a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
137392a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
137492a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
137592a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
137692a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
137792a25256SJohan Hedberg 
137892a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
137992a25256SJohan Hedberg struct hci_ev_keypress_notify {
138092a25256SJohan Hedberg 	bdaddr_t	bdaddr;
138192a25256SJohan Hedberg 	__u8		type;
138292a25256SJohan Hedberg } __packed;
138392a25256SJohan Hedberg 
138441a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
138541a96212SMarcel Holtmann struct hci_ev_remote_host_features {
138641a96212SMarcel Holtmann 	bdaddr_t bdaddr;
138741a96212SMarcel Holtmann 	__u8     features[8];
138866c853ccSGustavo F. Padovan } __packed;
138941a96212SMarcel Holtmann 
139063185f64SVille Tervo #define HCI_EV_LE_META			0x3e
139163185f64SVille Tervo struct hci_ev_le_meta {
139263185f64SVille Tervo 	__u8     subevent;
139363185f64SVille Tervo } __packed;
139463185f64SVille Tervo 
1395523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1396523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1397523e93cdSAndrei Emeltchenko 	__u8     status;
1398523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1399523e93cdSAndrei Emeltchenko } __packed;
1400523e93cdSAndrei Emeltchenko 
1401523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1402523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1403523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1404523e93cdSAndrei Emeltchenko } __packed;
1405523e93cdSAndrei Emeltchenko 
1406523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1407523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1408523e93cdSAndrei Emeltchenko 	__u8     status;
1409523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1410523e93cdSAndrei Emeltchenko 	__u8     reason;
1411523e93cdSAndrei Emeltchenko } __packed;
1412523e93cdSAndrei Emeltchenko 
1413523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1414523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1415523e93cdSAndrei Emeltchenko 	__u8     status;
1416523e93cdSAndrei Emeltchenko 	__le16   handle;
1417523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1418523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1419523e93cdSAndrei Emeltchenko } __packed;
1420523e93cdSAndrei Emeltchenko 
1421523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1422523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1423523e93cdSAndrei Emeltchenko 	__u8     status;
1424523e93cdSAndrei Emeltchenko 	__le16   handle;
1425523e93cdSAndrei Emeltchenko 	__u8     reason;
1426523e93cdSAndrei Emeltchenko } __packed;
1427523e93cdSAndrei Emeltchenko 
142825e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
142925e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
143025e89e99SAndrei Emeltchenko 	__le16   handle;
143125e89e99SAndrei Emeltchenko 	__le16   pkts;
143225e89e99SAndrei Emeltchenko 	__le16   blocks;
143325e89e99SAndrei Emeltchenko } __packed;
143425e89e99SAndrei Emeltchenko 
143525e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
143625e89e99SAndrei Emeltchenko 	__le16   num_blocks;
143725e89e99SAndrei Emeltchenko 	__u8     num_hndl;
143825e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
143925e89e99SAndrei Emeltchenko } __packed;
144025e89e99SAndrei Emeltchenko 
144163185f64SVille Tervo /* Low energy meta events */
1442b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1443b9b343d2SAndre Guedes 
144463185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
144563185f64SVille Tervo struct hci_ev_le_conn_complete {
144663185f64SVille Tervo 	__u8     status;
144763185f64SVille Tervo 	__le16   handle;
144863185f64SVille Tervo 	__u8     role;
144963185f64SVille Tervo 	__u8     bdaddr_type;
145063185f64SVille Tervo 	bdaddr_t bdaddr;
145163185f64SVille Tervo 	__le16   interval;
145263185f64SVille Tervo 	__le16   latency;
145363185f64SVille Tervo 	__le16   supervision_timeout;
145463185f64SVille Tervo 	__u8     clk_accurancy;
145563185f64SVille Tervo } __packed;
145663185f64SVille Tervo 
1457a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1458a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1459a7a595f6SVinicius Costa Gomes 	__le16	handle;
1460a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1461a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1462a7a595f6SVinicius Costa Gomes } __packed;
1463a7a595f6SVinicius Costa Gomes 
146457a56fd4SAnderson Briglia /* Advertising report event types */
146557a56fd4SAnderson Briglia #define ADV_IND		0x00
146657a56fd4SAnderson Briglia #define ADV_DIRECT_IND	0x01
146757a56fd4SAnderson Briglia #define ADV_SCAN_IND	0x02
146857a56fd4SAnderson Briglia #define ADV_NONCONN_IND	0x03
146957a56fd4SAnderson Briglia #define ADV_SCAN_RSP	0x04
147057a56fd4SAnderson Briglia 
147157a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
147257a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
147357a56fd4SAnderson Briglia 
147457a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
147557a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
147657a56fd4SAnderson Briglia 	__u8	 evt_type;
147757a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
147857a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
147957a56fd4SAnderson Briglia 	__u8	 length;
148057a56fd4SAnderson Briglia 	__u8	 data[0];
148157a56fd4SAnderson Briglia } __packed;
148257a56fd4SAnderson Briglia 
14831da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1484a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
14851da177e4SLinus Torvalds struct hci_ev_stack_internal {
14861da177e4SLinus Torvalds 	__u16    type;
14871da177e4SLinus Torvalds 	__u8     data[0];
148866c853ccSGustavo F. Padovan } __packed;
14891da177e4SLinus Torvalds 
14901da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
14911da177e4SLinus Torvalds struct hci_ev_si_device {
14921da177e4SLinus Torvalds 	__u16    event;
14931da177e4SLinus Torvalds 	__u16    dev_id;
149466c853ccSGustavo F. Padovan } __packed;
14951da177e4SLinus Torvalds 
14961da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
14971da177e4SLinus Torvalds struct hci_ev_si_security {
14981da177e4SLinus Torvalds 	__u16    event;
14991da177e4SLinus Torvalds 	__u16    proto;
15001da177e4SLinus Torvalds 	__u16    subproto;
15011da177e4SLinus Torvalds 	__u8     incoming;
150266c853ccSGustavo F. Padovan } __packed;
15031da177e4SLinus Torvalds 
15041da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
15051da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
15061da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
15071da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
15081da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
15091da177e4SLinus Torvalds 
15101da177e4SLinus Torvalds struct hci_command_hdr {
15111ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
15121da177e4SLinus Torvalds 	__u8	plen;
151366c853ccSGustavo F. Padovan } __packed;
15141da177e4SLinus Torvalds 
15151da177e4SLinus Torvalds struct hci_event_hdr {
15161da177e4SLinus Torvalds 	__u8	evt;
15171da177e4SLinus Torvalds 	__u8	plen;
151866c853ccSGustavo F. Padovan } __packed;
15191da177e4SLinus Torvalds 
15201da177e4SLinus Torvalds struct hci_acl_hdr {
15211ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
15221ebb9252SMarcel Holtmann 	__le16	dlen;
152366c853ccSGustavo F. Padovan } __packed;
15241da177e4SLinus Torvalds 
15251da177e4SLinus Torvalds struct hci_sco_hdr {
15261ebb9252SMarcel Holtmann 	__le16	handle;
15271da177e4SLinus Torvalds 	__u8	dlen;
152866c853ccSGustavo F. Padovan } __packed;
15291da177e4SLinus Torvalds 
15302a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
15312a123b86SArnaldo Carvalho de Melo {
15322a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
15332a123b86SArnaldo Carvalho de Melo }
15342a123b86SArnaldo Carvalho de Melo 
15352a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
15362a123b86SArnaldo Carvalho de Melo {
15372a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
15382a123b86SArnaldo Carvalho de Melo }
15392a123b86SArnaldo Carvalho de Melo 
15402a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
15412a123b86SArnaldo Carvalho de Melo {
15422a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
15432a123b86SArnaldo Carvalho de Melo }
15442a123b86SArnaldo Carvalho de Melo 
15451da177e4SLinus Torvalds /* Command opcode pack/unpack */
1546c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
15471da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
15481da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
15491da177e4SLinus Torvalds 
15501da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1551c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
15521da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
15531da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
15541da177e4SLinus Torvalds 
15551da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
15561da177e4SLinus Torvalds 
15571da177e4SLinus Torvalds /* Socket options */
15581da177e4SLinus Torvalds #define HCI_DATA_DIR	1
15591da177e4SLinus Torvalds #define HCI_FILTER	2
15601da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
15611da177e4SLinus Torvalds 
15621da177e4SLinus Torvalds /* CMSG flags */
15631da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
15641da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
15651da177e4SLinus Torvalds 
15661da177e4SLinus Torvalds struct sockaddr_hci {
15671da177e4SLinus Torvalds 	sa_family_t    hci_family;
15681da177e4SLinus Torvalds 	unsigned short hci_dev;
1569c02178d2SJohan Hedberg 	unsigned short hci_channel;
15701da177e4SLinus Torvalds };
15711da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
15721da177e4SLinus Torvalds 
1573c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1574*23500189SMarcel Holtmann #define HCI_CHANNEL_USER	1
1575cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
157666f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1577c02178d2SJohan Hedberg 
15781da177e4SLinus Torvalds struct hci_filter {
15791da177e4SLinus Torvalds 	unsigned long type_mask;
15801da177e4SLinus Torvalds 	unsigned long event_mask[2];
1581905f3ed6SAl Viro 	__le16 opcode;
15821da177e4SLinus Torvalds };
15831da177e4SLinus Torvalds 
15841da177e4SLinus Torvalds struct hci_ufilter {
15851da177e4SLinus Torvalds 	__u32  type_mask;
15861da177e4SLinus Torvalds 	__u32  event_mask[2];
1587905f3ed6SAl Viro 	__le16 opcode;
15881da177e4SLinus Torvalds };
15891da177e4SLinus Torvalds 
15901da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
15911da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
15921da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
15931da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
15941da177e4SLinus Torvalds 
15951da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
15961da177e4SLinus Torvalds struct hci_dev_stats {
15971da177e4SLinus Torvalds 	__u32 err_rx;
15981da177e4SLinus Torvalds 	__u32 err_tx;
15991da177e4SLinus Torvalds 	__u32 cmd_tx;
16001da177e4SLinus Torvalds 	__u32 evt_rx;
16011da177e4SLinus Torvalds 	__u32 acl_tx;
16021da177e4SLinus Torvalds 	__u32 acl_rx;
16031da177e4SLinus Torvalds 	__u32 sco_tx;
16041da177e4SLinus Torvalds 	__u32 sco_rx;
16051da177e4SLinus Torvalds 	__u32 byte_rx;
16061da177e4SLinus Torvalds 	__u32 byte_tx;
16071da177e4SLinus Torvalds };
16081da177e4SLinus Torvalds 
16091da177e4SLinus Torvalds struct hci_dev_info {
16101da177e4SLinus Torvalds 	__u16 dev_id;
16111da177e4SLinus Torvalds 	char  name[8];
16121da177e4SLinus Torvalds 
16131da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16141da177e4SLinus Torvalds 
16151da177e4SLinus Torvalds 	__u32 flags;
16161da177e4SLinus Torvalds 	__u8  type;
16171da177e4SLinus Torvalds 
16181da177e4SLinus Torvalds 	__u8  features[8];
16191da177e4SLinus Torvalds 
16201da177e4SLinus Torvalds 	__u32 pkt_type;
16211da177e4SLinus Torvalds 	__u32 link_policy;
16221da177e4SLinus Torvalds 	__u32 link_mode;
16231da177e4SLinus Torvalds 
16241da177e4SLinus Torvalds 	__u16 acl_mtu;
16251da177e4SLinus Torvalds 	__u16 acl_pkts;
16261da177e4SLinus Torvalds 	__u16 sco_mtu;
16271da177e4SLinus Torvalds 	__u16 sco_pkts;
16281da177e4SLinus Torvalds 
16291da177e4SLinus Torvalds 	struct hci_dev_stats stat;
16301da177e4SLinus Torvalds };
16311da177e4SLinus Torvalds 
16321da177e4SLinus Torvalds struct hci_conn_info {
16331da177e4SLinus Torvalds 	__u16    handle;
16341da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16351da177e4SLinus Torvalds 	__u8     type;
16361da177e4SLinus Torvalds 	__u8     out;
16371da177e4SLinus Torvalds 	__u16    state;
16381da177e4SLinus Torvalds 	__u32    link_mode;
16391da177e4SLinus Torvalds };
16401da177e4SLinus Torvalds 
16411da177e4SLinus Torvalds struct hci_dev_req {
16421da177e4SLinus Torvalds 	__u16  dev_id;
16431da177e4SLinus Torvalds 	__u32  dev_opt;
16441da177e4SLinus Torvalds };
16451da177e4SLinus Torvalds 
16461da177e4SLinus Torvalds struct hci_dev_list_req {
16471da177e4SLinus Torvalds 	__u16  dev_num;
16481da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
16491da177e4SLinus Torvalds };
16501da177e4SLinus Torvalds 
16511da177e4SLinus Torvalds struct hci_conn_list_req {
16521da177e4SLinus Torvalds 	__u16  dev_id;
16531da177e4SLinus Torvalds 	__u16  conn_num;
16541da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
16551da177e4SLinus Torvalds };
16561da177e4SLinus Torvalds 
16571da177e4SLinus Torvalds struct hci_conn_info_req {
16581da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16591da177e4SLinus Torvalds 	__u8     type;
16601da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
16611da177e4SLinus Torvalds };
16621da177e4SLinus Torvalds 
166340be492fSMarcel Holtmann struct hci_auth_info_req {
166440be492fSMarcel Holtmann 	bdaddr_t bdaddr;
166540be492fSMarcel Holtmann 	__u8     type;
166640be492fSMarcel Holtmann };
166740be492fSMarcel Holtmann 
16681da177e4SLinus Torvalds struct hci_inquiry_req {
16691da177e4SLinus Torvalds 	__u16 dev_id;
16701da177e4SLinus Torvalds 	__u16 flags;
16711da177e4SLinus Torvalds 	__u8  lap[3];
16721da177e4SLinus Torvalds 	__u8  length;
16731da177e4SLinus Torvalds 	__u8  num_rsp;
16741da177e4SLinus Torvalds };
16751da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
16761da177e4SLinus Torvalds 
16778b281b9cSFabio Estevam extern bool enable_hs;
16788830f514SAndrei Emeltchenko 
16791da177e4SLinus Torvalds #endif /* __HCI_H */
1680