xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 92a25256f142d55e25f9959441cea6ddeabae57e)
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 
361da177e4SLinus Torvalds /* HCI dev events */
371da177e4SLinus Torvalds #define HCI_DEV_REG			1
381da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
391da177e4SLinus Torvalds #define HCI_DEV_UP			3
401da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
411da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
421da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds /* HCI notify events */
451da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
461da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
471da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
481da177e4SLinus Torvalds 
49c13854ceSMarcel Holtmann /* HCI bus types */
500ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
511da177e4SLinus Torvalds #define HCI_USB		1
521da177e4SLinus Torvalds #define HCI_PCCARD	2
531da177e4SLinus Torvalds #define HCI_UART	3
541da177e4SLinus Torvalds #define HCI_RS232	4
551da177e4SLinus Torvalds #define HCI_PCI		5
560ac53939SMarcel Holtmann #define HCI_SDIO	6
571da177e4SLinus Torvalds 
58943da25dSMarcel Holtmann /* HCI controller types */
59943da25dSMarcel Holtmann #define HCI_BREDR	0x00
608f1e1742SDavid Vrabel #define HCI_AMP		0x01
61943da25dSMarcel Holtmann 
628598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
638598d064SAndrei Emeltchenko #define HCI_BREDR_ID	0
648598d064SAndrei Emeltchenko 
65ab846ec4SAndrei Emeltchenko /* AMP controller status */
66ab846ec4SAndrei Emeltchenko #define AMP_CTRL_POWERED_DOWN			0x00
67ab846ec4SAndrei Emeltchenko #define AMP_CTRL_BLUETOOTH_ONLY			0x01
68ab846ec4SAndrei Emeltchenko #define AMP_CTRL_NO_CAPACITY			0x02
69ab846ec4SAndrei Emeltchenko #define AMP_CTRL_LOW_CAPACITY			0x03
70ab846ec4SAndrei Emeltchenko #define AMP_CTRL_MEDIUM_CAPACITY		0x04
71ab846ec4SAndrei Emeltchenko #define AMP_CTRL_HIGH_CAPACITY			0x05
72ab846ec4SAndrei Emeltchenko #define AMP_CTRL_FULL_CAPACITY			0x06
73ab846ec4SAndrei Emeltchenko 
741da177e4SLinus Torvalds /* HCI device quirks */
751da177e4SLinus Torvalds enum {
76a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
77da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
78da1f5198SMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE
791da177e4SLinus Torvalds };
801da177e4SLinus Torvalds 
811da177e4SLinus Torvalds /* HCI device flags */
821da177e4SLinus Torvalds enum {
831da177e4SLinus Torvalds 	HCI_UP,
841da177e4SLinus Torvalds 	HCI_INIT,
851da177e4SLinus Torvalds 	HCI_RUNNING,
861da177e4SLinus Torvalds 
871da177e4SLinus Torvalds 	HCI_PSCAN,
881da177e4SLinus Torvalds 	HCI_ISCAN,
891da177e4SLinus Torvalds 	HCI_AUTH,
901da177e4SLinus Torvalds 	HCI_ENCRYPT,
911da177e4SLinus Torvalds 	HCI_INQUIRY,
921da177e4SLinus Torvalds 
931da177e4SLinus Torvalds 	HCI_RAW,
94ab81cbf9SJohan Hedberg 
9510572132SGustavo F. Padovan 	HCI_RESET,
961da177e4SLinus Torvalds };
971da177e4SLinus Torvalds 
98d23264a8SAndre Guedes /*
99d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
100d23264a8SAndre Guedes  * states from the controller.
101d23264a8SAndre Guedes  */
102d23264a8SAndre Guedes enum {
103a8b2d5c2SJohan Hedberg 	HCI_SETUP,
104a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
105a8b2d5c2SJohan Hedberg 	HCI_MGMT,
106a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
107a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
108a8b2d5c2SJohan Hedberg 	HCI_LINK_KEYS,
109a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
11094324962SJohan Hovold 	HCI_UNREGISTER,
111a8b2d5c2SJohan Hedberg 
112d23264a8SAndre Guedes 	HCI_LE_SCAN,
11384bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
1146d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
11506199cf8SJohan Hedberg 	HCI_LE_ENABLED,
1165e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1175e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
11847990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
119c95f0ba7SJohan Hedberg 	HCI_PENDING_CLASS,
12021693c15SAndre Guedes 	HCI_PERIODIC_INQ,
121d23264a8SAndre Guedes };
122d23264a8SAndre Guedes 
1231da177e4SLinus Torvalds /* HCI ioctl defines */
1241da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1251da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1261da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1271da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1281da177e4SLinus Torvalds 
1291da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1301da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1311da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1321da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
13340be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1341da177e4SLinus Torvalds 
1351da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1361da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1371da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1381da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1391da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1401da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1411da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1421da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1431da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1441da177e4SLinus Torvalds 
145f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
146f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
147f0358568SJohan Hedberg 
1481da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1491da177e4SLinus Torvalds 
1501da177e4SLinus Torvalds /* HCI timeouts */
1515f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1525f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1535f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
1549345d40cSAndrei Emeltchenko #define HCI_CMD_TIMEOUT		msecs_to_jiffies(1000)	/* 1 second */
1555f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1569345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1571da177e4SLinus Torvalds 
1585b7f9909SMarcel Holtmann /* HCI data types */
1591da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1601da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1611da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1621da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1631da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1641da177e4SLinus Torvalds 
1655b7f9909SMarcel Holtmann /* HCI packet types */
1661da177e4SLinus Torvalds #define HCI_DM1		0x0008
1671da177e4SLinus Torvalds #define HCI_DM3		0x0400
1681da177e4SLinus Torvalds #define HCI_DM5		0x4000
1691da177e4SLinus Torvalds #define HCI_DH1		0x0010
1701da177e4SLinus Torvalds #define HCI_DH3		0x0800
1711da177e4SLinus Torvalds #define HCI_DH5		0x8000
1721da177e4SLinus Torvalds 
1731da177e4SLinus Torvalds #define HCI_HV1		0x0020
1741da177e4SLinus Torvalds #define HCI_HV2		0x0040
1751da177e4SLinus Torvalds #define HCI_HV3		0x0080
1761da177e4SLinus Torvalds 
1771da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1781da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1791da177e4SLinus Torvalds 
1805b7f9909SMarcel Holtmann /* eSCO packet types */
1815b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1825b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1835b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1845b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1855b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1865b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
187efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
188efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
189efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
190efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
1915b7f9909SMarcel Holtmann 
192a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
193efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
194a8746417SMarcel Holtmann 
1951da177e4SLinus Torvalds /* ACL flags */
196e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
1971da177e4SLinus Torvalds #define ACL_CONT		0x01
1981da177e4SLinus Torvalds #define ACL_START		0x02
1991da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2001da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2011da177e4SLinus Torvalds 
2021da177e4SLinus Torvalds /* Baseband links */
2031da177e4SLinus Torvalds #define SCO_LINK	0x00
2041da177e4SLinus Torvalds #define ACL_LINK	0x01
2055b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
206fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
207fcd89c09SVille Tervo #define LE_LINK		0x80
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds /* LMP features */
2101da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2111da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2121da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2131da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2141da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2151da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2161da177e4SLinus Torvalds #define LMP_HOLD	0x40
21704837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2181da177e4SLinus Torvalds 
2191da177e4SLinus Torvalds #define LMP_PARK	0x01
2201da177e4SLinus Torvalds #define LMP_RSSI	0x02
2211da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2221da177e4SLinus Torvalds #define LMP_SCO		0x08
2231da177e4SLinus Torvalds #define LMP_HV2		0x10
2241da177e4SLinus Torvalds #define LMP_HV3		0x20
2251da177e4SLinus Torvalds #define LMP_ULAW	0x40
2261da177e4SLinus Torvalds #define LMP_ALAW	0x80
2271da177e4SLinus Torvalds 
2281da177e4SLinus Torvalds #define LMP_CVSD	0x01
2291da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2301da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
2311da177e4SLinus Torvalds 
232d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2335b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2345b7f9909SMarcel Holtmann 
2355b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2365b7f9909SMarcel Holtmann #define LMP_EV5		0x02
23769ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
238d5859e22SJohan Hedberg #define LMP_LE		0x40
2395b7f9909SMarcel Holtmann 
24004837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
241d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
242efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
243efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
244efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
24504837f64SMarcel Holtmann 
246d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
247e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
248769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
249e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
250769be974SMarcel Holtmann 
251d5859e22SJohan Hedberg #define LMP_LSTO	0x01
252d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
253971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
254d5859e22SJohan Hedberg 
255eead27daSAndre Guedes /* Extended LMP features */
256cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
257eead27daSAndre Guedes #define LMP_HOST_LE		0x02
258cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
259eead27daSAndre Guedes 
26004837f64SMarcel Holtmann /* Connection modes */
26104837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
26204837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
26304837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
26404837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
26504837f64SMarcel Holtmann 
2661da177e4SLinus Torvalds /* Link policies */
2671da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2681da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2691da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2701da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2711da177e4SLinus Torvalds 
27204837f64SMarcel Holtmann /* Link modes */
2731da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2741da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2751da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2761da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2771da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2781da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2791da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2801da177e4SLinus Torvalds 
28140be492fSMarcel Holtmann /* Authentication types */
28240be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
28340be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
28440be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
28540be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
28640be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
28740be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
28840be492fSMarcel Holtmann 
289b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
290b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
291b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
292b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
293b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
294b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
295b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
296b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
297b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
298b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
299b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
300b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
301b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
302b6020ba0SWaldemar Rymarkiewicz 
3039f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3049f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
305cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3069f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3079f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
308cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
309cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3109f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3119f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3129f5a0d7bSAndrei Emeltchenko 
3132455a3eaSAndrei Emeltchenko /* Flow control modes */
3142455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3152455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3162455a3eaSAndrei Emeltchenko 
31732748db0SJohan Hedberg /* Extended Inquiry Response field types */
31832748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
31932748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
32032748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
32132748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
32232748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
32332748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
32432748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
32532748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
32632748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
32732748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3289ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3299ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3309ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
33132748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
33232748db0SJohan Hedberg 
3331da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3346bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3356bd32326SVille Tervo 
336a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
337a9de9248SMarcel Holtmann struct hci_cp_inquiry {
338a9de9248SMarcel Holtmann 	__u8     lap[3];
339a9de9248SMarcel Holtmann 	__u8     length;
340a9de9248SMarcel Holtmann 	__u8     num_rsp;
34166c853ccSGustavo F. Padovan } __packed;
3421da177e4SLinus Torvalds 
343a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
344a9de9248SMarcel Holtmann 
34579d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
34679d6e068SAndre Guedes 
347a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
348a9de9248SMarcel Holtmann 
349a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
350a9de9248SMarcel Holtmann struct hci_cp_create_conn {
351a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
352a9de9248SMarcel Holtmann 	__le16   pkt_type;
353a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
354a9de9248SMarcel Holtmann 	__u8     pscan_mode;
355a9de9248SMarcel Holtmann 	__le16   clock_offset;
356a9de9248SMarcel Holtmann 	__u8     role_switch;
35766c853ccSGustavo F. Padovan } __packed;
3581da177e4SLinus Torvalds 
359a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
360a9de9248SMarcel Holtmann struct hci_cp_disconnect {
361a9de9248SMarcel Holtmann 	__le16   handle;
362a9de9248SMarcel Holtmann 	__u8     reason;
36366c853ccSGustavo F. Padovan } __packed;
3641da177e4SLinus Torvalds 
365a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
366a9de9248SMarcel Holtmann struct hci_cp_add_sco {
367a9de9248SMarcel Holtmann 	__le16   handle;
368a9de9248SMarcel Holtmann 	__le16   pkt_type;
36966c853ccSGustavo F. Padovan } __packed;
370a9de9248SMarcel Holtmann 
371a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
372a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
3731da177e4SLinus Torvalds 	bdaddr_t bdaddr;
37466c853ccSGustavo F. Padovan } __packed;
3751da177e4SLinus Torvalds 
376a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
377a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
378a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
379a9de9248SMarcel Holtmann 	__u8     role;
38066c853ccSGustavo F. Padovan } __packed;
3811da177e4SLinus Torvalds 
382a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
383a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
384a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
385a9de9248SMarcel Holtmann 	__u8     reason;
38666c853ccSGustavo F. Padovan } __packed;
3871da177e4SLinus Torvalds 
388a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
389a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
390a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
3919b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
39266c853ccSGustavo F. Padovan } __packed;
3931da177e4SLinus Torvalds 
394a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
395a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
396a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
39766c853ccSGustavo F. Padovan } __packed;
3981da177e4SLinus Torvalds 
399a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
400a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
401a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
402a9de9248SMarcel Holtmann 	__u8     pin_len;
403a9de9248SMarcel Holtmann 	__u8     pin_code[16];
40466c853ccSGustavo F. Padovan } __packed;
405980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
406980e1a53SJohan Hedberg 	__u8     status;
407980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
408980e1a53SJohan Hedberg } __packed;
409a9de9248SMarcel Holtmann 
410a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
411a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
412a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
41366c853ccSGustavo F. Padovan } __packed;
414980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
415980e1a53SJohan Hedberg 	__u8     status;
416980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
417980e1a53SJohan Hedberg } __packed;
418a9de9248SMarcel Holtmann 
419a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
420a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
421a9de9248SMarcel Holtmann 	__le16   handle;
422a9de9248SMarcel Holtmann 	__le16   pkt_type;
42366c853ccSGustavo F. Padovan } __packed;
424a9de9248SMarcel Holtmann 
425a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
426a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
427a9de9248SMarcel Holtmann 	__le16   handle;
42866c853ccSGustavo F. Padovan } __packed;
429a9de9248SMarcel Holtmann 
430a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
431a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
432a9de9248SMarcel Holtmann 	__le16   handle;
433a9de9248SMarcel Holtmann 	__u8     encrypt;
43466c853ccSGustavo F. Padovan } __packed;
435a9de9248SMarcel Holtmann 
436a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
437a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
438a9de9248SMarcel Holtmann 	__le16   handle;
43966c853ccSGustavo F. Padovan } __packed;
440a9de9248SMarcel Holtmann 
441a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
442a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
443a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
444a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
445a9de9248SMarcel Holtmann 	__u8     pscan_mode;
446a9de9248SMarcel Holtmann 	__le16   clock_offset;
44766c853ccSGustavo F. Padovan } __packed;
448a9de9248SMarcel Holtmann 
449a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
450a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
451a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
45266c853ccSGustavo F. Padovan } __packed;
453a9de9248SMarcel Holtmann 
454a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
455a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
456a9de9248SMarcel Holtmann 	__le16   handle;
45766c853ccSGustavo F. Padovan } __packed;
458a9de9248SMarcel Holtmann 
459a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
460a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
461a9de9248SMarcel Holtmann 	__le16   handle;
462a9de9248SMarcel Holtmann 	__u8     page;
46366c853ccSGustavo F. Padovan } __packed;
464a9de9248SMarcel Holtmann 
465a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
466a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
467a9de9248SMarcel Holtmann 	__le16   handle;
46866c853ccSGustavo F. Padovan } __packed;
469a9de9248SMarcel Holtmann 
470a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
471a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
472a9de9248SMarcel Holtmann 	__le16   handle;
473a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
474a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
475a9de9248SMarcel Holtmann 	__le16   max_latency;
476a9de9248SMarcel Holtmann 	__le16   voice_setting;
477a9de9248SMarcel Holtmann 	__u8     retrans_effort;
478a9de9248SMarcel Holtmann 	__le16   pkt_type;
47966c853ccSGustavo F. Padovan } __packed;
480a9de9248SMarcel Holtmann 
481a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
482a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
483a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
484a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
485a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
486a9de9248SMarcel Holtmann 	__le16   max_latency;
487a9de9248SMarcel Holtmann 	__le16   content_format;
488a9de9248SMarcel Holtmann 	__u8     retrans_effort;
489a9de9248SMarcel Holtmann 	__le16   pkt_type;
49066c853ccSGustavo F. Padovan } __packed;
491a9de9248SMarcel Holtmann 
492a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
493a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
494a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
495a9de9248SMarcel Holtmann 	__u8     reason;
49666c853ccSGustavo F. Padovan } __packed;
497a9de9248SMarcel Holtmann 
49817fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
49917fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
50017fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
50117fa4b9dSJohan Hedberg 	__u8     capability;
50217fa4b9dSJohan Hedberg 	__u8     oob_data;
50317fa4b9dSJohan Hedberg 	__u8     authentication;
50417fa4b9dSJohan Hedberg } __packed;
50517fa4b9dSJohan Hedberg 
506a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
507a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
508a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
509a5c29683SJohan Hedberg } __packed;
510a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
511a5c29683SJohan Hedberg 	__u8     status;
512a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
513a5c29683SJohan Hedberg } __packed;
514a5c29683SJohan Hedberg 
515a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
516a5c29683SJohan Hedberg 
5179ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5189ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5199ad4019aSBrian Gix 	bdaddr_t bdaddr;
5209ad4019aSBrian Gix 	__le32	passkey;
5219ad4019aSBrian Gix } __packed;
5229ad4019aSBrian Gix 
5239ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5249ad4019aSBrian Gix 
5252763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5262763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5272763eda6SSzymon Janc 	bdaddr_t bdaddr;
5282763eda6SSzymon Janc 	__u8     hash[16];
5292763eda6SSzymon Janc 	__u8     randomizer[16];
5302763eda6SSzymon Janc } __packed;
5312763eda6SSzymon Janc 
5322763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5332763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5342763eda6SSzymon Janc 	bdaddr_t bdaddr;
5352763eda6SSzymon Janc } __packed;
5362763eda6SSzymon Janc 
53703b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
53803b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
53903b555e1SJohan Hedberg 	bdaddr_t bdaddr;
54003b555e1SJohan Hedberg 	__u8     reason;
54103b555e1SJohan Hedberg } __packed;
54203b555e1SJohan Hedberg 
543523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
544523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
545523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
546523e93cdSAndrei Emeltchenko 	__u8     key_len;
547523e93cdSAndrei Emeltchenko 	__u8     key_type;
548523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
549523e93cdSAndrei Emeltchenko } __packed;
550523e93cdSAndrei Emeltchenko 
551523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
552523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
553523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
554523e93cdSAndrei Emeltchenko 	__u8     key_len;
555523e93cdSAndrei Emeltchenko 	__u8     key_type;
556523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
557523e93cdSAndrei Emeltchenko } __packed;
558523e93cdSAndrei Emeltchenko 
559523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK	0x0437
560523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
561523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
562523e93cdSAndrei Emeltchenko 	__u8     reason;
563523e93cdSAndrei Emeltchenko } __packed;
564523e93cdSAndrei Emeltchenko 
565a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
566a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
567a9de9248SMarcel Holtmann 	__le16   handle;
568a9de9248SMarcel Holtmann 	__le16   max_interval;
569a9de9248SMarcel Holtmann 	__le16   min_interval;
570a9de9248SMarcel Holtmann 	__le16   attempt;
571a9de9248SMarcel Holtmann 	__le16   timeout;
57266c853ccSGustavo F. Padovan } __packed;
573a9de9248SMarcel Holtmann 
574a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
575a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
576a9de9248SMarcel Holtmann 	__le16   handle;
57766c853ccSGustavo F. Padovan } __packed;
578a9de9248SMarcel Holtmann 
579a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
580a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
581a9de9248SMarcel Holtmann 	__le16   handle;
58266c853ccSGustavo F. Padovan } __packed;
583a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
584a9de9248SMarcel Holtmann 	__u8     status;
585a9de9248SMarcel Holtmann 	__le16   handle;
586a9de9248SMarcel Holtmann 	__u8     role;
58766c853ccSGustavo F. Padovan } __packed;
588a9de9248SMarcel Holtmann 
589a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
590a9de9248SMarcel Holtmann struct hci_cp_switch_role {
591a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
592a9de9248SMarcel Holtmann 	__u8     role;
59366c853ccSGustavo F. Padovan } __packed;
594a9de9248SMarcel Holtmann 
595a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
596a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
597a9de9248SMarcel Holtmann 	__le16   handle;
59866c853ccSGustavo F. Padovan } __packed;
599a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
600a9de9248SMarcel Holtmann 	__u8     status;
601a9de9248SMarcel Holtmann 	__le16   handle;
602a9de9248SMarcel Holtmann 	__le16   policy;
60366c853ccSGustavo F. Padovan } __packed;
604a9de9248SMarcel Holtmann 
605a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
606a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
607a9de9248SMarcel Holtmann 	__le16   handle;
608a9de9248SMarcel Holtmann 	__le16   policy;
60966c853ccSGustavo F. Padovan } __packed;
610a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
611a9de9248SMarcel Holtmann 	__u8     status;
612a9de9248SMarcel Holtmann 	__le16   handle;
61366c853ccSGustavo F. Padovan } __packed;
614a9de9248SMarcel Holtmann 
615e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
616e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
617e4e8e37cSMarcel Holtmann 	__u8     status;
618e4e8e37cSMarcel Holtmann 	__le16   policy;
61966c853ccSGustavo F. Padovan } __packed;
620e4e8e37cSMarcel Holtmann 
621e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
622e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
623e4e8e37cSMarcel Holtmann 	__le16   policy;
62466c853ccSGustavo F. Padovan } __packed;
625e4e8e37cSMarcel Holtmann 
626a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
627a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
628a9de9248SMarcel Holtmann 	__le16   handle;
629a9de9248SMarcel Holtmann 	__le16   max_latency;
630a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
631a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
63266c853ccSGustavo F. Padovan } __packed;
633a9de9248SMarcel Holtmann 
634a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
635a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
636a9de9248SMarcel Holtmann 	__u8     mask[8];
63766c853ccSGustavo F. Padovan } __packed;
638a9de9248SMarcel Holtmann 
639a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
640a9de9248SMarcel Holtmann 
641a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
6421da177e4SLinus Torvalds struct hci_cp_set_event_flt {
6431da177e4SLinus Torvalds 	__u8     flt_type;
6441da177e4SLinus Torvalds 	__u8     cond_type;
6451da177e4SLinus Torvalds 	__u8     condition[0];
64666c853ccSGustavo F. Padovan } __packed;
6471da177e4SLinus Torvalds 
6481da177e4SLinus Torvalds /* Filter types */
6491da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
6501da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
6511da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
6521da177e4SLinus Torvalds 
6531da177e4SLinus Torvalds /* CONN_SETUP Condition types */
6541da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
6551da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
6561da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
6571da177e4SLinus Torvalds 
6581da177e4SLinus Torvalds /* CONN_SETUP Conditions */
6591da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
6601da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
6611da177e4SLinus Torvalds 
662b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
663b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
664b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
665b0916ea0SJohan Hedberg 	__u8     delete_all;
666b0916ea0SJohan Hedberg } __packed;
667b0916ea0SJohan Hedberg 
6681f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
6691f6c6378SJohan Hedberg 
670a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
671a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
6721f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
67366c853ccSGustavo F. Padovan } __packed;
674a9de9248SMarcel Holtmann 
675a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
676a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
677a9de9248SMarcel Holtmann 	__u8     status;
6781f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
67966c853ccSGustavo F. Padovan } __packed;
680a9de9248SMarcel Holtmann 
681a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
682a9de9248SMarcel Holtmann 
683a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
684a9de9248SMarcel Holtmann 
685a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
686a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
687a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
688a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
689a9de9248SMarcel Holtmann 
690a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
691a9de9248SMarcel Holtmann 
692a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
693a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
694a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
695a9de9248SMarcel Holtmann 
696a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
697a9de9248SMarcel Holtmann 
698a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
699a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
700a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
701a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
702a9de9248SMarcel Holtmann 
703a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
704a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
7051da177e4SLinus Torvalds 	__u8     status;
7061da177e4SLinus Torvalds 	__u8     dev_class[3];
70766c853ccSGustavo F. Padovan } __packed;
7081da177e4SLinus Torvalds 
709a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
710a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
7111da177e4SLinus Torvalds 	__u8     dev_class[3];
71266c853ccSGustavo F. Padovan } __packed;
7131da177e4SLinus Torvalds 
714a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
7151da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
7161da177e4SLinus Torvalds 	__u8     status;
7171ebb9252SMarcel Holtmann 	__le16   voice_setting;
71866c853ccSGustavo F. Padovan } __packed;
7191da177e4SLinus Torvalds 
720a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
7211da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
7221ebb9252SMarcel Holtmann 	__le16   voice_setting;
72366c853ccSGustavo F. Padovan } __packed;
7241da177e4SLinus Torvalds 
725a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
7261da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
7271ebb9252SMarcel Holtmann 	__le16   acl_mtu;
7281da177e4SLinus Torvalds 	__u8     sco_mtu;
7291ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
7301ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
73166c853ccSGustavo F. Padovan } __packed;
7321da177e4SLinus Torvalds 
733d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
734d5859e22SJohan Hedberg 
73580a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
73680a1e1dbSJohan Hedberg 
73780a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
73880a1e1dbSJohan Hedberg struct hci_cp_write_eir {
739816a11d5SJohan Hedberg 	__u8	fec;
740816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
74180a1e1dbSJohan Hedberg } __packed;
74280a1e1dbSJohan Hedberg 
743333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
744333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
745333140b5SMarcel Holtmann 	__u8     status;
746333140b5SMarcel Holtmann 	__u8     mode;
74766c853ccSGustavo F. Padovan } __packed;
748333140b5SMarcel Holtmann 
749333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
750333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
751333140b5SMarcel Holtmann 	__u8     mode;
75266c853ccSGustavo F. Padovan } __packed;
753333140b5SMarcel Holtmann 
754c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
755c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
756c35938b2SSzymon Janc 	__u8     status;
757c35938b2SSzymon Janc 	__u8     hash[16];
758c35938b2SSzymon Janc 	__u8     randomizer[16];
759c35938b2SSzymon Janc } __packed;
760c35938b2SSzymon Janc 
761d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
76291c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
76391c4e9b1SMarcel Holtmann 	__u8     status;
76491c4e9b1SMarcel Holtmann 	__s8     tx_power;
76591c4e9b1SMarcel Holtmann } __packed;
766d5859e22SJohan Hedberg 
7671e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
7681e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
7691e89cffbSAndrei Emeltchenko 	__u8     status;
7701e89cffbSAndrei Emeltchenko 	__u8     mode;
7711e89cffbSAndrei Emeltchenko } __packed;
7721e89cffbSAndrei Emeltchenko 
773f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
774f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
775f9b49306SAndre Guedes 	__u8	le;
776f9b49306SAndre Guedes 	__u8	simul;
777f9b49306SAndre Guedes } __packed;
778f9b49306SAndre Guedes 
779a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
780a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
7811da177e4SLinus Torvalds 	__u8     status;
782a9de9248SMarcel Holtmann 	__u8     hci_ver;
783a9de9248SMarcel Holtmann 	__le16   hci_rev;
784a9de9248SMarcel Holtmann 	__u8     lmp_ver;
785a9de9248SMarcel Holtmann 	__le16   manufacturer;
786a9de9248SMarcel Holtmann 	__le16   lmp_subver;
78766c853ccSGustavo F. Padovan } __packed;
7881da177e4SLinus Torvalds 
789a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
790a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
7911da177e4SLinus Torvalds 	__u8     status;
792a9de9248SMarcel Holtmann 	__u8     commands[64];
79366c853ccSGustavo F. Padovan } __packed;
7941da177e4SLinus Torvalds 
795a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
796a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
797a9de9248SMarcel Holtmann 	__u8     status;
798a9de9248SMarcel Holtmann 	__u8     features[8];
79966c853ccSGustavo F. Padovan } __packed;
800a9de9248SMarcel Holtmann 
801a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
802971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
803971e3a4bSAndre Guedes 	__u8     page;
804971e3a4bSAndre Guedes } __packed;
805a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
806a9de9248SMarcel Holtmann 	__u8     status;
807a9de9248SMarcel Holtmann 	__u8     page;
808a9de9248SMarcel Holtmann 	__u8     max_page;
809a9de9248SMarcel Holtmann 	__u8     features[8];
81066c853ccSGustavo F. Padovan } __packed;
811a9de9248SMarcel Holtmann 
812a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
813a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
814a9de9248SMarcel Holtmann 	__u8     status;
815a9de9248SMarcel Holtmann 	__le16   acl_mtu;
816a9de9248SMarcel Holtmann 	__u8     sco_mtu;
817a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
818a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
81966c853ccSGustavo F. Padovan } __packed;
820a9de9248SMarcel Holtmann 
821a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
822a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
823a9de9248SMarcel Holtmann 	__u8     status;
8241da177e4SLinus Torvalds 	bdaddr_t bdaddr;
82566c853ccSGustavo F. Padovan } __packed;
8261da177e4SLinus Torvalds 
827350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
828350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
829350ee4cfSAndrei Emeltchenko 	__u8     status;
830350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
831350ee4cfSAndrei Emeltchenko 	__le16   block_len;
832350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
833350ee4cfSAndrei Emeltchenko } __packed;
834350ee4cfSAndrei Emeltchenko 
835f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
836f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
837f6422ec6SAntti Julku 	__le16   interval;
838f6422ec6SAntti Julku 	__le16   window;
839f6422ec6SAntti Julku } __packed;
840f6422ec6SAntti Julku 
841f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
842f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
843f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
844f6422ec6SAntti Julku 
845928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
846928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
847928abaa7SAndrei Emeltchenko 	__u8     status;
848928abaa7SAndrei Emeltchenko 	__u8     amp_status;
849928abaa7SAndrei Emeltchenko 	__le32   total_bw;
850928abaa7SAndrei Emeltchenko 	__le32   max_bw;
851928abaa7SAndrei Emeltchenko 	__le32   min_latency;
852928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
853928abaa7SAndrei Emeltchenko 	__u8     amp_type;
854928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
855928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
856928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
857928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
858928abaa7SAndrei Emeltchenko } __packed;
859928abaa7SAndrei Emeltchenko 
860523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
861523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
862523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
863523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
864523e93cdSAndrei Emeltchenko 	__le16   max_len;
865523e93cdSAndrei Emeltchenko } __packed;
866523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
867523e93cdSAndrei Emeltchenko 	__u8     status;
868523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
869523e93cdSAndrei Emeltchenko 	__le16   rem_len;
870523e93cdSAndrei Emeltchenko 	__u8     frag[0];
871523e93cdSAndrei Emeltchenko } __packed;
872523e93cdSAndrei Emeltchenko 
873523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
874523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
875523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
876523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
877523e93cdSAndrei Emeltchenko 	__le16   rem_len;
878523e93cdSAndrei Emeltchenko 	__u8     frag[0];
879523e93cdSAndrei Emeltchenko } __packed;
880523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
881523e93cdSAndrei Emeltchenko 	__u8     status;
882523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
883523e93cdSAndrei Emeltchenko } __packed;
884523e93cdSAndrei Emeltchenko 
88563185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
88663185f64SVille Tervo struct hci_cp_le_set_event_mask {
88763185f64SVille Tervo 	__u8     mask[8];
88863185f64SVille Tervo } __packed;
88963185f64SVille Tervo 
89063185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
89163185f64SVille Tervo struct hci_rp_le_read_buffer_size {
89263185f64SVille Tervo 	__u8     status;
89363185f64SVille Tervo 	__le16   le_mtu;
89463185f64SVille Tervo 	__u8     le_max_pkt;
89563185f64SVille Tervo } __packed;
89663185f64SVille Tervo 
89707f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
89807f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
89907f7fa5dSAndre Guedes 	__u8    type;
90007f7fa5dSAndre Guedes 	__le16  interval;
90107f7fa5dSAndre Guedes 	__le16  window;
90207f7fa5dSAndre Guedes 	__u8    own_address_type;
90307f7fa5dSAndre Guedes 	__u8    filter_policy;
90407f7fa5dSAndre Guedes } __packed;
90507f7fa5dSAndre Guedes 
90668a8aea4SAndrei Emeltchenko #define LE_SCANNING_DISABLED		0x00
90768a8aea4SAndrei Emeltchenko #define LE_SCANNING_ENABLED		0x01
90868a8aea4SAndrei Emeltchenko 
909eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
910eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
911eb9d91f5SAndre Guedes 	__u8     enable;
912eb9d91f5SAndre Guedes 	__u8     filter_dup;
913eb9d91f5SAndre Guedes } __packed;
914eb9d91f5SAndre Guedes 
91563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
91663185f64SVille Tervo struct hci_cp_le_create_conn {
91763185f64SVille Tervo 	__le16   scan_interval;
91863185f64SVille Tervo 	__le16   scan_window;
91963185f64SVille Tervo 	__u8     filter_policy;
92063185f64SVille Tervo 	__u8     peer_addr_type;
92163185f64SVille Tervo 	bdaddr_t peer_addr;
92263185f64SVille Tervo 	__u8     own_address_type;
92363185f64SVille Tervo 	__le16   conn_interval_min;
92463185f64SVille Tervo 	__le16   conn_interval_max;
92563185f64SVille Tervo 	__le16   conn_latency;
92663185f64SVille Tervo 	__le16   supervision_timeout;
92763185f64SVille Tervo 	__le16   min_ce_len;
92863185f64SVille Tervo 	__le16   max_ce_len;
92963185f64SVille Tervo } __packed;
93063185f64SVille Tervo 
93163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
93263185f64SVille Tervo 
9332ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
9342ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
9352ce603ebSClaudio Takahasi 	__le16   handle;
9362ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
9372ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
9382ce603ebSClaudio Takahasi 	__le16   conn_latency;
9392ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
9402ce603ebSClaudio Takahasi 	__le16   min_ce_len;
9412ce603ebSClaudio Takahasi 	__le16   max_ce_len;
9422ce603ebSClaudio Takahasi } __packed;
9432ce603ebSClaudio Takahasi 
944a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
945a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
946a7a595f6SVinicius Costa Gomes 	__le16	handle;
947a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
948a7a595f6SVinicius Costa Gomes 	__le16	ediv;
949a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
950a7a595f6SVinicius Costa Gomes } __packed;
951a7a595f6SVinicius Costa Gomes 
952a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
953a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
954a7a595f6SVinicius Costa Gomes 	__le16	handle;
955a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
956a7a595f6SVinicius Costa Gomes } __packed;
957a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
958a7a595f6SVinicius Costa Gomes 	__u8	status;
959a7a595f6SVinicius Costa Gomes 	__le16	handle;
960a7a595f6SVinicius Costa Gomes } __packed;
961a7a595f6SVinicius Costa Gomes 
962a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
963a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
964a7a595f6SVinicius Costa Gomes 	__le16	handle;
965a7a595f6SVinicius Costa Gomes } __packed;
966a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
967a7a595f6SVinicius Costa Gomes 	__u8	status;
968a7a595f6SVinicius Costa Gomes 	__le16	handle;
969a7a595f6SVinicius Costa Gomes } __packed;
970a7a595f6SVinicius Costa Gomes 
9711da177e4SLinus Torvalds /* ---- HCI Events ---- */
9721da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
9731da177e4SLinus Torvalds 
9741da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
9751da177e4SLinus Torvalds struct inquiry_info {
9761da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9771da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
9781da177e4SLinus Torvalds 	__u8     pscan_period_mode;
9791da177e4SLinus Torvalds 	__u8     pscan_mode;
9801da177e4SLinus Torvalds 	__u8     dev_class[3];
9811ebb9252SMarcel Holtmann 	__le16   clock_offset;
98266c853ccSGustavo F. Padovan } __packed;
9831da177e4SLinus Torvalds 
9841da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
9851da177e4SLinus Torvalds struct hci_ev_conn_complete {
9861da177e4SLinus Torvalds 	__u8     status;
9871ebb9252SMarcel Holtmann 	__le16   handle;
9881da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9891da177e4SLinus Torvalds 	__u8     link_type;
9901da177e4SLinus Torvalds 	__u8     encr_mode;
99166c853ccSGustavo F. Padovan } __packed;
9921da177e4SLinus Torvalds 
9931da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
9941da177e4SLinus Torvalds struct hci_ev_conn_request {
9951da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9961da177e4SLinus Torvalds 	__u8     dev_class[3];
9971da177e4SLinus Torvalds 	__u8     link_type;
99866c853ccSGustavo F. Padovan } __packed;
9991da177e4SLinus Torvalds 
10001da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
10011da177e4SLinus Torvalds struct hci_ev_disconn_complete {
10021da177e4SLinus Torvalds 	__u8     status;
10031ebb9252SMarcel Holtmann 	__le16   handle;
10041da177e4SLinus Torvalds 	__u8     reason;
100566c853ccSGustavo F. Padovan } __packed;
10061da177e4SLinus Torvalds 
10071da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
10081da177e4SLinus Torvalds struct hci_ev_auth_complete {
10091da177e4SLinus Torvalds 	__u8     status;
10101ebb9252SMarcel Holtmann 	__le16   handle;
101166c853ccSGustavo F. Padovan } __packed;
10121da177e4SLinus Torvalds 
1013a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1014a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1015a9de9248SMarcel Holtmann 	__u8     status;
1016a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
10171f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
101866c853ccSGustavo F. Padovan } __packed;
1019a9de9248SMarcel Holtmann 
10201da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
10211da177e4SLinus Torvalds struct hci_ev_encrypt_change {
10221da177e4SLinus Torvalds 	__u8     status;
10231ebb9252SMarcel Holtmann 	__le16   handle;
10241da177e4SLinus Torvalds 	__u8     encrypt;
102566c853ccSGustavo F. Padovan } __packed;
10261da177e4SLinus Torvalds 
1027a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1028a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
10291da177e4SLinus Torvalds 	__u8     status;
10301ebb9252SMarcel Holtmann 	__le16   handle;
103166c853ccSGustavo F. Padovan } __packed;
10321da177e4SLinus Torvalds 
1033a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1034a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1035a9de9248SMarcel Holtmann 	__u8     status;
1036a9de9248SMarcel Holtmann 	__le16   handle;
1037a9de9248SMarcel Holtmann 	__u8     features[8];
103866c853ccSGustavo F. Padovan } __packed;
1039a9de9248SMarcel Holtmann 
1040a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1041a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1042a9de9248SMarcel Holtmann 	__u8     status;
1043a9de9248SMarcel Holtmann 	__le16   handle;
1044a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1045a9de9248SMarcel Holtmann 	__le16   manufacturer;
1046a9de9248SMarcel Holtmann 	__le16   lmp_subver;
104766c853ccSGustavo F. Padovan } __packed;
1048a9de9248SMarcel Holtmann 
1049a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
10501da177e4SLinus Torvalds struct hci_qos {
10511da177e4SLinus Torvalds 	__u8     service_type;
10521da177e4SLinus Torvalds 	__u32    token_rate;
10531da177e4SLinus Torvalds 	__u32    peak_bandwidth;
10541da177e4SLinus Torvalds 	__u32    latency;
10551da177e4SLinus Torvalds 	__u32    delay_variation;
105666c853ccSGustavo F. Padovan } __packed;
10571da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
10581da177e4SLinus Torvalds 	__u8     status;
10591ebb9252SMarcel Holtmann 	__le16   handle;
10601da177e4SLinus Torvalds 	struct   hci_qos qos;
106166c853ccSGustavo F. Padovan } __packed;
10621da177e4SLinus Torvalds 
1063a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
10641da177e4SLinus Torvalds struct hci_ev_cmd_complete {
10651da177e4SLinus Torvalds 	__u8     ncmd;
10661ebb9252SMarcel Holtmann 	__le16   opcode;
106766c853ccSGustavo F. Padovan } __packed;
10681da177e4SLinus Torvalds 
1069a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
10701da177e4SLinus Torvalds struct hci_ev_cmd_status {
10711da177e4SLinus Torvalds 	__u8     status;
10721da177e4SLinus Torvalds 	__u8     ncmd;
10731ebb9252SMarcel Holtmann 	__le16   opcode;
107466c853ccSGustavo F. Padovan } __packed;
10751da177e4SLinus Torvalds 
10761da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
10771da177e4SLinus Torvalds struct hci_ev_role_change {
10781da177e4SLinus Torvalds 	__u8     status;
10791da177e4SLinus Torvalds 	bdaddr_t bdaddr;
10801da177e4SLinus Torvalds 	__u8     role;
108166c853ccSGustavo F. Padovan } __packed;
10821da177e4SLinus Torvalds 
1083a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1084613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1085613a1c0cSAndrei Emeltchenko 	__le16   handle;
1086613a1c0cSAndrei Emeltchenko 	__le16   count;
1087613a1c0cSAndrei Emeltchenko } __packed;
1088613a1c0cSAndrei Emeltchenko 
1089a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1090a9de9248SMarcel Holtmann 	__u8     num_hndl;
1091613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
109266c853ccSGustavo F. Padovan } __packed;
1093a9de9248SMarcel Holtmann 
10941da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
10951da177e4SLinus Torvalds struct hci_ev_mode_change {
10961da177e4SLinus Torvalds 	__u8     status;
10971ebb9252SMarcel Holtmann 	__le16   handle;
10981da177e4SLinus Torvalds 	__u8     mode;
10991ebb9252SMarcel Holtmann 	__le16   interval;
110066c853ccSGustavo F. Padovan } __packed;
11011da177e4SLinus Torvalds 
11021da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
11031da177e4SLinus Torvalds struct hci_ev_pin_code_req {
11041da177e4SLinus Torvalds 	bdaddr_t bdaddr;
110566c853ccSGustavo F. Padovan } __packed;
11061da177e4SLinus Torvalds 
11071da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
11081da177e4SLinus Torvalds struct hci_ev_link_key_req {
11091da177e4SLinus Torvalds 	bdaddr_t bdaddr;
111066c853ccSGustavo F. Padovan } __packed;
11111da177e4SLinus Torvalds 
11121da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
11131da177e4SLinus Torvalds struct hci_ev_link_key_notify {
11141da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11159b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
11161da177e4SLinus Torvalds 	__u8     key_type;
111766c853ccSGustavo F. Padovan } __packed;
11181da177e4SLinus Torvalds 
1119a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
11201da177e4SLinus Torvalds struct hci_ev_clock_offset {
11211da177e4SLinus Torvalds 	__u8     status;
11221ebb9252SMarcel Holtmann 	__le16   handle;
11231ebb9252SMarcel Holtmann 	__le16   clock_offset;
112466c853ccSGustavo F. Padovan } __packed;
11251da177e4SLinus Torvalds 
1126a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1127a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1128a8746417SMarcel Holtmann 	__u8     status;
1129a8746417SMarcel Holtmann 	__le16   handle;
1130a8746417SMarcel Holtmann 	__le16   pkt_type;
113166c853ccSGustavo F. Padovan } __packed;
1132a8746417SMarcel Holtmann 
113385a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
113485a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
113585a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
113685a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
113766c853ccSGustavo F. Padovan } __packed;
113885a1e930SMarcel Holtmann 
1139a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1140a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1141a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1142a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1143a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1144a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1145a9de9248SMarcel Holtmann 	__le16   clock_offset;
1146a9de9248SMarcel Holtmann 	__s8     rssi;
114766c853ccSGustavo F. Padovan } __packed;
1148a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1149a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1150a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1151a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1152a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1153a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1154a9de9248SMarcel Holtmann 	__le16   clock_offset;
1155a9de9248SMarcel Holtmann 	__s8     rssi;
115666c853ccSGustavo F. Padovan } __packed;
1157a9de9248SMarcel Holtmann 
1158a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1159a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1160a9de9248SMarcel Holtmann 	__u8     status;
1161a9de9248SMarcel Holtmann 	__le16   handle;
1162a9de9248SMarcel Holtmann 	__u8     page;
1163a9de9248SMarcel Holtmann 	__u8     max_page;
1164a9de9248SMarcel Holtmann 	__u8     features[8];
116566c853ccSGustavo F. Padovan } __packed;
1166a9de9248SMarcel Holtmann 
1167a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1168a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1169a9de9248SMarcel Holtmann 	__u8     status;
1170a9de9248SMarcel Holtmann 	__le16   handle;
1171a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1172a9de9248SMarcel Holtmann 	__u8     link_type;
1173a9de9248SMarcel Holtmann 	__u8     tx_interval;
1174a9de9248SMarcel Holtmann 	__u8     retrans_window;
1175a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1176a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1177a9de9248SMarcel Holtmann 	__u8     air_mode;
117866c853ccSGustavo F. Padovan } __packed;
1179a9de9248SMarcel Holtmann 
1180a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1181a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1182a9de9248SMarcel Holtmann 	__u8     status;
1183a9de9248SMarcel Holtmann 	__le16   handle;
1184a9de9248SMarcel Holtmann 	__u8     tx_interval;
1185a9de9248SMarcel Holtmann 	__u8     retrans_window;
1186a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1187a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
118866c853ccSGustavo F. Padovan } __packed;
1189a9de9248SMarcel Holtmann 
1190a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
119104837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
119204837f64SMarcel Holtmann 	__u8     status;
119304837f64SMarcel Holtmann 	__le16   handle;
119404837f64SMarcel Holtmann 	__le16   max_tx_latency;
119504837f64SMarcel Holtmann 	__le16   max_rx_latency;
119604837f64SMarcel Holtmann 	__le16   max_remote_timeout;
119704837f64SMarcel Holtmann 	__le16   max_local_timeout;
119866c853ccSGustavo F. Padovan } __packed;
119904837f64SMarcel Holtmann 
1200a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1201a9de9248SMarcel Holtmann struct extended_inquiry_info {
1202a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1203a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1204a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1205a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1206a9de9248SMarcel Holtmann 	__le16   clock_offset;
1207a9de9248SMarcel Holtmann 	__s8     rssi;
1208a9de9248SMarcel Holtmann 	__u8     data[240];
120966c853ccSGustavo F. Padovan } __packed;
1210a9de9248SMarcel Holtmann 
12111c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
12121c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
12131c2e0041SJohan Hedberg 	__u8	status;
12141c2e0041SJohan Hedberg 	__le16	handle;
12151c2e0041SJohan Hedberg } __packed;
12161c2e0041SJohan Hedberg 
12170493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
12180493684eSMarcel Holtmann struct hci_ev_io_capa_request {
12190493684eSMarcel Holtmann 	bdaddr_t bdaddr;
122066c853ccSGustavo F. Padovan } __packed;
12210493684eSMarcel Holtmann 
122203b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
122303b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
122403b555e1SJohan Hedberg 	bdaddr_t bdaddr;
122503b555e1SJohan Hedberg 	__u8     capability;
122603b555e1SJohan Hedberg 	__u8     oob_data;
122703b555e1SJohan Hedberg 	__u8     authentication;
122803b555e1SJohan Hedberg } __packed;
122903b555e1SJohan Hedberg 
1230a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1231a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1232a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1233a5c29683SJohan Hedberg 	__le32		passkey;
1234a5c29683SJohan Hedberg } __packed;
1235a5c29683SJohan Hedberg 
12369ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
12379ad4019aSBrian Gix struct hci_ev_user_passkey_req {
12389ad4019aSBrian Gix 	bdaddr_t	bdaddr;
12399ad4019aSBrian Gix } __packed;
12409ad4019aSBrian Gix 
12412763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
12422763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
12432763eda6SSzymon Janc 	bdaddr_t bdaddr;
12442763eda6SSzymon Janc } __packed;
12452763eda6SSzymon Janc 
12460493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
12470493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
12480493684eSMarcel Holtmann 	__u8     status;
12490493684eSMarcel Holtmann 	bdaddr_t bdaddr;
125066c853ccSGustavo F. Padovan } __packed;
12510493684eSMarcel Holtmann 
1252*92a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
1253*92a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
1254*92a25256SJohan Hedberg 	bdaddr_t	bdaddr;
1255*92a25256SJohan Hedberg 	__le32		passkey;
1256*92a25256SJohan Hedberg } __packed;
1257*92a25256SJohan Hedberg 
1258*92a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
1259*92a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
1260*92a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
1261*92a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
1262*92a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
1263*92a25256SJohan Hedberg 
1264*92a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
1265*92a25256SJohan Hedberg struct hci_ev_keypress_notify {
1266*92a25256SJohan Hedberg 	bdaddr_t	bdaddr;
1267*92a25256SJohan Hedberg 	__u8		type;
1268*92a25256SJohan Hedberg } __packed;
1269*92a25256SJohan Hedberg 
127041a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
127141a96212SMarcel Holtmann struct hci_ev_remote_host_features {
127241a96212SMarcel Holtmann 	bdaddr_t bdaddr;
127341a96212SMarcel Holtmann 	__u8     features[8];
127466c853ccSGustavo F. Padovan } __packed;
127541a96212SMarcel Holtmann 
127663185f64SVille Tervo #define HCI_EV_LE_META			0x3e
127763185f64SVille Tervo struct hci_ev_le_meta {
127863185f64SVille Tervo 	__u8     subevent;
127963185f64SVille Tervo } __packed;
128063185f64SVille Tervo 
1281523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1282523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1283523e93cdSAndrei Emeltchenko 	__u8     status;
1284523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1285523e93cdSAndrei Emeltchenko } __packed;
1286523e93cdSAndrei Emeltchenko 
1287523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1288523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1289523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1290523e93cdSAndrei Emeltchenko } __packed;
1291523e93cdSAndrei Emeltchenko 
1292523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1293523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1294523e93cdSAndrei Emeltchenko 	__u8     status;
1295523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1296523e93cdSAndrei Emeltchenko 	__u8     reason;
1297523e93cdSAndrei Emeltchenko } __packed;
1298523e93cdSAndrei Emeltchenko 
1299523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1300523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1301523e93cdSAndrei Emeltchenko 	__u8     status;
1302523e93cdSAndrei Emeltchenko 	__le16   handle;
1303523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1304523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1305523e93cdSAndrei Emeltchenko } __packed;
1306523e93cdSAndrei Emeltchenko 
1307523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1308523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1309523e93cdSAndrei Emeltchenko 	__u8     status;
1310523e93cdSAndrei Emeltchenko 	__le16   handle;
1311523e93cdSAndrei Emeltchenko 	__u8     reason;
1312523e93cdSAndrei Emeltchenko } __packed;
1313523e93cdSAndrei Emeltchenko 
131425e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
131525e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
131625e89e99SAndrei Emeltchenko 	__le16   handle;
131725e89e99SAndrei Emeltchenko 	__le16   pkts;
131825e89e99SAndrei Emeltchenko 	__le16   blocks;
131925e89e99SAndrei Emeltchenko } __packed;
132025e89e99SAndrei Emeltchenko 
132125e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
132225e89e99SAndrei Emeltchenko 	__le16   num_blocks;
132325e89e99SAndrei Emeltchenko 	__u8     num_hndl;
132425e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
132525e89e99SAndrei Emeltchenko } __packed;
132625e89e99SAndrei Emeltchenko 
132763185f64SVille Tervo /* Low energy meta events */
1328b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1329b9b343d2SAndre Guedes 
133063185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
133163185f64SVille Tervo struct hci_ev_le_conn_complete {
133263185f64SVille Tervo 	__u8     status;
133363185f64SVille Tervo 	__le16   handle;
133463185f64SVille Tervo 	__u8     role;
133563185f64SVille Tervo 	__u8     bdaddr_type;
133663185f64SVille Tervo 	bdaddr_t bdaddr;
133763185f64SVille Tervo 	__le16   interval;
133863185f64SVille Tervo 	__le16   latency;
133963185f64SVille Tervo 	__le16   supervision_timeout;
134063185f64SVille Tervo 	__u8     clk_accurancy;
134163185f64SVille Tervo } __packed;
134263185f64SVille Tervo 
1343a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1344a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1345a7a595f6SVinicius Costa Gomes 	__le16	handle;
1346a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1347a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1348a7a595f6SVinicius Costa Gomes } __packed;
1349a7a595f6SVinicius Costa Gomes 
135057a56fd4SAnderson Briglia /* Advertising report event types */
135157a56fd4SAnderson Briglia #define ADV_IND		0x00
135257a56fd4SAnderson Briglia #define ADV_DIRECT_IND	0x01
135357a56fd4SAnderson Briglia #define ADV_SCAN_IND	0x02
135457a56fd4SAnderson Briglia #define ADV_NONCONN_IND	0x03
135557a56fd4SAnderson Briglia #define ADV_SCAN_RSP	0x04
135657a56fd4SAnderson Briglia 
135757a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
135857a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
135957a56fd4SAnderson Briglia 
136057a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
136157a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
136257a56fd4SAnderson Briglia 	__u8	 evt_type;
136357a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
136457a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
136557a56fd4SAnderson Briglia 	__u8	 length;
136657a56fd4SAnderson Briglia 	__u8	 data[0];
136757a56fd4SAnderson Briglia } __packed;
136857a56fd4SAnderson Briglia 
13691da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1370a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
13711da177e4SLinus Torvalds struct hci_ev_stack_internal {
13721da177e4SLinus Torvalds 	__u16    type;
13731da177e4SLinus Torvalds 	__u8     data[0];
137466c853ccSGustavo F. Padovan } __packed;
13751da177e4SLinus Torvalds 
13761da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
13771da177e4SLinus Torvalds struct hci_ev_si_device {
13781da177e4SLinus Torvalds 	__u16    event;
13791da177e4SLinus Torvalds 	__u16    dev_id;
138066c853ccSGustavo F. Padovan } __packed;
13811da177e4SLinus Torvalds 
13821da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
13831da177e4SLinus Torvalds struct hci_ev_si_security {
13841da177e4SLinus Torvalds 	__u16    event;
13851da177e4SLinus Torvalds 	__u16    proto;
13861da177e4SLinus Torvalds 	__u16    subproto;
13871da177e4SLinus Torvalds 	__u8     incoming;
138866c853ccSGustavo F. Padovan } __packed;
13891da177e4SLinus Torvalds 
13901da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
13911da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
13921da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
13931da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
13941da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
13951da177e4SLinus Torvalds 
13961da177e4SLinus Torvalds struct hci_command_hdr {
13971ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
13981da177e4SLinus Torvalds 	__u8	plen;
139966c853ccSGustavo F. Padovan } __packed;
14001da177e4SLinus Torvalds 
14011da177e4SLinus Torvalds struct hci_event_hdr {
14021da177e4SLinus Torvalds 	__u8	evt;
14031da177e4SLinus Torvalds 	__u8	plen;
140466c853ccSGustavo F. Padovan } __packed;
14051da177e4SLinus Torvalds 
14061da177e4SLinus Torvalds struct hci_acl_hdr {
14071ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
14081ebb9252SMarcel Holtmann 	__le16	dlen;
140966c853ccSGustavo F. Padovan } __packed;
14101da177e4SLinus Torvalds 
14111da177e4SLinus Torvalds struct hci_sco_hdr {
14121ebb9252SMarcel Holtmann 	__le16	handle;
14131da177e4SLinus Torvalds 	__u8	dlen;
141466c853ccSGustavo F. Padovan } __packed;
14151da177e4SLinus Torvalds 
14162a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
14172a123b86SArnaldo Carvalho de Melo {
14182a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
14192a123b86SArnaldo Carvalho de Melo }
14202a123b86SArnaldo Carvalho de Melo 
14212a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
14222a123b86SArnaldo Carvalho de Melo {
14232a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
14242a123b86SArnaldo Carvalho de Melo }
14252a123b86SArnaldo Carvalho de Melo 
14262a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
14272a123b86SArnaldo Carvalho de Melo {
14282a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
14292a123b86SArnaldo Carvalho de Melo }
14302a123b86SArnaldo Carvalho de Melo 
14311da177e4SLinus Torvalds /* Command opcode pack/unpack */
1432c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
14331da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
14341da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
14351da177e4SLinus Torvalds 
14361da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1437c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
14381da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
14391da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
14401da177e4SLinus Torvalds 
14411da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
14421da177e4SLinus Torvalds 
14431da177e4SLinus Torvalds /* Socket options */
14441da177e4SLinus Torvalds #define HCI_DATA_DIR	1
14451da177e4SLinus Torvalds #define HCI_FILTER	2
14461da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
14471da177e4SLinus Torvalds 
14481da177e4SLinus Torvalds /* CMSG flags */
14491da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
14501da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
14511da177e4SLinus Torvalds 
14521da177e4SLinus Torvalds struct sockaddr_hci {
14531da177e4SLinus Torvalds 	sa_family_t    hci_family;
14541da177e4SLinus Torvalds 	unsigned short hci_dev;
1455c02178d2SJohan Hedberg 	unsigned short hci_channel;
14561da177e4SLinus Torvalds };
14571da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
14581da177e4SLinus Torvalds 
1459c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1460cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
146166f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1462c02178d2SJohan Hedberg 
14631da177e4SLinus Torvalds struct hci_filter {
14641da177e4SLinus Torvalds 	unsigned long type_mask;
14651da177e4SLinus Torvalds 	unsigned long event_mask[2];
1466905f3ed6SAl Viro 	__le16 opcode;
14671da177e4SLinus Torvalds };
14681da177e4SLinus Torvalds 
14691da177e4SLinus Torvalds struct hci_ufilter {
14701da177e4SLinus Torvalds 	__u32  type_mask;
14711da177e4SLinus Torvalds 	__u32  event_mask[2];
1472905f3ed6SAl Viro 	__le16 opcode;
14731da177e4SLinus Torvalds };
14741da177e4SLinus Torvalds 
14751da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
14761da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
14771da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
14781da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
14791da177e4SLinus Torvalds 
14801da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
14811da177e4SLinus Torvalds struct hci_dev_stats {
14821da177e4SLinus Torvalds 	__u32 err_rx;
14831da177e4SLinus Torvalds 	__u32 err_tx;
14841da177e4SLinus Torvalds 	__u32 cmd_tx;
14851da177e4SLinus Torvalds 	__u32 evt_rx;
14861da177e4SLinus Torvalds 	__u32 acl_tx;
14871da177e4SLinus Torvalds 	__u32 acl_rx;
14881da177e4SLinus Torvalds 	__u32 sco_tx;
14891da177e4SLinus Torvalds 	__u32 sco_rx;
14901da177e4SLinus Torvalds 	__u32 byte_rx;
14911da177e4SLinus Torvalds 	__u32 byte_tx;
14921da177e4SLinus Torvalds };
14931da177e4SLinus Torvalds 
14941da177e4SLinus Torvalds struct hci_dev_info {
14951da177e4SLinus Torvalds 	__u16 dev_id;
14961da177e4SLinus Torvalds 	char  name[8];
14971da177e4SLinus Torvalds 
14981da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14991da177e4SLinus Torvalds 
15001da177e4SLinus Torvalds 	__u32 flags;
15011da177e4SLinus Torvalds 	__u8  type;
15021da177e4SLinus Torvalds 
15031da177e4SLinus Torvalds 	__u8  features[8];
15041da177e4SLinus Torvalds 
15051da177e4SLinus Torvalds 	__u32 pkt_type;
15061da177e4SLinus Torvalds 	__u32 link_policy;
15071da177e4SLinus Torvalds 	__u32 link_mode;
15081da177e4SLinus Torvalds 
15091da177e4SLinus Torvalds 	__u16 acl_mtu;
15101da177e4SLinus Torvalds 	__u16 acl_pkts;
15111da177e4SLinus Torvalds 	__u16 sco_mtu;
15121da177e4SLinus Torvalds 	__u16 sco_pkts;
15131da177e4SLinus Torvalds 
15141da177e4SLinus Torvalds 	struct hci_dev_stats stat;
15151da177e4SLinus Torvalds };
15161da177e4SLinus Torvalds 
15171da177e4SLinus Torvalds struct hci_conn_info {
15181da177e4SLinus Torvalds 	__u16    handle;
15191da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15201da177e4SLinus Torvalds 	__u8     type;
15211da177e4SLinus Torvalds 	__u8     out;
15221da177e4SLinus Torvalds 	__u16    state;
15231da177e4SLinus Torvalds 	__u32    link_mode;
15241da177e4SLinus Torvalds };
15251da177e4SLinus Torvalds 
15261da177e4SLinus Torvalds struct hci_dev_req {
15271da177e4SLinus Torvalds 	__u16  dev_id;
15281da177e4SLinus Torvalds 	__u32  dev_opt;
15291da177e4SLinus Torvalds };
15301da177e4SLinus Torvalds 
15311da177e4SLinus Torvalds struct hci_dev_list_req {
15321da177e4SLinus Torvalds 	__u16  dev_num;
15331da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
15341da177e4SLinus Torvalds };
15351da177e4SLinus Torvalds 
15361da177e4SLinus Torvalds struct hci_conn_list_req {
15371da177e4SLinus Torvalds 	__u16  dev_id;
15381da177e4SLinus Torvalds 	__u16  conn_num;
15391da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
15401da177e4SLinus Torvalds };
15411da177e4SLinus Torvalds 
15421da177e4SLinus Torvalds struct hci_conn_info_req {
15431da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15441da177e4SLinus Torvalds 	__u8     type;
15451da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
15461da177e4SLinus Torvalds };
15471da177e4SLinus Torvalds 
154840be492fSMarcel Holtmann struct hci_auth_info_req {
154940be492fSMarcel Holtmann 	bdaddr_t bdaddr;
155040be492fSMarcel Holtmann 	__u8     type;
155140be492fSMarcel Holtmann };
155240be492fSMarcel Holtmann 
15531da177e4SLinus Torvalds struct hci_inquiry_req {
15541da177e4SLinus Torvalds 	__u16 dev_id;
15551da177e4SLinus Torvalds 	__u16 flags;
15561da177e4SLinus Torvalds 	__u8  lap[3];
15571da177e4SLinus Torvalds 	__u8  length;
15581da177e4SLinus Torvalds 	__u8  num_rsp;
15591da177e4SLinus Torvalds };
15601da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
15611da177e4SLinus Torvalds 
15628b281b9cSFabio Estevam extern bool enable_hs;
15638830f514SAndrei Emeltchenko 
15641da177e4SLinus Torvalds #endif /* __HCI_H */
1565