xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 3769972badcd542913c460ca2834312cdff9f16c)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds    BlueZ - Bluetooth protocol stack for Linux
31da177e4SLinus Torvalds    Copyright (C) 2000-2001 Qualcomm Incorporated
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
61da177e4SLinus Torvalds 
71da177e4SLinus Torvalds    This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds    it under the terms of the GNU General Public License version 2 as
91da177e4SLinus Torvalds    published by the Free Software Foundation;
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
121da177e4SLinus Torvalds    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131da177e4SLinus Torvalds    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
141da177e4SLinus Torvalds    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
151da177e4SLinus Torvalds    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
161da177e4SLinus Torvalds    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171da177e4SLinus Torvalds    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
181da177e4SLinus Torvalds    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
211da177e4SLinus Torvalds    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
221da177e4SLinus Torvalds    SOFTWARE IS DISCLAIMED.
231da177e4SLinus Torvalds */
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds #ifndef __HCI_H
261da177e4SLinus Torvalds #define __HCI_H
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE	1024
291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE	255
301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE	260
311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE	(HCI_MAX_ACL_SIZE + 4)
321da177e4SLinus Torvalds 
339b3b4460SAndrei Emeltchenko #define HCI_LINK_KEY_SIZE	16
34523e93cdSAndrei Emeltchenko #define HCI_AMP_LINK_KEY_SIZE	(2 * HCI_LINK_KEY_SIZE)
359b3b4460SAndrei Emeltchenko 
36903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE	672
37903e4541SAndrei Emeltchenko 
387d1dab49SDoHyun Pyun #define HCI_MAX_CSB_DATA_SIZE	252
397d1dab49SDoHyun Pyun 
401da177e4SLinus Torvalds /* HCI dev events */
411da177e4SLinus Torvalds #define HCI_DEV_REG			1
421da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
431da177e4SLinus Torvalds #define HCI_DEV_UP			3
441da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
451da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
461da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds /* HCI notify events */
491da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
501da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
511da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
521da177e4SLinus Torvalds 
53c13854ceSMarcel Holtmann /* HCI bus types */
540ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
551da177e4SLinus Torvalds #define HCI_USB		1
561da177e4SLinus Torvalds #define HCI_PCCARD	2
571da177e4SLinus Torvalds #define HCI_UART	3
581da177e4SLinus Torvalds #define HCI_RS232	4
591da177e4SLinus Torvalds #define HCI_PCI		5
600ac53939SMarcel Holtmann #define HCI_SDIO	6
611da177e4SLinus Torvalds 
62943da25dSMarcel Holtmann /* HCI controller types */
63943da25dSMarcel Holtmann #define HCI_BREDR	0x00
648f1e1742SDavid Vrabel #define HCI_AMP		0x01
65943da25dSMarcel Holtmann 
668598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
676ed971caSMarcel Holtmann #define AMP_ID_BREDR	0x00
688598d064SAndrei Emeltchenko 
697c13823dSMarcel Holtmann /* AMP controller types */
707c13823dSMarcel Holtmann #define AMP_TYPE_BREDR	0x00
717c13823dSMarcel Holtmann #define AMP_TYPE_80211	0x01
727c13823dSMarcel Holtmann 
73ab846ec4SAndrei Emeltchenko /* AMP controller status */
74536619e8SMarcel Holtmann #define AMP_STATUS_POWERED_DOWN			0x00
75536619e8SMarcel Holtmann #define AMP_STATUS_BLUETOOTH_ONLY		0x01
76536619e8SMarcel Holtmann #define AMP_STATUS_NO_CAPACITY			0x02
77536619e8SMarcel Holtmann #define AMP_STATUS_LOW_CAPACITY			0x03
78536619e8SMarcel Holtmann #define AMP_STATUS_MEDIUM_CAPACITY		0x04
79536619e8SMarcel Holtmann #define AMP_STATUS_HIGH_CAPACITY		0x05
80536619e8SMarcel Holtmann #define AMP_STATUS_FULL_CAPACITY		0x06
81ab846ec4SAndrei Emeltchenko 
821da177e4SLinus Torvalds /* HCI device quirks */
831da177e4SLinus Torvalds enum {
84a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
85da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
86f9f462faSMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE,
87f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
881da177e4SLinus Torvalds };
891da177e4SLinus Torvalds 
901da177e4SLinus Torvalds /* HCI device flags */
911da177e4SLinus Torvalds enum {
921da177e4SLinus Torvalds 	HCI_UP,
931da177e4SLinus Torvalds 	HCI_INIT,
941da177e4SLinus Torvalds 	HCI_RUNNING,
951da177e4SLinus Torvalds 
961da177e4SLinus Torvalds 	HCI_PSCAN,
971da177e4SLinus Torvalds 	HCI_ISCAN,
981da177e4SLinus Torvalds 	HCI_AUTH,
991da177e4SLinus Torvalds 	HCI_ENCRYPT,
1001da177e4SLinus Torvalds 	HCI_INQUIRY,
1011da177e4SLinus Torvalds 
1021da177e4SLinus Torvalds 	HCI_RAW,
103ab81cbf9SJohan Hedberg 
10410572132SGustavo F. Padovan 	HCI_RESET,
1051da177e4SLinus Torvalds };
1061da177e4SLinus Torvalds 
107111902f7SMarcel Holtmann /* BR/EDR and/or LE controller flags: the flags defined here should represent
108111902f7SMarcel Holtmann  * states configured via debugfs for debugging and testing purposes only.
109111902f7SMarcel Holtmann  */
110111902f7SMarcel Holtmann enum {
111111902f7SMarcel Holtmann 	HCI_DUT_MODE,
112111902f7SMarcel Holtmann 	HCI_FORCE_SC,
113111902f7SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
114111902f7SMarcel Holtmann };
115111902f7SMarcel Holtmann 
116d23264a8SAndre Guedes /*
117d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
118d23264a8SAndre Guedes  * states from the controller.
119d23264a8SAndre Guedes  */
120d23264a8SAndre Guedes enum {
121a8b2d5c2SJohan Hedberg 	HCI_SETUP,
122a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1235e130367SJohan Hedberg 	HCI_RFKILLED,
124a8b2d5c2SJohan Hedberg 	HCI_MGMT,
125a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
126a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
1270663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
128*3769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
12994324962SJohan Hovold 	HCI_UNREGISTER,
1300736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
131a8b2d5c2SJohan Hedberg 
132d23264a8SAndre Guedes 	HCI_LE_SCAN,
13384bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
134e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
135134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
136863efaf2SJohan Hedberg 	HCI_PRIVACY,
137d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
13841edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
1396d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
14006199cf8SJohan Hedberg 	HCI_LE_ENABLED,
141f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
1425e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1435e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
1446acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
14547990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
14621693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1471a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
14856f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
14981ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
150d23264a8SAndre Guedes };
151d23264a8SAndre Guedes 
1522cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
1532cc6fb00SJohan Hedberg  * or the HCI device is closed.
1542cc6fb00SJohan Hedberg  */
1551a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
1561a4d3c4bSJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE))
1572cc6fb00SJohan Hedberg 
1581da177e4SLinus Torvalds /* HCI ioctl defines */
1591da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1601da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1611da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1621da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1631da177e4SLinus Torvalds 
1641da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1651da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1661da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1671da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
16840be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1691da177e4SLinus Torvalds 
1701da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1711da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1721da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1731da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1741da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1751da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1761da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1771da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1781da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1791da177e4SLinus Torvalds 
180f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
181f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
182f0358568SJohan Hedberg 
1831da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1841da177e4SLinus Torvalds 
1851da177e4SLinus Torvalds /* HCI timeouts */
1865f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1875f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1885f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
189d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
1905f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1919345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
192a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
1939489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
1941da177e4SLinus Torvalds 
1955b7f9909SMarcel Holtmann /* HCI data types */
1961da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1971da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1981da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1991da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
2001da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2011da177e4SLinus Torvalds 
2025b7f9909SMarcel Holtmann /* HCI packet types */
2031da177e4SLinus Torvalds #define HCI_DM1		0x0008
2041da177e4SLinus Torvalds #define HCI_DM3		0x0400
2051da177e4SLinus Torvalds #define HCI_DM5		0x4000
2061da177e4SLinus Torvalds #define HCI_DH1		0x0010
2071da177e4SLinus Torvalds #define HCI_DH3		0x0800
2081da177e4SLinus Torvalds #define HCI_DH5		0x8000
2091da177e4SLinus Torvalds 
2101da177e4SLinus Torvalds #define HCI_HV1		0x0020
2111da177e4SLinus Torvalds #define HCI_HV2		0x0040
2121da177e4SLinus Torvalds #define HCI_HV3		0x0080
2131da177e4SLinus Torvalds 
2141da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2151da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2161da177e4SLinus Torvalds 
2175b7f9909SMarcel Holtmann /* eSCO packet types */
2185b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2195b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2205b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2215b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2225b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2235b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
224efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
225efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
226efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
227efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2285b7f9909SMarcel Holtmann 
229a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
230efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
231a8746417SMarcel Holtmann 
2321da177e4SLinus Torvalds /* ACL flags */
233e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2341da177e4SLinus Torvalds #define ACL_CONT		0x01
2351da177e4SLinus Torvalds #define ACL_START		0x02
236d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2371da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2381da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2391da177e4SLinus Torvalds 
2401da177e4SLinus Torvalds /* Baseband links */
2411da177e4SLinus Torvalds #define SCO_LINK	0x00
2421da177e4SLinus Torvalds #define ACL_LINK	0x01
2435b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
244fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
245fcd89c09SVille Tervo #define LE_LINK		0x80
2463161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2471da177e4SLinus Torvalds 
2481da177e4SLinus Torvalds /* LMP features */
2491da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2501da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2511da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2521da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2531da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2541da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2551da177e4SLinus Torvalds #define LMP_HOLD	0x40
25604837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2571da177e4SLinus Torvalds 
2581da177e4SLinus Torvalds #define LMP_PARK	0x01
2591da177e4SLinus Torvalds #define LMP_RSSI	0x02
2601da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2611da177e4SLinus Torvalds #define LMP_SCO		0x08
2621da177e4SLinus Torvalds #define LMP_HV2		0x10
2631da177e4SLinus Torvalds #define LMP_HV3		0x20
2641da177e4SLinus Torvalds #define LMP_ULAW	0x40
2651da177e4SLinus Torvalds #define LMP_ALAW	0x80
2661da177e4SLinus Torvalds 
2671da177e4SLinus Torvalds #define LMP_CVSD	0x01
2681da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2691da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
27007a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2711da177e4SLinus Torvalds 
272d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2735b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2745b7f9909SMarcel Holtmann 
2755b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2765b7f9909SMarcel Holtmann #define LMP_EV5		0x02
27769ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
278d5859e22SJohan Hedberg #define LMP_LE		0x40
2795b7f9909SMarcel Holtmann 
28004837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
281d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
282efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
283efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
284efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
28504837f64SMarcel Holtmann 
286d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
287e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
288769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
289e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
290769be974SMarcel Holtmann 
291d5859e22SJohan Hedberg #define LMP_LSTO	0x01
292d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
293971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
294d5859e22SJohan Hedberg 
295eead27daSAndre Guedes /* Extended LMP features */
29653b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
29753b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
29853b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
29953b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
30053b834d2SMarcel Holtmann 
301d5991585SMarcel Holtmann #define LMP_SC		0x01
302d5991585SMarcel Holtmann #define LMP_PING	0x02
303d5991585SMarcel Holtmann 
30453b834d2SMarcel Holtmann /* Host features */
305cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
306eead27daSAndre Guedes #define LMP_HOST_LE		0x02
307cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
308d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
309eead27daSAndre Guedes 
31004837f64SMarcel Holtmann /* Connection modes */
31104837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
31204837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
31304837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
31404837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
31504837f64SMarcel Holtmann 
3161da177e4SLinus Torvalds /* Link policies */
3171da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3181da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3191da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3201da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3211da177e4SLinus Torvalds 
32204837f64SMarcel Holtmann /* Link modes */
3231da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3241da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3251da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3261da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3271da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3281da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3291da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
3307b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
3311da177e4SLinus Torvalds 
33240be492fSMarcel Holtmann /* Authentication types */
33340be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
33440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
33540be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
33640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
33740be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
33840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
33940be492fSMarcel Holtmann 
340a77b15a6SMikel Astiz /* I/O capabilities */
341a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
342a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
343a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
344a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
345a77b15a6SMikel Astiz 
346b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
347b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
348b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
349b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
350b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
35111015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
35211015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
353b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
35411015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
35511015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
356b6020ba0SWaldemar Rymarkiewicz 
3579f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3589f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
3592acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
360cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3619f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3629f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
363cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
364cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3659f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3669f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3673c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
3689f5a0d7bSAndrei Emeltchenko 
3692455a3eaSAndrei Emeltchenko /* Flow control modes */
3702455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3712455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3722455a3eaSAndrei Emeltchenko 
373bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
374bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
375bbaf444aSJohan Hedberg 
37632748db0SJohan Hedberg /* Extended Inquiry Response field types */
37732748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
37832748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
37932748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
38032748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
38132748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
38232748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
38332748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
38432748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
38532748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
38632748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3879ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3889ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3899ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
39032748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
39132748db0SJohan Hedberg 
3923f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
3933f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
3943f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
3953f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
3963f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
3973f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
3983f0f524bSJohan Hedberg 
3991da177e4SLinus Torvalds /* -----  HCI Commands ---- */
4006bd32326SVille Tervo #define HCI_OP_NOP			0x0000
4016bd32326SVille Tervo 
402a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
403a9de9248SMarcel Holtmann struct hci_cp_inquiry {
404a9de9248SMarcel Holtmann 	__u8     lap[3];
405a9de9248SMarcel Holtmann 	__u8     length;
406a9de9248SMarcel Holtmann 	__u8     num_rsp;
40766c853ccSGustavo F. Padovan } __packed;
4081da177e4SLinus Torvalds 
409a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
410a9de9248SMarcel Holtmann 
41179d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
41279d6e068SAndre Guedes 
413a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
414a9de9248SMarcel Holtmann 
415a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
416a9de9248SMarcel Holtmann struct hci_cp_create_conn {
417a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
418a9de9248SMarcel Holtmann 	__le16   pkt_type;
419a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
420a9de9248SMarcel Holtmann 	__u8     pscan_mode;
421a9de9248SMarcel Holtmann 	__le16   clock_offset;
422a9de9248SMarcel Holtmann 	__u8     role_switch;
42366c853ccSGustavo F. Padovan } __packed;
4241da177e4SLinus Torvalds 
425a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
426a9de9248SMarcel Holtmann struct hci_cp_disconnect {
427a9de9248SMarcel Holtmann 	__le16   handle;
428a9de9248SMarcel Holtmann 	__u8     reason;
42966c853ccSGustavo F. Padovan } __packed;
4301da177e4SLinus Torvalds 
431a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
432a9de9248SMarcel Holtmann struct hci_cp_add_sco {
433a9de9248SMarcel Holtmann 	__le16   handle;
434a9de9248SMarcel Holtmann 	__le16   pkt_type;
43566c853ccSGustavo F. Padovan } __packed;
436a9de9248SMarcel Holtmann 
437a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
438a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4391da177e4SLinus Torvalds 	bdaddr_t bdaddr;
44066c853ccSGustavo F. Padovan } __packed;
4411da177e4SLinus Torvalds 
442a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
443a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
444a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
445a9de9248SMarcel Holtmann 	__u8     role;
44666c853ccSGustavo F. Padovan } __packed;
4471da177e4SLinus Torvalds 
448a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
449a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
450a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
451a9de9248SMarcel Holtmann 	__u8     reason;
45266c853ccSGustavo F. Padovan } __packed;
4531da177e4SLinus Torvalds 
454a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
455a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
456a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4579b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
45866c853ccSGustavo F. Padovan } __packed;
4591da177e4SLinus Torvalds 
460a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
461a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
462a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
46366c853ccSGustavo F. Padovan } __packed;
4641da177e4SLinus Torvalds 
465a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
466a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
467a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
468a9de9248SMarcel Holtmann 	__u8     pin_len;
469a9de9248SMarcel Holtmann 	__u8     pin_code[16];
47066c853ccSGustavo F. Padovan } __packed;
471980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
472980e1a53SJohan Hedberg 	__u8     status;
473980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
474980e1a53SJohan Hedberg } __packed;
475a9de9248SMarcel Holtmann 
476a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
477a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
478a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
47966c853ccSGustavo F. Padovan } __packed;
480980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
481980e1a53SJohan Hedberg 	__u8     status;
482980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
483980e1a53SJohan Hedberg } __packed;
484a9de9248SMarcel Holtmann 
485a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
486a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
487a9de9248SMarcel Holtmann 	__le16   handle;
488a9de9248SMarcel Holtmann 	__le16   pkt_type;
48966c853ccSGustavo F. Padovan } __packed;
490a9de9248SMarcel Holtmann 
491a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
492a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
493a9de9248SMarcel Holtmann 	__le16   handle;
49466c853ccSGustavo F. Padovan } __packed;
495a9de9248SMarcel Holtmann 
496a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
497a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
498a9de9248SMarcel Holtmann 	__le16   handle;
499a9de9248SMarcel Holtmann 	__u8     encrypt;
50066c853ccSGustavo F. Padovan } __packed;
501a9de9248SMarcel Holtmann 
502a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
503a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
504a9de9248SMarcel Holtmann 	__le16   handle;
50566c853ccSGustavo F. Padovan } __packed;
506a9de9248SMarcel Holtmann 
507a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
508a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
509a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
510a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
511a9de9248SMarcel Holtmann 	__u8     pscan_mode;
512a9de9248SMarcel Holtmann 	__le16   clock_offset;
51366c853ccSGustavo F. Padovan } __packed;
514a9de9248SMarcel Holtmann 
515a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
516a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
517a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
51866c853ccSGustavo F. Padovan } __packed;
519a9de9248SMarcel Holtmann 
520a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
521a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
522a9de9248SMarcel Holtmann 	__le16   handle;
52366c853ccSGustavo F. Padovan } __packed;
524a9de9248SMarcel Holtmann 
525a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
526a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
527a9de9248SMarcel Holtmann 	__le16   handle;
528a9de9248SMarcel Holtmann 	__u8     page;
52966c853ccSGustavo F. Padovan } __packed;
530a9de9248SMarcel Holtmann 
531a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
532a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
533a9de9248SMarcel Holtmann 	__le16   handle;
53466c853ccSGustavo F. Padovan } __packed;
535a9de9248SMarcel Holtmann 
536a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
537a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
538a9de9248SMarcel Holtmann 	__le16   handle;
539a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
540a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
541a9de9248SMarcel Holtmann 	__le16   max_latency;
542a9de9248SMarcel Holtmann 	__le16   voice_setting;
543a9de9248SMarcel Holtmann 	__u8     retrans_effort;
544a9de9248SMarcel Holtmann 	__le16   pkt_type;
54566c853ccSGustavo F. Padovan } __packed;
546a9de9248SMarcel Holtmann 
547a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
548a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
549a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
550a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
551a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
552a9de9248SMarcel Holtmann 	__le16   max_latency;
553a9de9248SMarcel Holtmann 	__le16   content_format;
554a9de9248SMarcel Holtmann 	__u8     retrans_effort;
555a9de9248SMarcel Holtmann 	__le16   pkt_type;
55666c853ccSGustavo F. Padovan } __packed;
557a9de9248SMarcel Holtmann 
558a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
559a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
560a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
561a9de9248SMarcel Holtmann 	__u8     reason;
56266c853ccSGustavo F. Padovan } __packed;
563a9de9248SMarcel Holtmann 
56417fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
56517fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
56617fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
56717fa4b9dSJohan Hedberg 	__u8     capability;
56817fa4b9dSJohan Hedberg 	__u8     oob_data;
56917fa4b9dSJohan Hedberg 	__u8     authentication;
57017fa4b9dSJohan Hedberg } __packed;
57117fa4b9dSJohan Hedberg 
572a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
573a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
574a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
575a5c29683SJohan Hedberg } __packed;
576a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
577a5c29683SJohan Hedberg 	__u8     status;
578a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
579a5c29683SJohan Hedberg } __packed;
580a5c29683SJohan Hedberg 
581a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
582a5c29683SJohan Hedberg 
5839ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5849ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5859ad4019aSBrian Gix 	bdaddr_t bdaddr;
5869ad4019aSBrian Gix 	__le32	passkey;
5879ad4019aSBrian Gix } __packed;
5889ad4019aSBrian Gix 
5899ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5909ad4019aSBrian Gix 
5912763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5922763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5932763eda6SSzymon Janc 	bdaddr_t bdaddr;
5942763eda6SSzymon Janc 	__u8     hash[16];
5952763eda6SSzymon Janc 	__u8     randomizer[16];
5962763eda6SSzymon Janc } __packed;
5972763eda6SSzymon Janc 
5982763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5992763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
6002763eda6SSzymon Janc 	bdaddr_t bdaddr;
6012763eda6SSzymon Janc } __packed;
6022763eda6SSzymon Janc 
60303b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
60403b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
60503b555e1SJohan Hedberg 	bdaddr_t bdaddr;
60603b555e1SJohan Hedberg 	__u8     reason;
60703b555e1SJohan Hedberg } __packed;
60803b555e1SJohan Hedberg 
609523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
610523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
611523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
612523e93cdSAndrei Emeltchenko 	__u8     key_len;
613523e93cdSAndrei Emeltchenko 	__u8     key_type;
614523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
615523e93cdSAndrei Emeltchenko } __packed;
616523e93cdSAndrei Emeltchenko 
617523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
618523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
619523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
620523e93cdSAndrei Emeltchenko 	__u8     key_len;
621523e93cdSAndrei Emeltchenko 	__u8     key_type;
622523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
623523e93cdSAndrei Emeltchenko } __packed;
624523e93cdSAndrei Emeltchenko 
625523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
626523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
627523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
628523e93cdSAndrei Emeltchenko 	__u8     reason;
629b078b564SAndrei Emeltchenko } __packed;
630b078b564SAndrei Emeltchenko 
631b078b564SAndrei Emeltchenko struct ext_flow_spec {
632b078b564SAndrei Emeltchenko 	__u8       id;
633b078b564SAndrei Emeltchenko 	__u8       stype;
634b078b564SAndrei Emeltchenko 	__le16     msdu;
635b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
636b078b564SAndrei Emeltchenko 	__le32     acc_lat;
637b078b564SAndrei Emeltchenko 	__le32     flush_to;
638b078b564SAndrei Emeltchenko } __packed;
639b078b564SAndrei Emeltchenko 
640b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
641b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
642b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
643b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
644b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
645b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
646b078b564SAndrei Emeltchenko } __packed;
647b078b564SAndrei Emeltchenko 
648b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
649b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
650b078b564SAndrei Emeltchenko 	__le16   log_handle;
651b078b564SAndrei Emeltchenko } __packed;
652b078b564SAndrei Emeltchenko 
653b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
654b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
655b078b564SAndrei Emeltchenko 	__u8     phy_handle;
656b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
657b078b564SAndrei Emeltchenko } __packed;
658b078b564SAndrei Emeltchenko 
659b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
660b078b564SAndrei Emeltchenko 	__u8     status;
661b078b564SAndrei Emeltchenko 	__u8     phy_handle;
662b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
663523e93cdSAndrei Emeltchenko } __packed;
664523e93cdSAndrei Emeltchenko 
6658c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
6668c9a041bSDoHyun Pyun struct hci_cp_set_csb {
6678c9a041bSDoHyun Pyun 	__u8	enable;
6688c9a041bSDoHyun Pyun 	__u8	lt_addr;
6698c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
6708c9a041bSDoHyun Pyun 	__le16	packet_type;
6718c9a041bSDoHyun Pyun 	__le16	interval_min;
6728c9a041bSDoHyun Pyun 	__le16	interval_max;
6738c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
6748c9a041bSDoHyun Pyun } __packed;
6758c9a041bSDoHyun Pyun struct hci_rp_set_csb {
6768c9a041bSDoHyun Pyun 	__u8	status;
6778c9a041bSDoHyun Pyun 	__u8	lt_addr;
6788c9a041bSDoHyun Pyun 	__le16	interval;
6798c9a041bSDoHyun Pyun } __packed;
6808c9a041bSDoHyun Pyun 
681cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
682cefded98SDoHyun Pyun 
683e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
684e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
685e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
686e2f99131SMarcel Holtmann 	__u8     hash192[16];
687e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
688e2f99131SMarcel Holtmann 	__u8     hash256[16];
689e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
690e2f99131SMarcel Holtmann } __packed;
691e2f99131SMarcel Holtmann 
692a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
693a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
694a9de9248SMarcel Holtmann 	__le16   handle;
695a9de9248SMarcel Holtmann 	__le16   max_interval;
696a9de9248SMarcel Holtmann 	__le16   min_interval;
697a9de9248SMarcel Holtmann 	__le16   attempt;
698a9de9248SMarcel Holtmann 	__le16   timeout;
69966c853ccSGustavo F. Padovan } __packed;
700a9de9248SMarcel Holtmann 
701a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
702a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
703a9de9248SMarcel Holtmann 	__le16   handle;
70466c853ccSGustavo F. Padovan } __packed;
705a9de9248SMarcel Holtmann 
706a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
707a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
708a9de9248SMarcel Holtmann 	__le16   handle;
70966c853ccSGustavo F. Padovan } __packed;
710a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
711a9de9248SMarcel Holtmann 	__u8     status;
712a9de9248SMarcel Holtmann 	__le16   handle;
713a9de9248SMarcel Holtmann 	__u8     role;
71466c853ccSGustavo F. Padovan } __packed;
715a9de9248SMarcel Holtmann 
716a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
717a9de9248SMarcel Holtmann struct hci_cp_switch_role {
718a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
719a9de9248SMarcel Holtmann 	__u8     role;
72066c853ccSGustavo F. Padovan } __packed;
721a9de9248SMarcel Holtmann 
722a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
723a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
724a9de9248SMarcel Holtmann 	__le16   handle;
72566c853ccSGustavo F. Padovan } __packed;
726a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
727a9de9248SMarcel Holtmann 	__u8     status;
728a9de9248SMarcel Holtmann 	__le16   handle;
729a9de9248SMarcel Holtmann 	__le16   policy;
73066c853ccSGustavo F. Padovan } __packed;
731a9de9248SMarcel Holtmann 
732a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
733a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
734a9de9248SMarcel Holtmann 	__le16   handle;
735a9de9248SMarcel Holtmann 	__le16   policy;
73666c853ccSGustavo F. Padovan } __packed;
737a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
738a9de9248SMarcel Holtmann 	__u8     status;
739a9de9248SMarcel Holtmann 	__le16   handle;
74066c853ccSGustavo F. Padovan } __packed;
741a9de9248SMarcel Holtmann 
742e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
743e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
744e4e8e37cSMarcel Holtmann 	__u8     status;
745e4e8e37cSMarcel Holtmann 	__le16   policy;
74666c853ccSGustavo F. Padovan } __packed;
747e4e8e37cSMarcel Holtmann 
748e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
749e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
750e4e8e37cSMarcel Holtmann 	__le16   policy;
75166c853ccSGustavo F. Padovan } __packed;
752e4e8e37cSMarcel Holtmann 
753a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
754a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
755a9de9248SMarcel Holtmann 	__le16   handle;
756a9de9248SMarcel Holtmann 	__le16   max_latency;
757a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
758a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
75966c853ccSGustavo F. Padovan } __packed;
760a9de9248SMarcel Holtmann 
761a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
762a9de9248SMarcel Holtmann 
763a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
764a9de9248SMarcel Holtmann 
765a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
7661da177e4SLinus Torvalds struct hci_cp_set_event_flt {
7671da177e4SLinus Torvalds 	__u8     flt_type;
7681da177e4SLinus Torvalds 	__u8     cond_type;
7691da177e4SLinus Torvalds 	__u8     condition[0];
77066c853ccSGustavo F. Padovan } __packed;
7711da177e4SLinus Torvalds 
7721da177e4SLinus Torvalds /* Filter types */
7731da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
7741da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
7751da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
7761da177e4SLinus Torvalds 
7771da177e4SLinus Torvalds /* CONN_SETUP Condition types */
7781da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
7791da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
7801da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
7811da177e4SLinus Torvalds 
7821da177e4SLinus Torvalds /* CONN_SETUP Conditions */
7831da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
7841da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
7851da177e4SLinus Torvalds 
786b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
787b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
788b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
789b0916ea0SJohan Hedberg 	__u8     delete_all;
790b0916ea0SJohan Hedberg } __packed;
791b0916ea0SJohan Hedberg 
7921f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
7931f6c6378SJohan Hedberg 
794a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
795a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
7961f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
79766c853ccSGustavo F. Padovan } __packed;
798a9de9248SMarcel Holtmann 
799a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
800a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
801a9de9248SMarcel Holtmann 	__u8     status;
8021f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
80366c853ccSGustavo F. Padovan } __packed;
804a9de9248SMarcel Holtmann 
805a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
806a9de9248SMarcel Holtmann 
807a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
808a9de9248SMarcel Holtmann 
809a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
810a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
811a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
812a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
813a9de9248SMarcel Holtmann 
814a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
815a9de9248SMarcel Holtmann 
816a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
817a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
818a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
819a9de9248SMarcel Holtmann 
820a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
821a9de9248SMarcel Holtmann 
822a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
823a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
824a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
825a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
826a9de9248SMarcel Holtmann 
827a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
828a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
8291da177e4SLinus Torvalds 	__u8     status;
8301da177e4SLinus Torvalds 	__u8     dev_class[3];
83166c853ccSGustavo F. Padovan } __packed;
8321da177e4SLinus Torvalds 
833a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
834a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
8351da177e4SLinus Torvalds 	__u8     dev_class[3];
83666c853ccSGustavo F. Padovan } __packed;
8371da177e4SLinus Torvalds 
838a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
8391da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
8401da177e4SLinus Torvalds 	__u8     status;
8411ebb9252SMarcel Holtmann 	__le16   voice_setting;
84266c853ccSGustavo F. Padovan } __packed;
8431da177e4SLinus Torvalds 
844a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
8451da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
8461ebb9252SMarcel Holtmann 	__le16   voice_setting;
84766c853ccSGustavo F. Padovan } __packed;
8481da177e4SLinus Torvalds 
849a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
8501da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
8511ebb9252SMarcel Holtmann 	__le16   acl_mtu;
8521da177e4SLinus Torvalds 	__u8     sco_mtu;
8531ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
8541ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
85566c853ccSGustavo F. Padovan } __packed;
8561da177e4SLinus Torvalds 
857b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
858b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
859b4cb9fb2SMarcel Holtmann 	__u8	status;
860b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
861b4cb9fb2SMarcel Holtmann } __packed;
862b4cb9fb2SMarcel Holtmann 
8634b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
8644b836f39SMarcel Holtmann 
8653d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
8663d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
8673d505312SMarcel Holtmann 	__u8	num_iac;
8683d505312SMarcel Holtmann 	__u8	iac_lap[6];
8693d505312SMarcel Holtmann } __packed;
8703d505312SMarcel Holtmann 
871d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
872d5859e22SJohan Hedberg 
87380a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
87480a1e1dbSJohan Hedberg 
87580a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
87680a1e1dbSJohan Hedberg struct hci_cp_write_eir {
877816a11d5SJohan Hedberg 	__u8	fec;
878816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
87980a1e1dbSJohan Hedberg } __packed;
88080a1e1dbSJohan Hedberg 
881333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
882333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
883333140b5SMarcel Holtmann 	__u8     status;
884333140b5SMarcel Holtmann 	__u8     mode;
88566c853ccSGustavo F. Padovan } __packed;
886333140b5SMarcel Holtmann 
887333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
888333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
889333140b5SMarcel Holtmann 	__u8     mode;
89066c853ccSGustavo F. Padovan } __packed;
891333140b5SMarcel Holtmann 
892c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
893c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
894c35938b2SSzymon Janc 	__u8     status;
895c35938b2SSzymon Janc 	__u8     hash[16];
896c35938b2SSzymon Janc 	__u8     randomizer[16];
897c35938b2SSzymon Janc } __packed;
898c35938b2SSzymon Janc 
899d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
90091c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
90191c4e9b1SMarcel Holtmann 	__u8     status;
90291c4e9b1SMarcel Holtmann 	__s8     tx_power;
90391c4e9b1SMarcel Holtmann } __packed;
904d5859e22SJohan Hedberg 
905d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
906d62e6d67SJohan Hedberg 
9077528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
9087528ca1cSMarcel Holtmann 
9091e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
9101e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
9111e89cffbSAndrei Emeltchenko 	__u8     status;
9121e89cffbSAndrei Emeltchenko 	__u8     mode;
9131e89cffbSAndrei Emeltchenko } __packed;
9141e89cffbSAndrei Emeltchenko 
915f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
916f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
917f9b49306SAndre Guedes 	__u8	le;
918f9b49306SAndre Guedes 	__u8	simul;
919f9b49306SAndre Guedes } __packed;
920f9b49306SAndre Guedes 
921d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
922d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
923d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
924d0bf75a5SDoHyun Pyun } __packed;
925d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
926d0bf75a5SDoHyun Pyun 	__u8	status;
927d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
928d0bf75a5SDoHyun Pyun } __packed;
929d0bf75a5SDoHyun Pyun 
9306a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
9316a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
9326a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9336a20eaf4SDoHyun Pyun } __packed;
9346a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
9356a20eaf4SDoHyun Pyun 	__u8	status;
9366a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9376a20eaf4SDoHyun Pyun } __packed;
9386a20eaf4SDoHyun Pyun 
9397d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
9407d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
9417d1dab49SDoHyun Pyun 	__u8	lt_addr;
9427d1dab49SDoHyun Pyun 	__u8	fragment;
9437d1dab49SDoHyun Pyun 	__u8	data_length;
9447d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
9457d1dab49SDoHyun Pyun } __packed;
9467d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
9477d1dab49SDoHyun Pyun 	__u8	status;
9487d1dab49SDoHyun Pyun 	__u8	lt_addr;
9497d1dab49SDoHyun Pyun } __packed;
9507d1dab49SDoHyun Pyun 
9515d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
9525d4e7e8dSJohan Hedberg 
953a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
954a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
955a9b07a64SDoHyun Pyun 	__le16	interval_min;
956a9b07a64SDoHyun Pyun 	__le16	interval_max;
957a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
958a9b07a64SDoHyun Pyun 	__u8	service_data;
959a9b07a64SDoHyun Pyun } __packed;
960a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
961a9b07a64SDoHyun Pyun 	__u8	status;
962a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
963a9b07a64SDoHyun Pyun } __packed;
964a9b07a64SDoHyun Pyun 
965eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
966eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
967eb4b95c6SMarcel Holtmann 	__u8	status;
968eb4b95c6SMarcel Holtmann 	__u8	support;
969eb4b95c6SMarcel Holtmann } __packed;
970eb4b95c6SMarcel Holtmann 
971eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
972eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
973eb4b95c6SMarcel Holtmann 	__u8	support;
974eb4b95c6SMarcel Holtmann } __packed;
975eb4b95c6SMarcel Holtmann 
976e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
977e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
978e2f99131SMarcel Holtmann 	__u8     status;
979e2f99131SMarcel Holtmann 	__u8     hash192[16];
980e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
981e2f99131SMarcel Holtmann 	__u8     hash256[16];
982e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
983e2f99131SMarcel Holtmann } __packed;
984e2f99131SMarcel Holtmann 
985a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
986a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
9871da177e4SLinus Torvalds 	__u8     status;
988a9de9248SMarcel Holtmann 	__u8     hci_ver;
989a9de9248SMarcel Holtmann 	__le16   hci_rev;
990a9de9248SMarcel Holtmann 	__u8     lmp_ver;
991a9de9248SMarcel Holtmann 	__le16   manufacturer;
992a9de9248SMarcel Holtmann 	__le16   lmp_subver;
99366c853ccSGustavo F. Padovan } __packed;
9941da177e4SLinus Torvalds 
995a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
996a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
9971da177e4SLinus Torvalds 	__u8     status;
998a9de9248SMarcel Holtmann 	__u8     commands[64];
99966c853ccSGustavo F. Padovan } __packed;
10001da177e4SLinus Torvalds 
1001a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1002a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1003a9de9248SMarcel Holtmann 	__u8     status;
1004a9de9248SMarcel Holtmann 	__u8     features[8];
100566c853ccSGustavo F. Padovan } __packed;
1006a9de9248SMarcel Holtmann 
1007a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1008971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1009971e3a4bSAndre Guedes 	__u8     page;
1010971e3a4bSAndre Guedes } __packed;
1011a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1012a9de9248SMarcel Holtmann 	__u8     status;
1013a9de9248SMarcel Holtmann 	__u8     page;
1014a9de9248SMarcel Holtmann 	__u8     max_page;
1015a9de9248SMarcel Holtmann 	__u8     features[8];
101666c853ccSGustavo F. Padovan } __packed;
1017a9de9248SMarcel Holtmann 
1018a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1019a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1020a9de9248SMarcel Holtmann 	__u8     status;
1021a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1022a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1023a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1024a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
102566c853ccSGustavo F. Padovan } __packed;
1026a9de9248SMarcel Holtmann 
1027a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1028a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1029a9de9248SMarcel Holtmann 	__u8     status;
10301da177e4SLinus Torvalds 	bdaddr_t bdaddr;
103166c853ccSGustavo F. Padovan } __packed;
10321da177e4SLinus Torvalds 
1033350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1034350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1035350ee4cfSAndrei Emeltchenko 	__u8     status;
1036350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1037350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1038350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1039350ee4cfSAndrei Emeltchenko } __packed;
1040350ee4cfSAndrei Emeltchenko 
1041f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1042f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1043f332ec66SJohan Hedberg 	__u8     status;
1044f332ec66SJohan Hedberg 	__le16   interval;
1045f332ec66SJohan Hedberg 	__le16   window;
1046f332ec66SJohan Hedberg } __packed;
1047f332ec66SJohan Hedberg 
1048f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1049f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1050f6422ec6SAntti Julku 	__le16   interval;
1051f6422ec6SAntti Julku 	__le16   window;
1052f6422ec6SAntti Julku } __packed;
1053f6422ec6SAntti Julku 
10545a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
10555a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
10565a134faeSAndrzej Kaczmarek 	__le16   handle;
10575a134faeSAndrzej Kaczmarek 	__u8     type;
10585a134faeSAndrzej Kaczmarek } __packed;
10595a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
10605a134faeSAndrzej Kaczmarek 	__u8     status;
10615a134faeSAndrzej Kaczmarek 	__le16   handle;
10625a134faeSAndrzej Kaczmarek 	__s8     tx_power;
10635a134faeSAndrzej Kaczmarek } __packed;
10645a134faeSAndrzej Kaczmarek 
1065f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1066f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1067f332ec66SJohan Hedberg 	__u8     status;
1068f332ec66SJohan Hedberg 	__u8     type;
1069f332ec66SJohan Hedberg } __packed;
1070f332ec66SJohan Hedberg 
1071f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1072f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1073f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1074f6422ec6SAntti Julku 
10755ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
10765ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
10775ae76a94SAndrzej Kaczmarek 	__le16   handle;
10785ae76a94SAndrzej Kaczmarek } __packed;
10795ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
10805ae76a94SAndrzej Kaczmarek 	__u8     status;
10815ae76a94SAndrzej Kaczmarek 	__le16   handle;
10825ae76a94SAndrzej Kaczmarek 	__s8     rssi;
10835ae76a94SAndrzej Kaczmarek } __packed;
10845ae76a94SAndrzej Kaczmarek 
1085928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1086928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1087928abaa7SAndrei Emeltchenko 	__u8     status;
1088928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1089928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1090928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1091928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1092928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1093928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1094928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1095928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1096928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1097928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1098928abaa7SAndrei Emeltchenko } __packed;
1099928abaa7SAndrei Emeltchenko 
1100523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1101523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1102523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1103523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1104523e93cdSAndrei Emeltchenko 	__le16   max_len;
1105523e93cdSAndrei Emeltchenko } __packed;
1106523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1107523e93cdSAndrei Emeltchenko 	__u8     status;
1108523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1109523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1110523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1111523e93cdSAndrei Emeltchenko } __packed;
1112523e93cdSAndrei Emeltchenko 
1113523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1114523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1115523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1116523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1117523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1118523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1119523e93cdSAndrei Emeltchenko } __packed;
1120523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1121523e93cdSAndrei Emeltchenko 	__u8     status;
1122523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1123523e93cdSAndrei Emeltchenko } __packed;
1124523e93cdSAndrei Emeltchenko 
11254b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
11264b4148e9SMarcel Holtmann 
112706f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
112806f5b778SMarcel Holtmann 
112963185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
113063185f64SVille Tervo struct hci_cp_le_set_event_mask {
113163185f64SVille Tervo 	__u8     mask[8];
113263185f64SVille Tervo } __packed;
113363185f64SVille Tervo 
113463185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
113563185f64SVille Tervo struct hci_rp_le_read_buffer_size {
113663185f64SVille Tervo 	__u8     status;
113763185f64SVille Tervo 	__le16   le_mtu;
113863185f64SVille Tervo 	__u8     le_max_pkt;
113963185f64SVille Tervo } __packed;
114063185f64SVille Tervo 
114160e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
114260e77321SJohan Hedberg struct hci_rp_le_read_local_features {
114360e77321SJohan Hedberg 	__u8     status;
114460e77321SJohan Hedberg 	__u8     features[8];
114560e77321SJohan Hedberg } __packed;
114660e77321SJohan Hedberg 
1147d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1148d13eafceSMarcel Holtmann 
11491e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
11501e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
11511e191893SMarcel Holtmann 	__le16   min_interval;
11521e191893SMarcel Holtmann 	__le16   max_interval;
11531e191893SMarcel Holtmann 	__u8     type;
11541e191893SMarcel Holtmann 	__u8     own_address_type;
11551e191893SMarcel Holtmann 	__u8     direct_addr_type;
11561e191893SMarcel Holtmann 	bdaddr_t direct_addr;
11571e191893SMarcel Holtmann 	__u8     channel_map;
11581e191893SMarcel Holtmann 	__u8     filter_policy;
11591e191893SMarcel Holtmann } __packed;
11601e191893SMarcel Holtmann 
11618fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
11628fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
11638fa19098SJohan Hedberg 	__u8	status;
11648fa19098SJohan Hedberg 	__s8	tx_power;
11658fa19098SJohan Hedberg } __packed;
11668fa19098SJohan Hedberg 
11673f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
11683f0f524bSJohan Hedberg 
11693f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
11703f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
11713f0f524bSJohan Hedberg 	__u8	length;
11723f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
11733f0f524bSJohan Hedberg } __packed;
11743f0f524bSJohan Hedberg 
1175f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1176f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1177f14d8f64SMarcel Holtmann 	__u8	length;
1178f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1179f14d8f64SMarcel Holtmann } __packed;
1180f14d8f64SMarcel Holtmann 
1181c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1182c1d5dc4aSJohan Hedberg 
11835df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
11845df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
11855df480b5SAndre Guedes 
118607f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
118707f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
118807f7fa5dSAndre Guedes 	__u8    type;
118907f7fa5dSAndre Guedes 	__le16  interval;
119007f7fa5dSAndre Guedes 	__le16  window;
119107f7fa5dSAndre Guedes 	__u8    own_address_type;
119207f7fa5dSAndre Guedes 	__u8    filter_policy;
119307f7fa5dSAndre Guedes } __packed;
119407f7fa5dSAndre Guedes 
119576a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
119676a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1197525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1198525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
119968a8aea4SAndrei Emeltchenko 
1200eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1201eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1202eb9d91f5SAndre Guedes 	__u8     enable;
1203eb9d91f5SAndre Guedes 	__u8     filter_dup;
1204eb9d91f5SAndre Guedes } __packed;
1205eb9d91f5SAndre Guedes 
1206a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1207a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1208a7139eddSJohan Hedberg 
120963185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
121063185f64SVille Tervo struct hci_cp_le_create_conn {
121163185f64SVille Tervo 	__le16   scan_interval;
121263185f64SVille Tervo 	__le16   scan_window;
121363185f64SVille Tervo 	__u8     filter_policy;
121463185f64SVille Tervo 	__u8     peer_addr_type;
121563185f64SVille Tervo 	bdaddr_t peer_addr;
121663185f64SVille Tervo 	__u8     own_address_type;
121763185f64SVille Tervo 	__le16   conn_interval_min;
121863185f64SVille Tervo 	__le16   conn_interval_max;
121963185f64SVille Tervo 	__le16   conn_latency;
122063185f64SVille Tervo 	__le16   supervision_timeout;
122163185f64SVille Tervo 	__le16   min_ce_len;
122263185f64SVille Tervo 	__le16   max_ce_len;
122363185f64SVille Tervo } __packed;
122463185f64SVille Tervo 
122563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
122663185f64SVille Tervo 
1227cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1228cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1229cf1d081fSJohan Hedberg 	__u8	status;
1230cf1d081fSJohan Hedberg 	__u8	size;
1231cf1d081fSJohan Hedberg } __packed;
1232cf1d081fSJohan Hedberg 
1233d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1234d9a7b0a5SMarcel Holtmann 
1235d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1236d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1237d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1238d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1239d9a7b0a5SMarcel Holtmann } __packed;
1240d9a7b0a5SMarcel Holtmann 
1241d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1242d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1243d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1244d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1245d9a7b0a5SMarcel Holtmann } __packed;
1246d9a7b0a5SMarcel Holtmann 
12472ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
12482ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
12492ce603ebSClaudio Takahasi 	__le16   handle;
12502ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
12512ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
12522ce603ebSClaudio Takahasi 	__le16   conn_latency;
12532ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
12542ce603ebSClaudio Takahasi 	__le16   min_ce_len;
12552ce603ebSClaudio Takahasi 	__le16   max_ce_len;
12562ce603ebSClaudio Takahasi } __packed;
12572ce603ebSClaudio Takahasi 
1258a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1259a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1260a7a595f6SVinicius Costa Gomes 	__le16	handle;
1261fe39c7b2SMarcel Holtmann 	__le64	rand;
1262a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1263a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1264a7a595f6SVinicius Costa Gomes } __packed;
1265a7a595f6SVinicius Costa Gomes 
1266a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1267a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1268a7a595f6SVinicius Costa Gomes 	__le16	handle;
1269a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1270a7a595f6SVinicius Costa Gomes } __packed;
1271a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1272a7a595f6SVinicius Costa Gomes 	__u8	status;
1273a7a595f6SVinicius Costa Gomes 	__le16	handle;
1274a7a595f6SVinicius Costa Gomes } __packed;
1275a7a595f6SVinicius Costa Gomes 
1276a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1277a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1278a7a595f6SVinicius Costa Gomes 	__le16	handle;
1279a7a595f6SVinicius Costa Gomes } __packed;
1280a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1281a7a595f6SVinicius Costa Gomes 	__u8	status;
1282a7a595f6SVinicius Costa Gomes 	__le16	handle;
1283a7a595f6SVinicius Costa Gomes } __packed;
1284a7a595f6SVinicius Costa Gomes 
12859b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
12869b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
12879b008c04SJohan Hedberg 	__u8	status;
12889b008c04SJohan Hedberg 	__u8	le_states[8];
12899b008c04SJohan Hedberg } __packed;
12909b008c04SJohan Hedberg 
12911da177e4SLinus Torvalds /* ---- HCI Events ---- */
12921da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
12931da177e4SLinus Torvalds 
12941da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
12951da177e4SLinus Torvalds struct inquiry_info {
12961da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12971da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
12981da177e4SLinus Torvalds 	__u8     pscan_period_mode;
12991da177e4SLinus Torvalds 	__u8     pscan_mode;
13001da177e4SLinus Torvalds 	__u8     dev_class[3];
13011ebb9252SMarcel Holtmann 	__le16   clock_offset;
130266c853ccSGustavo F. Padovan } __packed;
13031da177e4SLinus Torvalds 
13041da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
13051da177e4SLinus Torvalds struct hci_ev_conn_complete {
13061da177e4SLinus Torvalds 	__u8     status;
13071ebb9252SMarcel Holtmann 	__le16   handle;
13081da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13091da177e4SLinus Torvalds 	__u8     link_type;
13101da177e4SLinus Torvalds 	__u8     encr_mode;
131166c853ccSGustavo F. Padovan } __packed;
13121da177e4SLinus Torvalds 
13131da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
13141da177e4SLinus Torvalds struct hci_ev_conn_request {
13151da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13161da177e4SLinus Torvalds 	__u8     dev_class[3];
13171da177e4SLinus Torvalds 	__u8     link_type;
131866c853ccSGustavo F. Padovan } __packed;
13191da177e4SLinus Torvalds 
13201da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
13211da177e4SLinus Torvalds struct hci_ev_disconn_complete {
13221da177e4SLinus Torvalds 	__u8     status;
13231ebb9252SMarcel Holtmann 	__le16   handle;
13241da177e4SLinus Torvalds 	__u8     reason;
132566c853ccSGustavo F. Padovan } __packed;
13261da177e4SLinus Torvalds 
13271da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
13281da177e4SLinus Torvalds struct hci_ev_auth_complete {
13291da177e4SLinus Torvalds 	__u8     status;
13301ebb9252SMarcel Holtmann 	__le16   handle;
133166c853ccSGustavo F. Padovan } __packed;
13321da177e4SLinus Torvalds 
1333a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1334a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1335a9de9248SMarcel Holtmann 	__u8     status;
1336a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
13371f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
133866c853ccSGustavo F. Padovan } __packed;
1339a9de9248SMarcel Holtmann 
13401da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
13411da177e4SLinus Torvalds struct hci_ev_encrypt_change {
13421da177e4SLinus Torvalds 	__u8     status;
13431ebb9252SMarcel Holtmann 	__le16   handle;
13441da177e4SLinus Torvalds 	__u8     encrypt;
134566c853ccSGustavo F. Padovan } __packed;
13461da177e4SLinus Torvalds 
1347a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1348a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
13491da177e4SLinus Torvalds 	__u8     status;
13501ebb9252SMarcel Holtmann 	__le16   handle;
135166c853ccSGustavo F. Padovan } __packed;
13521da177e4SLinus Torvalds 
1353a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1354a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1355a9de9248SMarcel Holtmann 	__u8     status;
1356a9de9248SMarcel Holtmann 	__le16   handle;
1357a9de9248SMarcel Holtmann 	__u8     features[8];
135866c853ccSGustavo F. Padovan } __packed;
1359a9de9248SMarcel Holtmann 
1360a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1361a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1362a9de9248SMarcel Holtmann 	__u8     status;
1363a9de9248SMarcel Holtmann 	__le16   handle;
1364a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1365a9de9248SMarcel Holtmann 	__le16   manufacturer;
1366a9de9248SMarcel Holtmann 	__le16   lmp_subver;
136766c853ccSGustavo F. Padovan } __packed;
1368a9de9248SMarcel Holtmann 
1369a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
13701da177e4SLinus Torvalds struct hci_qos {
13711da177e4SLinus Torvalds 	__u8     service_type;
13721da177e4SLinus Torvalds 	__u32    token_rate;
13731da177e4SLinus Torvalds 	__u32    peak_bandwidth;
13741da177e4SLinus Torvalds 	__u32    latency;
13751da177e4SLinus Torvalds 	__u32    delay_variation;
137666c853ccSGustavo F. Padovan } __packed;
13771da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
13781da177e4SLinus Torvalds 	__u8     status;
13791ebb9252SMarcel Holtmann 	__le16   handle;
13801da177e4SLinus Torvalds 	struct   hci_qos qos;
138166c853ccSGustavo F. Padovan } __packed;
13821da177e4SLinus Torvalds 
1383a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
13841da177e4SLinus Torvalds struct hci_ev_cmd_complete {
13851da177e4SLinus Torvalds 	__u8     ncmd;
13861ebb9252SMarcel Holtmann 	__le16   opcode;
138766c853ccSGustavo F. Padovan } __packed;
13881da177e4SLinus Torvalds 
1389a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
13901da177e4SLinus Torvalds struct hci_ev_cmd_status {
13911da177e4SLinus Torvalds 	__u8     status;
13921da177e4SLinus Torvalds 	__u8     ncmd;
13931ebb9252SMarcel Holtmann 	__le16   opcode;
139466c853ccSGustavo F. Padovan } __packed;
13951da177e4SLinus Torvalds 
13961da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
13971da177e4SLinus Torvalds struct hci_ev_role_change {
13981da177e4SLinus Torvalds 	__u8     status;
13991da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14001da177e4SLinus Torvalds 	__u8     role;
140166c853ccSGustavo F. Padovan } __packed;
14021da177e4SLinus Torvalds 
1403a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1404613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1405613a1c0cSAndrei Emeltchenko 	__le16   handle;
1406613a1c0cSAndrei Emeltchenko 	__le16   count;
1407613a1c0cSAndrei Emeltchenko } __packed;
1408613a1c0cSAndrei Emeltchenko 
1409a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1410a9de9248SMarcel Holtmann 	__u8     num_hndl;
1411613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
141266c853ccSGustavo F. Padovan } __packed;
1413a9de9248SMarcel Holtmann 
14141da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
14151da177e4SLinus Torvalds struct hci_ev_mode_change {
14161da177e4SLinus Torvalds 	__u8     status;
14171ebb9252SMarcel Holtmann 	__le16   handle;
14181da177e4SLinus Torvalds 	__u8     mode;
14191ebb9252SMarcel Holtmann 	__le16   interval;
142066c853ccSGustavo F. Padovan } __packed;
14211da177e4SLinus Torvalds 
14221da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
14231da177e4SLinus Torvalds struct hci_ev_pin_code_req {
14241da177e4SLinus Torvalds 	bdaddr_t bdaddr;
142566c853ccSGustavo F. Padovan } __packed;
14261da177e4SLinus Torvalds 
14271da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
14281da177e4SLinus Torvalds struct hci_ev_link_key_req {
14291da177e4SLinus Torvalds 	bdaddr_t bdaddr;
143066c853ccSGustavo F. Padovan } __packed;
14311da177e4SLinus Torvalds 
14321da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
14331da177e4SLinus Torvalds struct hci_ev_link_key_notify {
14341da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14359b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
14361da177e4SLinus Torvalds 	__u8     key_type;
143766c853ccSGustavo F. Padovan } __packed;
14381da177e4SLinus Torvalds 
1439a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
14401da177e4SLinus Torvalds struct hci_ev_clock_offset {
14411da177e4SLinus Torvalds 	__u8     status;
14421ebb9252SMarcel Holtmann 	__le16   handle;
14431ebb9252SMarcel Holtmann 	__le16   clock_offset;
144466c853ccSGustavo F. Padovan } __packed;
14451da177e4SLinus Torvalds 
1446a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1447a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1448a8746417SMarcel Holtmann 	__u8     status;
1449a8746417SMarcel Holtmann 	__le16   handle;
1450a8746417SMarcel Holtmann 	__le16   pkt_type;
145166c853ccSGustavo F. Padovan } __packed;
1452a8746417SMarcel Holtmann 
145385a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
145485a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
145585a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
145685a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
145766c853ccSGustavo F. Padovan } __packed;
145885a1e930SMarcel Holtmann 
1459a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1460a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1461a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1462a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1463a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1464a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1465a9de9248SMarcel Holtmann 	__le16   clock_offset;
1466a9de9248SMarcel Holtmann 	__s8     rssi;
146766c853ccSGustavo F. Padovan } __packed;
1468a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1469a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1470a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1471a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1472a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1473a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1474a9de9248SMarcel Holtmann 	__le16   clock_offset;
1475a9de9248SMarcel Holtmann 	__s8     rssi;
147666c853ccSGustavo F. Padovan } __packed;
1477a9de9248SMarcel Holtmann 
1478a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1479a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1480a9de9248SMarcel Holtmann 	__u8     status;
1481a9de9248SMarcel Holtmann 	__le16   handle;
1482a9de9248SMarcel Holtmann 	__u8     page;
1483a9de9248SMarcel Holtmann 	__u8     max_page;
1484a9de9248SMarcel Holtmann 	__u8     features[8];
148566c853ccSGustavo F. Padovan } __packed;
1486a9de9248SMarcel Holtmann 
1487a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1488a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1489a9de9248SMarcel Holtmann 	__u8     status;
1490a9de9248SMarcel Holtmann 	__le16   handle;
1491a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1492a9de9248SMarcel Holtmann 	__u8     link_type;
1493a9de9248SMarcel Holtmann 	__u8     tx_interval;
1494a9de9248SMarcel Holtmann 	__u8     retrans_window;
1495a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1496a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1497a9de9248SMarcel Holtmann 	__u8     air_mode;
149866c853ccSGustavo F. Padovan } __packed;
1499a9de9248SMarcel Holtmann 
1500a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1501a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1502a9de9248SMarcel Holtmann 	__u8     status;
1503a9de9248SMarcel Holtmann 	__le16   handle;
1504a9de9248SMarcel Holtmann 	__u8     tx_interval;
1505a9de9248SMarcel Holtmann 	__u8     retrans_window;
1506a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1507a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
150866c853ccSGustavo F. Padovan } __packed;
1509a9de9248SMarcel Holtmann 
1510a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
151104837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
151204837f64SMarcel Holtmann 	__u8     status;
151304837f64SMarcel Holtmann 	__le16   handle;
151404837f64SMarcel Holtmann 	__le16   max_tx_latency;
151504837f64SMarcel Holtmann 	__le16   max_rx_latency;
151604837f64SMarcel Holtmann 	__le16   max_remote_timeout;
151704837f64SMarcel Holtmann 	__le16   max_local_timeout;
151866c853ccSGustavo F. Padovan } __packed;
151904837f64SMarcel Holtmann 
1520a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1521a9de9248SMarcel Holtmann struct extended_inquiry_info {
1522a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1523a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1524a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1525a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1526a9de9248SMarcel Holtmann 	__le16   clock_offset;
1527a9de9248SMarcel Holtmann 	__s8     rssi;
1528a9de9248SMarcel Holtmann 	__u8     data[240];
152966c853ccSGustavo F. Padovan } __packed;
1530a9de9248SMarcel Holtmann 
15311c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
15321c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
15331c2e0041SJohan Hedberg 	__u8	status;
15341c2e0041SJohan Hedberg 	__le16	handle;
15351c2e0041SJohan Hedberg } __packed;
15361c2e0041SJohan Hedberg 
15370493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
15380493684eSMarcel Holtmann struct hci_ev_io_capa_request {
15390493684eSMarcel Holtmann 	bdaddr_t bdaddr;
154066c853ccSGustavo F. Padovan } __packed;
15410493684eSMarcel Holtmann 
154203b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
154303b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
154403b555e1SJohan Hedberg 	bdaddr_t bdaddr;
154503b555e1SJohan Hedberg 	__u8     capability;
154603b555e1SJohan Hedberg 	__u8     oob_data;
154703b555e1SJohan Hedberg 	__u8     authentication;
154803b555e1SJohan Hedberg } __packed;
154903b555e1SJohan Hedberg 
1550a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1551a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1552a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1553a5c29683SJohan Hedberg 	__le32		passkey;
1554a5c29683SJohan Hedberg } __packed;
1555a5c29683SJohan Hedberg 
15569ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
15579ad4019aSBrian Gix struct hci_ev_user_passkey_req {
15589ad4019aSBrian Gix 	bdaddr_t	bdaddr;
15599ad4019aSBrian Gix } __packed;
15609ad4019aSBrian Gix 
15612763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
15622763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
15632763eda6SSzymon Janc 	bdaddr_t bdaddr;
15642763eda6SSzymon Janc } __packed;
15652763eda6SSzymon Janc 
15660493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
15670493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
15680493684eSMarcel Holtmann 	__u8     status;
15690493684eSMarcel Holtmann 	bdaddr_t bdaddr;
157066c853ccSGustavo F. Padovan } __packed;
15710493684eSMarcel Holtmann 
157292a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
157392a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
157492a25256SJohan Hedberg 	bdaddr_t	bdaddr;
157592a25256SJohan Hedberg 	__le32		passkey;
157692a25256SJohan Hedberg } __packed;
157792a25256SJohan Hedberg 
157892a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
157992a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
158092a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
158192a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
158292a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
158392a25256SJohan Hedberg 
158492a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
158592a25256SJohan Hedberg struct hci_ev_keypress_notify {
158692a25256SJohan Hedberg 	bdaddr_t	bdaddr;
158792a25256SJohan Hedberg 	__u8		type;
158892a25256SJohan Hedberg } __packed;
158992a25256SJohan Hedberg 
159041a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
159141a96212SMarcel Holtmann struct hci_ev_remote_host_features {
159241a96212SMarcel Holtmann 	bdaddr_t bdaddr;
159341a96212SMarcel Holtmann 	__u8     features[8];
159466c853ccSGustavo F. Padovan } __packed;
159541a96212SMarcel Holtmann 
159663185f64SVille Tervo #define HCI_EV_LE_META			0x3e
159763185f64SVille Tervo struct hci_ev_le_meta {
159863185f64SVille Tervo 	__u8     subevent;
159963185f64SVille Tervo } __packed;
160063185f64SVille Tervo 
1601523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1602523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1603523e93cdSAndrei Emeltchenko 	__u8     status;
1604523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1605523e93cdSAndrei Emeltchenko } __packed;
1606523e93cdSAndrei Emeltchenko 
1607523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1608523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1609523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1610523e93cdSAndrei Emeltchenko } __packed;
1611523e93cdSAndrei Emeltchenko 
1612523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1613523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1614523e93cdSAndrei Emeltchenko 	__u8     status;
1615523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1616523e93cdSAndrei Emeltchenko 	__u8     reason;
1617523e93cdSAndrei Emeltchenko } __packed;
1618523e93cdSAndrei Emeltchenko 
1619523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1620523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1621523e93cdSAndrei Emeltchenko 	__u8     status;
1622523e93cdSAndrei Emeltchenko 	__le16   handle;
1623523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1624523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1625523e93cdSAndrei Emeltchenko } __packed;
1626523e93cdSAndrei Emeltchenko 
1627523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1628523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1629523e93cdSAndrei Emeltchenko 	__u8     status;
1630523e93cdSAndrei Emeltchenko 	__le16   handle;
1631523e93cdSAndrei Emeltchenko 	__u8     reason;
1632523e93cdSAndrei Emeltchenko } __packed;
1633523e93cdSAndrei Emeltchenko 
163425e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
163525e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
163625e89e99SAndrei Emeltchenko 	__le16   handle;
163725e89e99SAndrei Emeltchenko 	__le16   pkts;
163825e89e99SAndrei Emeltchenko 	__le16   blocks;
163925e89e99SAndrei Emeltchenko } __packed;
164025e89e99SAndrei Emeltchenko 
164125e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
164225e89e99SAndrei Emeltchenko 	__le16   num_blocks;
164325e89e99SAndrei Emeltchenko 	__u8     num_hndl;
164425e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
164525e89e99SAndrei Emeltchenko } __packed;
164625e89e99SAndrei Emeltchenko 
16472b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
16482b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
16492b359445SDoHyun Pyun 	__u8	status;
16502b359445SDoHyun Pyun } __packed;
16512b359445SDoHyun Pyun 
16522ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
16532ed01805SDoHyun Pyun 
165463185f64SVille Tervo /* Low energy meta events */
1655b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1656b9b343d2SAndre Guedes 
165763185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
165863185f64SVille Tervo struct hci_ev_le_conn_complete {
165963185f64SVille Tervo 	__u8     status;
166063185f64SVille Tervo 	__le16   handle;
166163185f64SVille Tervo 	__u8     role;
166263185f64SVille Tervo 	__u8     bdaddr_type;
166363185f64SVille Tervo 	bdaddr_t bdaddr;
166463185f64SVille Tervo 	__le16   interval;
166563185f64SVille Tervo 	__le16   latency;
166663185f64SVille Tervo 	__le16   supervision_timeout;
166763185f64SVille Tervo 	__u8     clk_accurancy;
166863185f64SVille Tervo } __packed;
166963185f64SVille Tervo 
16701855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
16711855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
16721855d92dSMarcel Holtmann 	__u8     status;
16731855d92dSMarcel Holtmann 	__le16   handle;
16741855d92dSMarcel Holtmann 	__le16   interval;
16751855d92dSMarcel Holtmann 	__le16   latency;
16761855d92dSMarcel Holtmann 	__le16   supervision_timeout;
16771855d92dSMarcel Holtmann } __packed;
16781855d92dSMarcel Holtmann 
1679a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1680a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1681a7a595f6SVinicius Costa Gomes 	__le16	handle;
1682fe39c7b2SMarcel Holtmann 	__le64	rand;
1683a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1684a7a595f6SVinicius Costa Gomes } __packed;
1685a7a595f6SVinicius Costa Gomes 
168657a56fd4SAnderson Briglia /* Advertising report event types */
1687db3aebf4SMarcel Holtmann #define LE_ADV_IND		0x00
1688db3aebf4SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
1689db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
1690db3aebf4SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
1691db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
169257a56fd4SAnderson Briglia 
169357a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
169457a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
169557a56fd4SAnderson Briglia 
169657a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
169757a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
169857a56fd4SAnderson Briglia 	__u8	 evt_type;
169957a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
170057a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
170157a56fd4SAnderson Briglia 	__u8	 length;
170257a56fd4SAnderson Briglia 	__u8	 data[0];
170357a56fd4SAnderson Briglia } __packed;
170457a56fd4SAnderson Briglia 
17051da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1706a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
17071da177e4SLinus Torvalds struct hci_ev_stack_internal {
17081da177e4SLinus Torvalds 	__u16    type;
17091da177e4SLinus Torvalds 	__u8     data[0];
171066c853ccSGustavo F. Padovan } __packed;
17111da177e4SLinus Torvalds 
17121da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
17131da177e4SLinus Torvalds struct hci_ev_si_device {
17141da177e4SLinus Torvalds 	__u16    event;
17151da177e4SLinus Torvalds 	__u16    dev_id;
171666c853ccSGustavo F. Padovan } __packed;
17171da177e4SLinus Torvalds 
17181da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
17191da177e4SLinus Torvalds struct hci_ev_si_security {
17201da177e4SLinus Torvalds 	__u16    event;
17211da177e4SLinus Torvalds 	__u16    proto;
17221da177e4SLinus Torvalds 	__u16    subproto;
17231da177e4SLinus Torvalds 	__u8     incoming;
172466c853ccSGustavo F. Padovan } __packed;
17251da177e4SLinus Torvalds 
17261da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
17271da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
17281da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
17291da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
17301da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
17311da177e4SLinus Torvalds 
17321da177e4SLinus Torvalds struct hci_command_hdr {
17331ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
17341da177e4SLinus Torvalds 	__u8	plen;
173566c853ccSGustavo F. Padovan } __packed;
17361da177e4SLinus Torvalds 
17371da177e4SLinus Torvalds struct hci_event_hdr {
17381da177e4SLinus Torvalds 	__u8	evt;
17391da177e4SLinus Torvalds 	__u8	plen;
174066c853ccSGustavo F. Padovan } __packed;
17411da177e4SLinus Torvalds 
17421da177e4SLinus Torvalds struct hci_acl_hdr {
17431ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
17441ebb9252SMarcel Holtmann 	__le16	dlen;
174566c853ccSGustavo F. Padovan } __packed;
17461da177e4SLinus Torvalds 
17471da177e4SLinus Torvalds struct hci_sco_hdr {
17481ebb9252SMarcel Holtmann 	__le16	handle;
17491da177e4SLinus Torvalds 	__u8	dlen;
175066c853ccSGustavo F. Padovan } __packed;
17511da177e4SLinus Torvalds 
17522a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
17532a123b86SArnaldo Carvalho de Melo {
17542a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
17552a123b86SArnaldo Carvalho de Melo }
17562a123b86SArnaldo Carvalho de Melo 
17572a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
17582a123b86SArnaldo Carvalho de Melo {
17592a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
17602a123b86SArnaldo Carvalho de Melo }
17612a123b86SArnaldo Carvalho de Melo 
17622a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
17632a123b86SArnaldo Carvalho de Melo {
17642a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
17652a123b86SArnaldo Carvalho de Melo }
17662a123b86SArnaldo Carvalho de Melo 
17671da177e4SLinus Torvalds /* Command opcode pack/unpack */
1768c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
17691da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
17701da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
17711da177e4SLinus Torvalds 
17721da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1773c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
17741da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
17751da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
17761da177e4SLinus Torvalds 
17771da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
17781da177e4SLinus Torvalds 
17791da177e4SLinus Torvalds /* Socket options */
17801da177e4SLinus Torvalds #define HCI_DATA_DIR	1
17811da177e4SLinus Torvalds #define HCI_FILTER	2
17821da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
17831da177e4SLinus Torvalds 
17841da177e4SLinus Torvalds /* CMSG flags */
17851da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
17861da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
17871da177e4SLinus Torvalds 
17881da177e4SLinus Torvalds struct sockaddr_hci {
17891da177e4SLinus Torvalds 	sa_family_t    hci_family;
17901da177e4SLinus Torvalds 	unsigned short hci_dev;
1791c02178d2SJohan Hedberg 	unsigned short hci_channel;
17921da177e4SLinus Torvalds };
17931da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
17941da177e4SLinus Torvalds 
1795c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
179623500189SMarcel Holtmann #define HCI_CHANNEL_USER	1
1797cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
179866f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1799c02178d2SJohan Hedberg 
18001da177e4SLinus Torvalds struct hci_filter {
18011da177e4SLinus Torvalds 	unsigned long type_mask;
18021da177e4SLinus Torvalds 	unsigned long event_mask[2];
1803905f3ed6SAl Viro 	__le16 opcode;
18041da177e4SLinus Torvalds };
18051da177e4SLinus Torvalds 
18061da177e4SLinus Torvalds struct hci_ufilter {
18071da177e4SLinus Torvalds 	__u32  type_mask;
18081da177e4SLinus Torvalds 	__u32  event_mask[2];
1809905f3ed6SAl Viro 	__le16 opcode;
18101da177e4SLinus Torvalds };
18111da177e4SLinus Torvalds 
18121da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
18131da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
18141da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
18151da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
18161da177e4SLinus Torvalds 
18171da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
18181da177e4SLinus Torvalds struct hci_dev_stats {
18191da177e4SLinus Torvalds 	__u32 err_rx;
18201da177e4SLinus Torvalds 	__u32 err_tx;
18211da177e4SLinus Torvalds 	__u32 cmd_tx;
18221da177e4SLinus Torvalds 	__u32 evt_rx;
18231da177e4SLinus Torvalds 	__u32 acl_tx;
18241da177e4SLinus Torvalds 	__u32 acl_rx;
18251da177e4SLinus Torvalds 	__u32 sco_tx;
18261da177e4SLinus Torvalds 	__u32 sco_rx;
18271da177e4SLinus Torvalds 	__u32 byte_rx;
18281da177e4SLinus Torvalds 	__u32 byte_tx;
18291da177e4SLinus Torvalds };
18301da177e4SLinus Torvalds 
18311da177e4SLinus Torvalds struct hci_dev_info {
18321da177e4SLinus Torvalds 	__u16 dev_id;
18331da177e4SLinus Torvalds 	char  name[8];
18341da177e4SLinus Torvalds 
18351da177e4SLinus Torvalds 	bdaddr_t bdaddr;
18361da177e4SLinus Torvalds 
18371da177e4SLinus Torvalds 	__u32 flags;
18381da177e4SLinus Torvalds 	__u8  type;
18391da177e4SLinus Torvalds 
18401da177e4SLinus Torvalds 	__u8  features[8];
18411da177e4SLinus Torvalds 
18421da177e4SLinus Torvalds 	__u32 pkt_type;
18431da177e4SLinus Torvalds 	__u32 link_policy;
18441da177e4SLinus Torvalds 	__u32 link_mode;
18451da177e4SLinus Torvalds 
18461da177e4SLinus Torvalds 	__u16 acl_mtu;
18471da177e4SLinus Torvalds 	__u16 acl_pkts;
18481da177e4SLinus Torvalds 	__u16 sco_mtu;
18491da177e4SLinus Torvalds 	__u16 sco_pkts;
18501da177e4SLinus Torvalds 
18511da177e4SLinus Torvalds 	struct hci_dev_stats stat;
18521da177e4SLinus Torvalds };
18531da177e4SLinus Torvalds 
18541da177e4SLinus Torvalds struct hci_conn_info {
18551da177e4SLinus Torvalds 	__u16    handle;
18561da177e4SLinus Torvalds 	bdaddr_t bdaddr;
18571da177e4SLinus Torvalds 	__u8     type;
18581da177e4SLinus Torvalds 	__u8     out;
18591da177e4SLinus Torvalds 	__u16    state;
18601da177e4SLinus Torvalds 	__u32    link_mode;
18611da177e4SLinus Torvalds };
18621da177e4SLinus Torvalds 
18631da177e4SLinus Torvalds struct hci_dev_req {
18641da177e4SLinus Torvalds 	__u16  dev_id;
18651da177e4SLinus Torvalds 	__u32  dev_opt;
18661da177e4SLinus Torvalds };
18671da177e4SLinus Torvalds 
18681da177e4SLinus Torvalds struct hci_dev_list_req {
18691da177e4SLinus Torvalds 	__u16  dev_num;
18701da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
18711da177e4SLinus Torvalds };
18721da177e4SLinus Torvalds 
18731da177e4SLinus Torvalds struct hci_conn_list_req {
18741da177e4SLinus Torvalds 	__u16  dev_id;
18751da177e4SLinus Torvalds 	__u16  conn_num;
18761da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
18771da177e4SLinus Torvalds };
18781da177e4SLinus Torvalds 
18791da177e4SLinus Torvalds struct hci_conn_info_req {
18801da177e4SLinus Torvalds 	bdaddr_t bdaddr;
18811da177e4SLinus Torvalds 	__u8     type;
18821da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
18831da177e4SLinus Torvalds };
18841da177e4SLinus Torvalds 
188540be492fSMarcel Holtmann struct hci_auth_info_req {
188640be492fSMarcel Holtmann 	bdaddr_t bdaddr;
188740be492fSMarcel Holtmann 	__u8     type;
188840be492fSMarcel Holtmann };
188940be492fSMarcel Holtmann 
18901da177e4SLinus Torvalds struct hci_inquiry_req {
18911da177e4SLinus Torvalds 	__u16 dev_id;
18921da177e4SLinus Torvalds 	__u16 flags;
18931da177e4SLinus Torvalds 	__u8  lap[3];
18941da177e4SLinus Torvalds 	__u8  length;
18951da177e4SLinus Torvalds 	__u8  num_rsp;
18961da177e4SLinus Torvalds };
18971da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
18981da177e4SLinus Torvalds 
18991da177e4SLinus Torvalds #endif /* __HCI_H */
1900