xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 9345d40c580d0f3dfc040add0e6371b1a629c1cc)
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 
651da177e4SLinus Torvalds /* HCI device quirks */
661da177e4SLinus Torvalds enum {
67a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
68da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
69da1f5198SMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE
701da177e4SLinus Torvalds };
711da177e4SLinus Torvalds 
721da177e4SLinus Torvalds /* HCI device flags */
731da177e4SLinus Torvalds enum {
741da177e4SLinus Torvalds 	HCI_UP,
751da177e4SLinus Torvalds 	HCI_INIT,
761da177e4SLinus Torvalds 	HCI_RUNNING,
771da177e4SLinus Torvalds 
781da177e4SLinus Torvalds 	HCI_PSCAN,
791da177e4SLinus Torvalds 	HCI_ISCAN,
801da177e4SLinus Torvalds 	HCI_AUTH,
811da177e4SLinus Torvalds 	HCI_ENCRYPT,
821da177e4SLinus Torvalds 	HCI_INQUIRY,
831da177e4SLinus Torvalds 
841da177e4SLinus Torvalds 	HCI_RAW,
85ab81cbf9SJohan Hedberg 
8610572132SGustavo F. Padovan 	HCI_RESET,
871da177e4SLinus Torvalds };
881da177e4SLinus Torvalds 
89d23264a8SAndre Guedes /*
90d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
91d23264a8SAndre Guedes  * states from the controller.
92d23264a8SAndre Guedes  */
93d23264a8SAndre Guedes enum {
94a8b2d5c2SJohan Hedberg 	HCI_SETUP,
95a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
96a8b2d5c2SJohan Hedberg 	HCI_MGMT,
97a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
98a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
99a8b2d5c2SJohan Hedberg 	HCI_LINK_KEYS,
100a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
10194324962SJohan Hovold 	HCI_UNREGISTER,
102a8b2d5c2SJohan Hedberg 
103d23264a8SAndre Guedes 	HCI_LE_SCAN,
10484bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
1056d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
10606199cf8SJohan Hedberg 	HCI_LE_ENABLED,
1075e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1085e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
10947990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
110c95f0ba7SJohan Hedberg 	HCI_PENDING_CLASS,
11121693c15SAndre Guedes 	HCI_PERIODIC_INQ,
112d23264a8SAndre Guedes };
113d23264a8SAndre Guedes 
1141da177e4SLinus Torvalds /* HCI ioctl defines */
1151da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1161da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1171da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1181da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1191da177e4SLinus Torvalds 
1201da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1211da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1221da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1231da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
12440be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1251da177e4SLinus Torvalds 
1261da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1271da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1281da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1291da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1301da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1311da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1321da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1331da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1341da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1351da177e4SLinus Torvalds 
136f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
137f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
138f0358568SJohan Hedberg 
1391da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds /* HCI timeouts */
1425f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1435f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1445f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
145*9345d40cSAndrei Emeltchenko #define HCI_CMD_TIMEOUT		msecs_to_jiffies(1000)	/* 1 second */
1465f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
147*9345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1481da177e4SLinus Torvalds 
1495b7f9909SMarcel Holtmann /* HCI data types */
1501da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1511da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1521da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1531da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1541da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1551da177e4SLinus Torvalds 
1565b7f9909SMarcel Holtmann /* HCI packet types */
1571da177e4SLinus Torvalds #define HCI_DM1		0x0008
1581da177e4SLinus Torvalds #define HCI_DM3		0x0400
1591da177e4SLinus Torvalds #define HCI_DM5		0x4000
1601da177e4SLinus Torvalds #define HCI_DH1		0x0010
1611da177e4SLinus Torvalds #define HCI_DH3		0x0800
1621da177e4SLinus Torvalds #define HCI_DH5		0x8000
1631da177e4SLinus Torvalds 
1641da177e4SLinus Torvalds #define HCI_HV1		0x0020
1651da177e4SLinus Torvalds #define HCI_HV2		0x0040
1661da177e4SLinus Torvalds #define HCI_HV3		0x0080
1671da177e4SLinus Torvalds 
1681da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1691da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1701da177e4SLinus Torvalds 
1715b7f9909SMarcel Holtmann /* eSCO packet types */
1725b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1735b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1745b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1755b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1765b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1775b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
178efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
179efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
180efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
181efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
1825b7f9909SMarcel Holtmann 
183a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
184efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
185a8746417SMarcel Holtmann 
1861da177e4SLinus Torvalds /* ACL flags */
187e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
1881da177e4SLinus Torvalds #define ACL_CONT		0x01
1891da177e4SLinus Torvalds #define ACL_START		0x02
1901da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
1911da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds /* Baseband links */
1941da177e4SLinus Torvalds #define SCO_LINK	0x00
1951da177e4SLinus Torvalds #define ACL_LINK	0x01
1965b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
197fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
198fcd89c09SVille Tervo #define LE_LINK		0x80
1991da177e4SLinus Torvalds 
2001da177e4SLinus Torvalds /* LMP features */
2011da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2021da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2031da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2041da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2051da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2061da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2071da177e4SLinus Torvalds #define LMP_HOLD	0x40
20804837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2091da177e4SLinus Torvalds 
2101da177e4SLinus Torvalds #define LMP_PARK	0x01
2111da177e4SLinus Torvalds #define LMP_RSSI	0x02
2121da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2131da177e4SLinus Torvalds #define LMP_SCO		0x08
2141da177e4SLinus Torvalds #define LMP_HV2		0x10
2151da177e4SLinus Torvalds #define LMP_HV3		0x20
2161da177e4SLinus Torvalds #define LMP_ULAW	0x40
2171da177e4SLinus Torvalds #define LMP_ALAW	0x80
2181da177e4SLinus Torvalds 
2191da177e4SLinus Torvalds #define LMP_CVSD	0x01
2201da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2211da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
2221da177e4SLinus Torvalds 
223d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2245b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2255b7f9909SMarcel Holtmann 
2265b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2275b7f9909SMarcel Holtmann #define LMP_EV5		0x02
22869ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
229d5859e22SJohan Hedberg #define LMP_LE		0x40
2305b7f9909SMarcel Holtmann 
23104837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
232d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
233efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
234efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
235efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
23604837f64SMarcel Holtmann 
237d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
238e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
239769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
240e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
241769be974SMarcel Holtmann 
242d5859e22SJohan Hedberg #define LMP_LSTO	0x01
243d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
244971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
245d5859e22SJohan Hedberg 
246eead27daSAndre Guedes /* Extended LMP features */
247cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
248eead27daSAndre Guedes #define LMP_HOST_LE		0x02
249cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
250eead27daSAndre Guedes 
25104837f64SMarcel Holtmann /* Connection modes */
25204837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
25304837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
25404837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
25504837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
25604837f64SMarcel Holtmann 
2571da177e4SLinus Torvalds /* Link policies */
2581da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2591da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2601da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2611da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2621da177e4SLinus Torvalds 
26304837f64SMarcel Holtmann /* Link modes */
2641da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2651da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2661da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2671da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2681da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2691da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2701da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2711da177e4SLinus Torvalds 
27240be492fSMarcel Holtmann /* Authentication types */
27340be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
27440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
27540be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
27640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
27740be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
27840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
27940be492fSMarcel Holtmann 
280b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
281b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
282b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
283b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
284b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
285b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
286b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
287b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
288b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
289b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
290b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
291b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
292b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
293b6020ba0SWaldemar Rymarkiewicz 
2949f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
2959f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
2969f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
2979f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
2989f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
2999f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3009f5a0d7bSAndrei Emeltchenko 
3012455a3eaSAndrei Emeltchenko /* Flow control modes */
3022455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3032455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3042455a3eaSAndrei Emeltchenko 
30532748db0SJohan Hedberg /* Extended Inquiry Response field types */
30632748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
30732748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
30832748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
30932748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
31032748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
31132748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
31232748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
31332748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
31432748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
31532748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3169ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3179ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3189ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
31932748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
32032748db0SJohan Hedberg 
3211da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3226bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3236bd32326SVille Tervo 
324a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
325a9de9248SMarcel Holtmann struct hci_cp_inquiry {
326a9de9248SMarcel Holtmann 	__u8     lap[3];
327a9de9248SMarcel Holtmann 	__u8     length;
328a9de9248SMarcel Holtmann 	__u8     num_rsp;
32966c853ccSGustavo F. Padovan } __packed;
3301da177e4SLinus Torvalds 
331a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
332a9de9248SMarcel Holtmann 
33379d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
33479d6e068SAndre Guedes 
335a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
336a9de9248SMarcel Holtmann 
337a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
338a9de9248SMarcel Holtmann struct hci_cp_create_conn {
339a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
340a9de9248SMarcel Holtmann 	__le16   pkt_type;
341a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
342a9de9248SMarcel Holtmann 	__u8     pscan_mode;
343a9de9248SMarcel Holtmann 	__le16   clock_offset;
344a9de9248SMarcel Holtmann 	__u8     role_switch;
34566c853ccSGustavo F. Padovan } __packed;
3461da177e4SLinus Torvalds 
347a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
348a9de9248SMarcel Holtmann struct hci_cp_disconnect {
349a9de9248SMarcel Holtmann 	__le16   handle;
350a9de9248SMarcel Holtmann 	__u8     reason;
35166c853ccSGustavo F. Padovan } __packed;
3521da177e4SLinus Torvalds 
353a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
354a9de9248SMarcel Holtmann struct hci_cp_add_sco {
355a9de9248SMarcel Holtmann 	__le16   handle;
356a9de9248SMarcel Holtmann 	__le16   pkt_type;
35766c853ccSGustavo F. Padovan } __packed;
358a9de9248SMarcel Holtmann 
359a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
360a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
3611da177e4SLinus Torvalds 	bdaddr_t bdaddr;
36266c853ccSGustavo F. Padovan } __packed;
3631da177e4SLinus Torvalds 
364a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
365a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
366a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
367a9de9248SMarcel Holtmann 	__u8     role;
36866c853ccSGustavo F. Padovan } __packed;
3691da177e4SLinus Torvalds 
370a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
371a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
372a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
373a9de9248SMarcel Holtmann 	__u8     reason;
37466c853ccSGustavo F. Padovan } __packed;
3751da177e4SLinus Torvalds 
376a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
377a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
378a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
3799b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
38066c853ccSGustavo F. Padovan } __packed;
3811da177e4SLinus Torvalds 
382a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
383a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
384a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
38566c853ccSGustavo F. Padovan } __packed;
3861da177e4SLinus Torvalds 
387a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
388a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
389a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
390a9de9248SMarcel Holtmann 	__u8     pin_len;
391a9de9248SMarcel Holtmann 	__u8     pin_code[16];
39266c853ccSGustavo F. Padovan } __packed;
393980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
394980e1a53SJohan Hedberg 	__u8     status;
395980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
396980e1a53SJohan Hedberg } __packed;
397a9de9248SMarcel Holtmann 
398a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
399a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
400a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
40166c853ccSGustavo F. Padovan } __packed;
402980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
403980e1a53SJohan Hedberg 	__u8     status;
404980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
405980e1a53SJohan Hedberg } __packed;
406a9de9248SMarcel Holtmann 
407a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
408a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
409a9de9248SMarcel Holtmann 	__le16   handle;
410a9de9248SMarcel Holtmann 	__le16   pkt_type;
41166c853ccSGustavo F. Padovan } __packed;
412a9de9248SMarcel Holtmann 
413a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
414a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
415a9de9248SMarcel Holtmann 	__le16   handle;
41666c853ccSGustavo F. Padovan } __packed;
417a9de9248SMarcel Holtmann 
418a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
419a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
420a9de9248SMarcel Holtmann 	__le16   handle;
421a9de9248SMarcel Holtmann 	__u8     encrypt;
42266c853ccSGustavo F. Padovan } __packed;
423a9de9248SMarcel Holtmann 
424a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
425a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
426a9de9248SMarcel Holtmann 	__le16   handle;
42766c853ccSGustavo F. Padovan } __packed;
428a9de9248SMarcel Holtmann 
429a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
430a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
431a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
432a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
433a9de9248SMarcel Holtmann 	__u8     pscan_mode;
434a9de9248SMarcel Holtmann 	__le16   clock_offset;
43566c853ccSGustavo F. Padovan } __packed;
436a9de9248SMarcel Holtmann 
437a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
438a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
439a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
44066c853ccSGustavo F. Padovan } __packed;
441a9de9248SMarcel Holtmann 
442a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
443a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
444a9de9248SMarcel Holtmann 	__le16   handle;
44566c853ccSGustavo F. Padovan } __packed;
446a9de9248SMarcel Holtmann 
447a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
448a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
449a9de9248SMarcel Holtmann 	__le16   handle;
450a9de9248SMarcel Holtmann 	__u8     page;
45166c853ccSGustavo F. Padovan } __packed;
452a9de9248SMarcel Holtmann 
453a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
454a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
455a9de9248SMarcel Holtmann 	__le16   handle;
45666c853ccSGustavo F. Padovan } __packed;
457a9de9248SMarcel Holtmann 
458a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
459a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
460a9de9248SMarcel Holtmann 	__le16   handle;
461a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
462a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
463a9de9248SMarcel Holtmann 	__le16   max_latency;
464a9de9248SMarcel Holtmann 	__le16   voice_setting;
465a9de9248SMarcel Holtmann 	__u8     retrans_effort;
466a9de9248SMarcel Holtmann 	__le16   pkt_type;
46766c853ccSGustavo F. Padovan } __packed;
468a9de9248SMarcel Holtmann 
469a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
470a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
471a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
472a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
473a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
474a9de9248SMarcel Holtmann 	__le16   max_latency;
475a9de9248SMarcel Holtmann 	__le16   content_format;
476a9de9248SMarcel Holtmann 	__u8     retrans_effort;
477a9de9248SMarcel Holtmann 	__le16   pkt_type;
47866c853ccSGustavo F. Padovan } __packed;
479a9de9248SMarcel Holtmann 
480a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
481a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
482a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
483a9de9248SMarcel Holtmann 	__u8     reason;
48466c853ccSGustavo F. Padovan } __packed;
485a9de9248SMarcel Holtmann 
48617fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
48717fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
48817fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
48917fa4b9dSJohan Hedberg 	__u8     capability;
49017fa4b9dSJohan Hedberg 	__u8     oob_data;
49117fa4b9dSJohan Hedberg 	__u8     authentication;
49217fa4b9dSJohan Hedberg } __packed;
49317fa4b9dSJohan Hedberg 
494a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
495a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
496a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
497a5c29683SJohan Hedberg } __packed;
498a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
499a5c29683SJohan Hedberg 	__u8     status;
500a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
501a5c29683SJohan Hedberg } __packed;
502a5c29683SJohan Hedberg 
503a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
504a5c29683SJohan Hedberg 
5059ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5069ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5079ad4019aSBrian Gix 	bdaddr_t bdaddr;
5089ad4019aSBrian Gix 	__le32	passkey;
5099ad4019aSBrian Gix } __packed;
5109ad4019aSBrian Gix 
5119ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5129ad4019aSBrian Gix 
5132763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5142763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5152763eda6SSzymon Janc 	bdaddr_t bdaddr;
5162763eda6SSzymon Janc 	__u8     hash[16];
5172763eda6SSzymon Janc 	__u8     randomizer[16];
5182763eda6SSzymon Janc } __packed;
5192763eda6SSzymon Janc 
5202763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5212763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5222763eda6SSzymon Janc 	bdaddr_t bdaddr;
5232763eda6SSzymon Janc } __packed;
5242763eda6SSzymon Janc 
52503b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
52603b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
52703b555e1SJohan Hedberg 	bdaddr_t bdaddr;
52803b555e1SJohan Hedberg 	__u8     reason;
52903b555e1SJohan Hedberg } __packed;
53003b555e1SJohan Hedberg 
531523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
532523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
533523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
534523e93cdSAndrei Emeltchenko 	__u8     key_len;
535523e93cdSAndrei Emeltchenko 	__u8     key_type;
536523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
537523e93cdSAndrei Emeltchenko } __packed;
538523e93cdSAndrei Emeltchenko 
539523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
540523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
541523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
542523e93cdSAndrei Emeltchenko 	__u8     key_len;
543523e93cdSAndrei Emeltchenko 	__u8     key_type;
544523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
545523e93cdSAndrei Emeltchenko } __packed;
546523e93cdSAndrei Emeltchenko 
547523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK	0x0437
548523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
549523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
550523e93cdSAndrei Emeltchenko 	__u8     reason;
551523e93cdSAndrei Emeltchenko } __packed;
552523e93cdSAndrei Emeltchenko 
553a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
554a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
555a9de9248SMarcel Holtmann 	__le16   handle;
556a9de9248SMarcel Holtmann 	__le16   max_interval;
557a9de9248SMarcel Holtmann 	__le16   min_interval;
558a9de9248SMarcel Holtmann 	__le16   attempt;
559a9de9248SMarcel Holtmann 	__le16   timeout;
56066c853ccSGustavo F. Padovan } __packed;
561a9de9248SMarcel Holtmann 
562a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
563a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
564a9de9248SMarcel Holtmann 	__le16   handle;
56566c853ccSGustavo F. Padovan } __packed;
566a9de9248SMarcel Holtmann 
567a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
568a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
569a9de9248SMarcel Holtmann 	__le16   handle;
57066c853ccSGustavo F. Padovan } __packed;
571a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
572a9de9248SMarcel Holtmann 	__u8     status;
573a9de9248SMarcel Holtmann 	__le16   handle;
574a9de9248SMarcel Holtmann 	__u8     role;
57566c853ccSGustavo F. Padovan } __packed;
576a9de9248SMarcel Holtmann 
577a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
578a9de9248SMarcel Holtmann struct hci_cp_switch_role {
579a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
580a9de9248SMarcel Holtmann 	__u8     role;
58166c853ccSGustavo F. Padovan } __packed;
582a9de9248SMarcel Holtmann 
583a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
584a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
585a9de9248SMarcel Holtmann 	__le16   handle;
58666c853ccSGustavo F. Padovan } __packed;
587a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
588a9de9248SMarcel Holtmann 	__u8     status;
589a9de9248SMarcel Holtmann 	__le16   handle;
590a9de9248SMarcel Holtmann 	__le16   policy;
59166c853ccSGustavo F. Padovan } __packed;
592a9de9248SMarcel Holtmann 
593a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
594a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
595a9de9248SMarcel Holtmann 	__le16   handle;
596a9de9248SMarcel Holtmann 	__le16   policy;
59766c853ccSGustavo F. Padovan } __packed;
598a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
599a9de9248SMarcel Holtmann 	__u8     status;
600a9de9248SMarcel Holtmann 	__le16   handle;
60166c853ccSGustavo F. Padovan } __packed;
602a9de9248SMarcel Holtmann 
603e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
604e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
605e4e8e37cSMarcel Holtmann 	__u8     status;
606e4e8e37cSMarcel Holtmann 	__le16   policy;
60766c853ccSGustavo F. Padovan } __packed;
608e4e8e37cSMarcel Holtmann 
609e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
610e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
611e4e8e37cSMarcel Holtmann 	__le16   policy;
61266c853ccSGustavo F. Padovan } __packed;
613e4e8e37cSMarcel Holtmann 
614a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
615a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
616a9de9248SMarcel Holtmann 	__le16   handle;
617a9de9248SMarcel Holtmann 	__le16   max_latency;
618a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
619a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
62066c853ccSGustavo F. Padovan } __packed;
621a9de9248SMarcel Holtmann 
622a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
623a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
624a9de9248SMarcel Holtmann 	__u8     mask[8];
62566c853ccSGustavo F. Padovan } __packed;
626a9de9248SMarcel Holtmann 
627a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
628a9de9248SMarcel Holtmann 
629a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
6301da177e4SLinus Torvalds struct hci_cp_set_event_flt {
6311da177e4SLinus Torvalds 	__u8     flt_type;
6321da177e4SLinus Torvalds 	__u8     cond_type;
6331da177e4SLinus Torvalds 	__u8     condition[0];
63466c853ccSGustavo F. Padovan } __packed;
6351da177e4SLinus Torvalds 
6361da177e4SLinus Torvalds /* Filter types */
6371da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
6381da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
6391da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
6401da177e4SLinus Torvalds 
6411da177e4SLinus Torvalds /* CONN_SETUP Condition types */
6421da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
6431da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
6441da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
6451da177e4SLinus Torvalds 
6461da177e4SLinus Torvalds /* CONN_SETUP Conditions */
6471da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
6481da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
6491da177e4SLinus Torvalds 
650b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
651b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
652b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
653b0916ea0SJohan Hedberg 	__u8     delete_all;
654b0916ea0SJohan Hedberg } __packed;
655b0916ea0SJohan Hedberg 
6561f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
6571f6c6378SJohan Hedberg 
658a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
659a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
6601f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
66166c853ccSGustavo F. Padovan } __packed;
662a9de9248SMarcel Holtmann 
663a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
664a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
665a9de9248SMarcel Holtmann 	__u8     status;
6661f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
66766c853ccSGustavo F. Padovan } __packed;
668a9de9248SMarcel Holtmann 
669a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
670a9de9248SMarcel Holtmann 
671a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
672a9de9248SMarcel Holtmann 
673a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
674a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
675a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
676a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
677a9de9248SMarcel Holtmann 
678a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
679a9de9248SMarcel Holtmann 
680a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
681a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
682a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
683a9de9248SMarcel Holtmann 
684a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
685a9de9248SMarcel Holtmann 
686a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
687a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
688a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
689a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
690a9de9248SMarcel Holtmann 
691a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
692a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
6931da177e4SLinus Torvalds 	__u8     status;
6941da177e4SLinus Torvalds 	__u8     dev_class[3];
69566c853ccSGustavo F. Padovan } __packed;
6961da177e4SLinus Torvalds 
697a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
698a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
6991da177e4SLinus Torvalds 	__u8     dev_class[3];
70066c853ccSGustavo F. Padovan } __packed;
7011da177e4SLinus Torvalds 
702a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
7031da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
7041da177e4SLinus Torvalds 	__u8     status;
7051ebb9252SMarcel Holtmann 	__le16   voice_setting;
70666c853ccSGustavo F. Padovan } __packed;
7071da177e4SLinus Torvalds 
708a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
7091da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
7101ebb9252SMarcel Holtmann 	__le16   voice_setting;
71166c853ccSGustavo F. Padovan } __packed;
7121da177e4SLinus Torvalds 
713a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
7141da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
7151ebb9252SMarcel Holtmann 	__le16   acl_mtu;
7161da177e4SLinus Torvalds 	__u8     sco_mtu;
7171ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
7181ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
71966c853ccSGustavo F. Padovan } __packed;
7201da177e4SLinus Torvalds 
721d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
722d5859e22SJohan Hedberg 
72380a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
72480a1e1dbSJohan Hedberg 
72580a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
72680a1e1dbSJohan Hedberg struct hci_cp_write_eir {
727816a11d5SJohan Hedberg 	__u8	fec;
728816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
72980a1e1dbSJohan Hedberg } __packed;
73080a1e1dbSJohan Hedberg 
731333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
732333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
733333140b5SMarcel Holtmann 	__u8     status;
734333140b5SMarcel Holtmann 	__u8     mode;
73566c853ccSGustavo F. Padovan } __packed;
736333140b5SMarcel Holtmann 
737333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
738333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
739333140b5SMarcel Holtmann 	__u8     mode;
74066c853ccSGustavo F. Padovan } __packed;
741333140b5SMarcel Holtmann 
742c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
743c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
744c35938b2SSzymon Janc 	__u8     status;
745c35938b2SSzymon Janc 	__u8     hash[16];
746c35938b2SSzymon Janc 	__u8     randomizer[16];
747c35938b2SSzymon Janc } __packed;
748c35938b2SSzymon Janc 
749d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
75091c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
75191c4e9b1SMarcel Holtmann 	__u8     status;
75291c4e9b1SMarcel Holtmann 	__s8     tx_power;
75391c4e9b1SMarcel Holtmann } __packed;
754d5859e22SJohan Hedberg 
7551e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
7561e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
7571e89cffbSAndrei Emeltchenko 	__u8     status;
7581e89cffbSAndrei Emeltchenko 	__u8     mode;
7591e89cffbSAndrei Emeltchenko } __packed;
7601e89cffbSAndrei Emeltchenko 
761f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
762f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
763f9b49306SAndre Guedes 	__u8	le;
764f9b49306SAndre Guedes 	__u8	simul;
765f9b49306SAndre Guedes } __packed;
766f9b49306SAndre Guedes 
767a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
768a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
7691da177e4SLinus Torvalds 	__u8     status;
770a9de9248SMarcel Holtmann 	__u8     hci_ver;
771a9de9248SMarcel Holtmann 	__le16   hci_rev;
772a9de9248SMarcel Holtmann 	__u8     lmp_ver;
773a9de9248SMarcel Holtmann 	__le16   manufacturer;
774a9de9248SMarcel Holtmann 	__le16   lmp_subver;
77566c853ccSGustavo F. Padovan } __packed;
7761da177e4SLinus Torvalds 
777a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
778a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
7791da177e4SLinus Torvalds 	__u8     status;
780a9de9248SMarcel Holtmann 	__u8     commands[64];
78166c853ccSGustavo F. Padovan } __packed;
7821da177e4SLinus Torvalds 
783a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
784a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
785a9de9248SMarcel Holtmann 	__u8     status;
786a9de9248SMarcel Holtmann 	__u8     features[8];
78766c853ccSGustavo F. Padovan } __packed;
788a9de9248SMarcel Holtmann 
789a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
790971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
791971e3a4bSAndre Guedes 	__u8     page;
792971e3a4bSAndre Guedes } __packed;
793a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
794a9de9248SMarcel Holtmann 	__u8     status;
795a9de9248SMarcel Holtmann 	__u8     page;
796a9de9248SMarcel Holtmann 	__u8     max_page;
797a9de9248SMarcel Holtmann 	__u8     features[8];
79866c853ccSGustavo F. Padovan } __packed;
799a9de9248SMarcel Holtmann 
800a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
801a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
802a9de9248SMarcel Holtmann 	__u8     status;
803a9de9248SMarcel Holtmann 	__le16   acl_mtu;
804a9de9248SMarcel Holtmann 	__u8     sco_mtu;
805a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
806a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
80766c853ccSGustavo F. Padovan } __packed;
808a9de9248SMarcel Holtmann 
809a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
810a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
811a9de9248SMarcel Holtmann 	__u8     status;
8121da177e4SLinus Torvalds 	bdaddr_t bdaddr;
81366c853ccSGustavo F. Padovan } __packed;
8141da177e4SLinus Torvalds 
815350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
816350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
817350ee4cfSAndrei Emeltchenko 	__u8     status;
818350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
819350ee4cfSAndrei Emeltchenko 	__le16   block_len;
820350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
821350ee4cfSAndrei Emeltchenko } __packed;
822350ee4cfSAndrei Emeltchenko 
823f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
824f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
825f6422ec6SAntti Julku 	__le16   interval;
826f6422ec6SAntti Julku 	__le16   window;
827f6422ec6SAntti Julku } __packed;
828f6422ec6SAntti Julku 
829f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
830f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
831f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
832f6422ec6SAntti Julku 
833928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
834928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
835928abaa7SAndrei Emeltchenko 	__u8     status;
836928abaa7SAndrei Emeltchenko 	__u8     amp_status;
837928abaa7SAndrei Emeltchenko 	__le32   total_bw;
838928abaa7SAndrei Emeltchenko 	__le32   max_bw;
839928abaa7SAndrei Emeltchenko 	__le32   min_latency;
840928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
841928abaa7SAndrei Emeltchenko 	__u8     amp_type;
842928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
843928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
844928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
845928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
846928abaa7SAndrei Emeltchenko } __packed;
847928abaa7SAndrei Emeltchenko 
848523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
849523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
850523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
851523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
852523e93cdSAndrei Emeltchenko 	__le16   max_len;
853523e93cdSAndrei Emeltchenko } __packed;
854523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
855523e93cdSAndrei Emeltchenko 	__u8     status;
856523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
857523e93cdSAndrei Emeltchenko 	__le16   rem_len;
858523e93cdSAndrei Emeltchenko 	__u8     frag[0];
859523e93cdSAndrei Emeltchenko } __packed;
860523e93cdSAndrei Emeltchenko 
861523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
862523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
863523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
864523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
865523e93cdSAndrei Emeltchenko 	__le16   rem_len;
866523e93cdSAndrei Emeltchenko 	__u8     frag[0];
867523e93cdSAndrei Emeltchenko } __packed;
868523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
869523e93cdSAndrei Emeltchenko 	__u8     status;
870523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
871523e93cdSAndrei Emeltchenko } __packed;
872523e93cdSAndrei Emeltchenko 
87363185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
87463185f64SVille Tervo struct hci_cp_le_set_event_mask {
87563185f64SVille Tervo 	__u8     mask[8];
87663185f64SVille Tervo } __packed;
87763185f64SVille Tervo 
87863185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
87963185f64SVille Tervo struct hci_rp_le_read_buffer_size {
88063185f64SVille Tervo 	__u8     status;
88163185f64SVille Tervo 	__le16   le_mtu;
88263185f64SVille Tervo 	__u8     le_max_pkt;
88363185f64SVille Tervo } __packed;
88463185f64SVille Tervo 
88507f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
88607f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
88707f7fa5dSAndre Guedes 	__u8    type;
88807f7fa5dSAndre Guedes 	__le16  interval;
88907f7fa5dSAndre Guedes 	__le16  window;
89007f7fa5dSAndre Guedes 	__u8    own_address_type;
89107f7fa5dSAndre Guedes 	__u8    filter_policy;
89207f7fa5dSAndre Guedes } __packed;
89307f7fa5dSAndre Guedes 
89468a8aea4SAndrei Emeltchenko #define LE_SCANNING_DISABLED		0x00
89568a8aea4SAndrei Emeltchenko #define LE_SCANNING_ENABLED		0x01
89668a8aea4SAndrei Emeltchenko 
897eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
898eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
899eb9d91f5SAndre Guedes 	__u8     enable;
900eb9d91f5SAndre Guedes 	__u8     filter_dup;
901eb9d91f5SAndre Guedes } __packed;
902eb9d91f5SAndre Guedes 
90363185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
90463185f64SVille Tervo struct hci_cp_le_create_conn {
90563185f64SVille Tervo 	__le16   scan_interval;
90663185f64SVille Tervo 	__le16   scan_window;
90763185f64SVille Tervo 	__u8     filter_policy;
90863185f64SVille Tervo 	__u8     peer_addr_type;
90963185f64SVille Tervo 	bdaddr_t peer_addr;
91063185f64SVille Tervo 	__u8     own_address_type;
91163185f64SVille Tervo 	__le16   conn_interval_min;
91263185f64SVille Tervo 	__le16   conn_interval_max;
91363185f64SVille Tervo 	__le16   conn_latency;
91463185f64SVille Tervo 	__le16   supervision_timeout;
91563185f64SVille Tervo 	__le16   min_ce_len;
91663185f64SVille Tervo 	__le16   max_ce_len;
91763185f64SVille Tervo } __packed;
91863185f64SVille Tervo 
91963185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
92063185f64SVille Tervo 
9212ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
9222ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
9232ce603ebSClaudio Takahasi 	__le16   handle;
9242ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
9252ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
9262ce603ebSClaudio Takahasi 	__le16   conn_latency;
9272ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
9282ce603ebSClaudio Takahasi 	__le16   min_ce_len;
9292ce603ebSClaudio Takahasi 	__le16   max_ce_len;
9302ce603ebSClaudio Takahasi } __packed;
9312ce603ebSClaudio Takahasi 
932a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
933a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
934a7a595f6SVinicius Costa Gomes 	__le16	handle;
935a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
936a7a595f6SVinicius Costa Gomes 	__le16	ediv;
937a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
938a7a595f6SVinicius Costa Gomes } __packed;
939a7a595f6SVinicius Costa Gomes 
940a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
941a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
942a7a595f6SVinicius Costa Gomes 	__le16	handle;
943a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
944a7a595f6SVinicius Costa Gomes } __packed;
945a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
946a7a595f6SVinicius Costa Gomes 	__u8	status;
947a7a595f6SVinicius Costa Gomes 	__le16	handle;
948a7a595f6SVinicius Costa Gomes } __packed;
949a7a595f6SVinicius Costa Gomes 
950a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
951a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
952a7a595f6SVinicius Costa Gomes 	__le16	handle;
953a7a595f6SVinicius Costa Gomes } __packed;
954a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
955a7a595f6SVinicius Costa Gomes 	__u8	status;
956a7a595f6SVinicius Costa Gomes 	__le16	handle;
957a7a595f6SVinicius Costa Gomes } __packed;
958a7a595f6SVinicius Costa Gomes 
9591da177e4SLinus Torvalds /* ---- HCI Events ---- */
9601da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
9611da177e4SLinus Torvalds 
9621da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
9631da177e4SLinus Torvalds struct inquiry_info {
9641da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9651da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
9661da177e4SLinus Torvalds 	__u8     pscan_period_mode;
9671da177e4SLinus Torvalds 	__u8     pscan_mode;
9681da177e4SLinus Torvalds 	__u8     dev_class[3];
9691ebb9252SMarcel Holtmann 	__le16   clock_offset;
97066c853ccSGustavo F. Padovan } __packed;
9711da177e4SLinus Torvalds 
9721da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
9731da177e4SLinus Torvalds struct hci_ev_conn_complete {
9741da177e4SLinus Torvalds 	__u8     status;
9751ebb9252SMarcel Holtmann 	__le16   handle;
9761da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9771da177e4SLinus Torvalds 	__u8     link_type;
9781da177e4SLinus Torvalds 	__u8     encr_mode;
97966c853ccSGustavo F. Padovan } __packed;
9801da177e4SLinus Torvalds 
9811da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
9821da177e4SLinus Torvalds struct hci_ev_conn_request {
9831da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9841da177e4SLinus Torvalds 	__u8     dev_class[3];
9851da177e4SLinus Torvalds 	__u8     link_type;
98666c853ccSGustavo F. Padovan } __packed;
9871da177e4SLinus Torvalds 
9881da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
9891da177e4SLinus Torvalds struct hci_ev_disconn_complete {
9901da177e4SLinus Torvalds 	__u8     status;
9911ebb9252SMarcel Holtmann 	__le16   handle;
9921da177e4SLinus Torvalds 	__u8     reason;
99366c853ccSGustavo F. Padovan } __packed;
9941da177e4SLinus Torvalds 
9951da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
9961da177e4SLinus Torvalds struct hci_ev_auth_complete {
9971da177e4SLinus Torvalds 	__u8     status;
9981ebb9252SMarcel Holtmann 	__le16   handle;
99966c853ccSGustavo F. Padovan } __packed;
10001da177e4SLinus Torvalds 
1001a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1002a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1003a9de9248SMarcel Holtmann 	__u8     status;
1004a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
10051f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
100666c853ccSGustavo F. Padovan } __packed;
1007a9de9248SMarcel Holtmann 
10081da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
10091da177e4SLinus Torvalds struct hci_ev_encrypt_change {
10101da177e4SLinus Torvalds 	__u8     status;
10111ebb9252SMarcel Holtmann 	__le16   handle;
10121da177e4SLinus Torvalds 	__u8     encrypt;
101366c853ccSGustavo F. Padovan } __packed;
10141da177e4SLinus Torvalds 
1015a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1016a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
10171da177e4SLinus Torvalds 	__u8     status;
10181ebb9252SMarcel Holtmann 	__le16   handle;
101966c853ccSGustavo F. Padovan } __packed;
10201da177e4SLinus Torvalds 
1021a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1022a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1023a9de9248SMarcel Holtmann 	__u8     status;
1024a9de9248SMarcel Holtmann 	__le16   handle;
1025a9de9248SMarcel Holtmann 	__u8     features[8];
102666c853ccSGustavo F. Padovan } __packed;
1027a9de9248SMarcel Holtmann 
1028a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1029a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1030a9de9248SMarcel Holtmann 	__u8     status;
1031a9de9248SMarcel Holtmann 	__le16   handle;
1032a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1033a9de9248SMarcel Holtmann 	__le16   manufacturer;
1034a9de9248SMarcel Holtmann 	__le16   lmp_subver;
103566c853ccSGustavo F. Padovan } __packed;
1036a9de9248SMarcel Holtmann 
1037a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
10381da177e4SLinus Torvalds struct hci_qos {
10391da177e4SLinus Torvalds 	__u8     service_type;
10401da177e4SLinus Torvalds 	__u32    token_rate;
10411da177e4SLinus Torvalds 	__u32    peak_bandwidth;
10421da177e4SLinus Torvalds 	__u32    latency;
10431da177e4SLinus Torvalds 	__u32    delay_variation;
104466c853ccSGustavo F. Padovan } __packed;
10451da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
10461da177e4SLinus Torvalds 	__u8     status;
10471ebb9252SMarcel Holtmann 	__le16   handle;
10481da177e4SLinus Torvalds 	struct   hci_qos qos;
104966c853ccSGustavo F. Padovan } __packed;
10501da177e4SLinus Torvalds 
1051a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
10521da177e4SLinus Torvalds struct hci_ev_cmd_complete {
10531da177e4SLinus Torvalds 	__u8     ncmd;
10541ebb9252SMarcel Holtmann 	__le16   opcode;
105566c853ccSGustavo F. Padovan } __packed;
10561da177e4SLinus Torvalds 
1057a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
10581da177e4SLinus Torvalds struct hci_ev_cmd_status {
10591da177e4SLinus Torvalds 	__u8     status;
10601da177e4SLinus Torvalds 	__u8     ncmd;
10611ebb9252SMarcel Holtmann 	__le16   opcode;
106266c853ccSGustavo F. Padovan } __packed;
10631da177e4SLinus Torvalds 
10641da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
10651da177e4SLinus Torvalds struct hci_ev_role_change {
10661da177e4SLinus Torvalds 	__u8     status;
10671da177e4SLinus Torvalds 	bdaddr_t bdaddr;
10681da177e4SLinus Torvalds 	__u8     role;
106966c853ccSGustavo F. Padovan } __packed;
10701da177e4SLinus Torvalds 
1071a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1072613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1073613a1c0cSAndrei Emeltchenko 	__le16   handle;
1074613a1c0cSAndrei Emeltchenko 	__le16   count;
1075613a1c0cSAndrei Emeltchenko } __packed;
1076613a1c0cSAndrei Emeltchenko 
1077a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1078a9de9248SMarcel Holtmann 	__u8     num_hndl;
1079613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
108066c853ccSGustavo F. Padovan } __packed;
1081a9de9248SMarcel Holtmann 
10821da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
10831da177e4SLinus Torvalds struct hci_ev_mode_change {
10841da177e4SLinus Torvalds 	__u8     status;
10851ebb9252SMarcel Holtmann 	__le16   handle;
10861da177e4SLinus Torvalds 	__u8     mode;
10871ebb9252SMarcel Holtmann 	__le16   interval;
108866c853ccSGustavo F. Padovan } __packed;
10891da177e4SLinus Torvalds 
10901da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
10911da177e4SLinus Torvalds struct hci_ev_pin_code_req {
10921da177e4SLinus Torvalds 	bdaddr_t bdaddr;
109366c853ccSGustavo F. Padovan } __packed;
10941da177e4SLinus Torvalds 
10951da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
10961da177e4SLinus Torvalds struct hci_ev_link_key_req {
10971da177e4SLinus Torvalds 	bdaddr_t bdaddr;
109866c853ccSGustavo F. Padovan } __packed;
10991da177e4SLinus Torvalds 
11001da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
11011da177e4SLinus Torvalds struct hci_ev_link_key_notify {
11021da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11039b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
11041da177e4SLinus Torvalds 	__u8     key_type;
110566c853ccSGustavo F. Padovan } __packed;
11061da177e4SLinus Torvalds 
1107a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
11081da177e4SLinus Torvalds struct hci_ev_clock_offset {
11091da177e4SLinus Torvalds 	__u8     status;
11101ebb9252SMarcel Holtmann 	__le16   handle;
11111ebb9252SMarcel Holtmann 	__le16   clock_offset;
111266c853ccSGustavo F. Padovan } __packed;
11131da177e4SLinus Torvalds 
1114a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1115a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1116a8746417SMarcel Holtmann 	__u8     status;
1117a8746417SMarcel Holtmann 	__le16   handle;
1118a8746417SMarcel Holtmann 	__le16   pkt_type;
111966c853ccSGustavo F. Padovan } __packed;
1120a8746417SMarcel Holtmann 
112185a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
112285a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
112385a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
112485a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
112566c853ccSGustavo F. Padovan } __packed;
112685a1e930SMarcel Holtmann 
1127a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1128a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1129a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1130a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1131a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1132a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1133a9de9248SMarcel Holtmann 	__le16   clock_offset;
1134a9de9248SMarcel Holtmann 	__s8     rssi;
113566c853ccSGustavo F. Padovan } __packed;
1136a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1137a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1138a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1139a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1140a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1141a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1142a9de9248SMarcel Holtmann 	__le16   clock_offset;
1143a9de9248SMarcel Holtmann 	__s8     rssi;
114466c853ccSGustavo F. Padovan } __packed;
1145a9de9248SMarcel Holtmann 
1146a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1147a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1148a9de9248SMarcel Holtmann 	__u8     status;
1149a9de9248SMarcel Holtmann 	__le16   handle;
1150a9de9248SMarcel Holtmann 	__u8     page;
1151a9de9248SMarcel Holtmann 	__u8     max_page;
1152a9de9248SMarcel Holtmann 	__u8     features[8];
115366c853ccSGustavo F. Padovan } __packed;
1154a9de9248SMarcel Holtmann 
1155a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1156a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1157a9de9248SMarcel Holtmann 	__u8     status;
1158a9de9248SMarcel Holtmann 	__le16   handle;
1159a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1160a9de9248SMarcel Holtmann 	__u8     link_type;
1161a9de9248SMarcel Holtmann 	__u8     tx_interval;
1162a9de9248SMarcel Holtmann 	__u8     retrans_window;
1163a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1164a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1165a9de9248SMarcel Holtmann 	__u8     air_mode;
116666c853ccSGustavo F. Padovan } __packed;
1167a9de9248SMarcel Holtmann 
1168a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1169a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1170a9de9248SMarcel Holtmann 	__u8     status;
1171a9de9248SMarcel Holtmann 	__le16   handle;
1172a9de9248SMarcel Holtmann 	__u8     tx_interval;
1173a9de9248SMarcel Holtmann 	__u8     retrans_window;
1174a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1175a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
117666c853ccSGustavo F. Padovan } __packed;
1177a9de9248SMarcel Holtmann 
1178a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
117904837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
118004837f64SMarcel Holtmann 	__u8     status;
118104837f64SMarcel Holtmann 	__le16   handle;
118204837f64SMarcel Holtmann 	__le16   max_tx_latency;
118304837f64SMarcel Holtmann 	__le16   max_rx_latency;
118404837f64SMarcel Holtmann 	__le16   max_remote_timeout;
118504837f64SMarcel Holtmann 	__le16   max_local_timeout;
118666c853ccSGustavo F. Padovan } __packed;
118704837f64SMarcel Holtmann 
1188a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1189a9de9248SMarcel Holtmann struct extended_inquiry_info {
1190a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1191a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1192a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1193a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1194a9de9248SMarcel Holtmann 	__le16   clock_offset;
1195a9de9248SMarcel Holtmann 	__s8     rssi;
1196a9de9248SMarcel Holtmann 	__u8     data[240];
119766c853ccSGustavo F. Padovan } __packed;
1198a9de9248SMarcel Holtmann 
11991c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
12001c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
12011c2e0041SJohan Hedberg 	__u8	status;
12021c2e0041SJohan Hedberg 	__le16	handle;
12031c2e0041SJohan Hedberg } __packed;
12041c2e0041SJohan Hedberg 
12050493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
12060493684eSMarcel Holtmann struct hci_ev_io_capa_request {
12070493684eSMarcel Holtmann 	bdaddr_t bdaddr;
120866c853ccSGustavo F. Padovan } __packed;
12090493684eSMarcel Holtmann 
121003b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
121103b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
121203b555e1SJohan Hedberg 	bdaddr_t bdaddr;
121303b555e1SJohan Hedberg 	__u8     capability;
121403b555e1SJohan Hedberg 	__u8     oob_data;
121503b555e1SJohan Hedberg 	__u8     authentication;
121603b555e1SJohan Hedberg } __packed;
121703b555e1SJohan Hedberg 
1218a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1219a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1220a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1221a5c29683SJohan Hedberg 	__le32		passkey;
1222a5c29683SJohan Hedberg } __packed;
1223a5c29683SJohan Hedberg 
12249ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
12259ad4019aSBrian Gix struct hci_ev_user_passkey_req {
12269ad4019aSBrian Gix 	bdaddr_t	bdaddr;
12279ad4019aSBrian Gix } __packed;
12289ad4019aSBrian Gix 
12292763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
12302763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
12312763eda6SSzymon Janc 	bdaddr_t bdaddr;
12322763eda6SSzymon Janc } __packed;
12332763eda6SSzymon Janc 
12340493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
12350493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
12360493684eSMarcel Holtmann 	__u8     status;
12370493684eSMarcel Holtmann 	bdaddr_t bdaddr;
123866c853ccSGustavo F. Padovan } __packed;
12390493684eSMarcel Holtmann 
124041a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
124141a96212SMarcel Holtmann struct hci_ev_remote_host_features {
124241a96212SMarcel Holtmann 	bdaddr_t bdaddr;
124341a96212SMarcel Holtmann 	__u8     features[8];
124466c853ccSGustavo F. Padovan } __packed;
124541a96212SMarcel Holtmann 
124663185f64SVille Tervo #define HCI_EV_LE_META			0x3e
124763185f64SVille Tervo struct hci_ev_le_meta {
124863185f64SVille Tervo 	__u8     subevent;
124963185f64SVille Tervo } __packed;
125063185f64SVille Tervo 
1251523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1252523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1253523e93cdSAndrei Emeltchenko 	__u8     status;
1254523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1255523e93cdSAndrei Emeltchenko } __packed;
1256523e93cdSAndrei Emeltchenko 
1257523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1258523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1259523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1260523e93cdSAndrei Emeltchenko } __packed;
1261523e93cdSAndrei Emeltchenko 
1262523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1263523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1264523e93cdSAndrei Emeltchenko 	__u8     status;
1265523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1266523e93cdSAndrei Emeltchenko 	__u8     reason;
1267523e93cdSAndrei Emeltchenko } __packed;
1268523e93cdSAndrei Emeltchenko 
1269523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1270523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1271523e93cdSAndrei Emeltchenko 	__u8     status;
1272523e93cdSAndrei Emeltchenko 	__le16   handle;
1273523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1274523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1275523e93cdSAndrei Emeltchenko } __packed;
1276523e93cdSAndrei Emeltchenko 
1277523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1278523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1279523e93cdSAndrei Emeltchenko 	__u8     status;
1280523e93cdSAndrei Emeltchenko 	__le16   handle;
1281523e93cdSAndrei Emeltchenko 	__u8     reason;
1282523e93cdSAndrei Emeltchenko } __packed;
1283523e93cdSAndrei Emeltchenko 
128425e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
128525e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
128625e89e99SAndrei Emeltchenko 	__le16   handle;
128725e89e99SAndrei Emeltchenko 	__le16   pkts;
128825e89e99SAndrei Emeltchenko 	__le16   blocks;
128925e89e99SAndrei Emeltchenko } __packed;
129025e89e99SAndrei Emeltchenko 
129125e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
129225e89e99SAndrei Emeltchenko 	__le16   num_blocks;
129325e89e99SAndrei Emeltchenko 	__u8     num_hndl;
129425e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
129525e89e99SAndrei Emeltchenko } __packed;
129625e89e99SAndrei Emeltchenko 
129763185f64SVille Tervo /* Low energy meta events */
129863185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
129963185f64SVille Tervo struct hci_ev_le_conn_complete {
130063185f64SVille Tervo 	__u8     status;
130163185f64SVille Tervo 	__le16   handle;
130263185f64SVille Tervo 	__u8     role;
130363185f64SVille Tervo 	__u8     bdaddr_type;
130463185f64SVille Tervo 	bdaddr_t bdaddr;
130563185f64SVille Tervo 	__le16   interval;
130663185f64SVille Tervo 	__le16   latency;
130763185f64SVille Tervo 	__le16   supervision_timeout;
130863185f64SVille Tervo 	__u8     clk_accurancy;
130963185f64SVille Tervo } __packed;
131063185f64SVille Tervo 
1311a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1312a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1313a7a595f6SVinicius Costa Gomes 	__le16	handle;
1314a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1315a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1316a7a595f6SVinicius Costa Gomes } __packed;
1317a7a595f6SVinicius Costa Gomes 
131857a56fd4SAnderson Briglia /* Advertising report event types */
131957a56fd4SAnderson Briglia #define ADV_IND		0x00
132057a56fd4SAnderson Briglia #define ADV_DIRECT_IND	0x01
132157a56fd4SAnderson Briglia #define ADV_SCAN_IND	0x02
132257a56fd4SAnderson Briglia #define ADV_NONCONN_IND	0x03
132357a56fd4SAnderson Briglia #define ADV_SCAN_RSP	0x04
132457a56fd4SAnderson Briglia 
132557a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
132657a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
132757a56fd4SAnderson Briglia 
132857a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
132957a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
133057a56fd4SAnderson Briglia 	__u8	 evt_type;
133157a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
133257a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
133357a56fd4SAnderson Briglia 	__u8	 length;
133457a56fd4SAnderson Briglia 	__u8	 data[0];
133557a56fd4SAnderson Briglia } __packed;
133657a56fd4SAnderson Briglia 
13371da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1338a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
13391da177e4SLinus Torvalds struct hci_ev_stack_internal {
13401da177e4SLinus Torvalds 	__u16    type;
13411da177e4SLinus Torvalds 	__u8     data[0];
134266c853ccSGustavo F. Padovan } __packed;
13431da177e4SLinus Torvalds 
13441da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
13451da177e4SLinus Torvalds struct hci_ev_si_device {
13461da177e4SLinus Torvalds 	__u16    event;
13471da177e4SLinus Torvalds 	__u16    dev_id;
134866c853ccSGustavo F. Padovan } __packed;
13491da177e4SLinus Torvalds 
13501da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
13511da177e4SLinus Torvalds struct hci_ev_si_security {
13521da177e4SLinus Torvalds 	__u16    event;
13531da177e4SLinus Torvalds 	__u16    proto;
13541da177e4SLinus Torvalds 	__u16    subproto;
13551da177e4SLinus Torvalds 	__u8     incoming;
135666c853ccSGustavo F. Padovan } __packed;
13571da177e4SLinus Torvalds 
13581da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
13591da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
13601da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
13611da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
13621da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
13631da177e4SLinus Torvalds 
13641da177e4SLinus Torvalds struct hci_command_hdr {
13651ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
13661da177e4SLinus Torvalds 	__u8	plen;
136766c853ccSGustavo F. Padovan } __packed;
13681da177e4SLinus Torvalds 
13691da177e4SLinus Torvalds struct hci_event_hdr {
13701da177e4SLinus Torvalds 	__u8	evt;
13711da177e4SLinus Torvalds 	__u8	plen;
137266c853ccSGustavo F. Padovan } __packed;
13731da177e4SLinus Torvalds 
13741da177e4SLinus Torvalds struct hci_acl_hdr {
13751ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
13761ebb9252SMarcel Holtmann 	__le16	dlen;
137766c853ccSGustavo F. Padovan } __packed;
13781da177e4SLinus Torvalds 
13791da177e4SLinus Torvalds struct hci_sco_hdr {
13801ebb9252SMarcel Holtmann 	__le16	handle;
13811da177e4SLinus Torvalds 	__u8	dlen;
138266c853ccSGustavo F. Padovan } __packed;
13831da177e4SLinus Torvalds 
13842a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
13852a123b86SArnaldo Carvalho de Melo {
13862a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
13872a123b86SArnaldo Carvalho de Melo }
13882a123b86SArnaldo Carvalho de Melo 
13892a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
13902a123b86SArnaldo Carvalho de Melo {
13912a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
13922a123b86SArnaldo Carvalho de Melo }
13932a123b86SArnaldo Carvalho de Melo 
13942a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
13952a123b86SArnaldo Carvalho de Melo {
13962a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
13972a123b86SArnaldo Carvalho de Melo }
13982a123b86SArnaldo Carvalho de Melo 
13991da177e4SLinus Torvalds /* Command opcode pack/unpack */
1400c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
14011da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
14021da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
14031da177e4SLinus Torvalds 
14041da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1405c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
14061da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
14071da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
14081da177e4SLinus Torvalds 
14091da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
14101da177e4SLinus Torvalds 
14111da177e4SLinus Torvalds /* Socket options */
14121da177e4SLinus Torvalds #define HCI_DATA_DIR	1
14131da177e4SLinus Torvalds #define HCI_FILTER	2
14141da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
14151da177e4SLinus Torvalds 
14161da177e4SLinus Torvalds /* CMSG flags */
14171da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
14181da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
14191da177e4SLinus Torvalds 
14201da177e4SLinus Torvalds struct sockaddr_hci {
14211da177e4SLinus Torvalds 	sa_family_t    hci_family;
14221da177e4SLinus Torvalds 	unsigned short hci_dev;
1423c02178d2SJohan Hedberg 	unsigned short hci_channel;
14241da177e4SLinus Torvalds };
14251da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
14261da177e4SLinus Torvalds 
1427c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1428cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
142966f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1430c02178d2SJohan Hedberg 
14311da177e4SLinus Torvalds struct hci_filter {
14321da177e4SLinus Torvalds 	unsigned long type_mask;
14331da177e4SLinus Torvalds 	unsigned long event_mask[2];
1434905f3ed6SAl Viro 	__le16 opcode;
14351da177e4SLinus Torvalds };
14361da177e4SLinus Torvalds 
14371da177e4SLinus Torvalds struct hci_ufilter {
14381da177e4SLinus Torvalds 	__u32  type_mask;
14391da177e4SLinus Torvalds 	__u32  event_mask[2];
1440905f3ed6SAl Viro 	__le16 opcode;
14411da177e4SLinus Torvalds };
14421da177e4SLinus Torvalds 
14431da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
14441da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
14451da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
14461da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
14471da177e4SLinus Torvalds 
14481da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
14491da177e4SLinus Torvalds struct hci_dev_stats {
14501da177e4SLinus Torvalds 	__u32 err_rx;
14511da177e4SLinus Torvalds 	__u32 err_tx;
14521da177e4SLinus Torvalds 	__u32 cmd_tx;
14531da177e4SLinus Torvalds 	__u32 evt_rx;
14541da177e4SLinus Torvalds 	__u32 acl_tx;
14551da177e4SLinus Torvalds 	__u32 acl_rx;
14561da177e4SLinus Torvalds 	__u32 sco_tx;
14571da177e4SLinus Torvalds 	__u32 sco_rx;
14581da177e4SLinus Torvalds 	__u32 byte_rx;
14591da177e4SLinus Torvalds 	__u32 byte_tx;
14601da177e4SLinus Torvalds };
14611da177e4SLinus Torvalds 
14621da177e4SLinus Torvalds struct hci_dev_info {
14631da177e4SLinus Torvalds 	__u16 dev_id;
14641da177e4SLinus Torvalds 	char  name[8];
14651da177e4SLinus Torvalds 
14661da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14671da177e4SLinus Torvalds 
14681da177e4SLinus Torvalds 	__u32 flags;
14691da177e4SLinus Torvalds 	__u8  type;
14701da177e4SLinus Torvalds 
14711da177e4SLinus Torvalds 	__u8  features[8];
14721da177e4SLinus Torvalds 
14731da177e4SLinus Torvalds 	__u32 pkt_type;
14741da177e4SLinus Torvalds 	__u32 link_policy;
14751da177e4SLinus Torvalds 	__u32 link_mode;
14761da177e4SLinus Torvalds 
14771da177e4SLinus Torvalds 	__u16 acl_mtu;
14781da177e4SLinus Torvalds 	__u16 acl_pkts;
14791da177e4SLinus Torvalds 	__u16 sco_mtu;
14801da177e4SLinus Torvalds 	__u16 sco_pkts;
14811da177e4SLinus Torvalds 
14821da177e4SLinus Torvalds 	struct hci_dev_stats stat;
14831da177e4SLinus Torvalds };
14841da177e4SLinus Torvalds 
14851da177e4SLinus Torvalds struct hci_conn_info {
14861da177e4SLinus Torvalds 	__u16    handle;
14871da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14881da177e4SLinus Torvalds 	__u8     type;
14891da177e4SLinus Torvalds 	__u8     out;
14901da177e4SLinus Torvalds 	__u16    state;
14911da177e4SLinus Torvalds 	__u32    link_mode;
14921da177e4SLinus Torvalds };
14931da177e4SLinus Torvalds 
14941da177e4SLinus Torvalds struct hci_dev_req {
14951da177e4SLinus Torvalds 	__u16  dev_id;
14961da177e4SLinus Torvalds 	__u32  dev_opt;
14971da177e4SLinus Torvalds };
14981da177e4SLinus Torvalds 
14991da177e4SLinus Torvalds struct hci_dev_list_req {
15001da177e4SLinus Torvalds 	__u16  dev_num;
15011da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
15021da177e4SLinus Torvalds };
15031da177e4SLinus Torvalds 
15041da177e4SLinus Torvalds struct hci_conn_list_req {
15051da177e4SLinus Torvalds 	__u16  dev_id;
15061da177e4SLinus Torvalds 	__u16  conn_num;
15071da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
15081da177e4SLinus Torvalds };
15091da177e4SLinus Torvalds 
15101da177e4SLinus Torvalds struct hci_conn_info_req {
15111da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15121da177e4SLinus Torvalds 	__u8     type;
15131da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
15141da177e4SLinus Torvalds };
15151da177e4SLinus Torvalds 
151640be492fSMarcel Holtmann struct hci_auth_info_req {
151740be492fSMarcel Holtmann 	bdaddr_t bdaddr;
151840be492fSMarcel Holtmann 	__u8     type;
151940be492fSMarcel Holtmann };
152040be492fSMarcel Holtmann 
15211da177e4SLinus Torvalds struct hci_inquiry_req {
15221da177e4SLinus Torvalds 	__u16 dev_id;
15231da177e4SLinus Torvalds 	__u16 flags;
15241da177e4SLinus Torvalds 	__u8  lap[3];
15251da177e4SLinus Torvalds 	__u8  length;
15261da177e4SLinus Torvalds 	__u8  num_rsp;
15271da177e4SLinus Torvalds };
15281da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
15291da177e4SLinus Torvalds 
15308b281b9cSFabio Estevam extern bool enable_hs;
15318830f514SAndrei Emeltchenko 
15321da177e4SLinus Torvalds #endif /* __HCI_H */
1533