xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 7b5a9241b780ea2f77e71647bc0d3c9708c18ef1)
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 
107d23264a8SAndre Guedes /*
108d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
109d23264a8SAndre Guedes  * states from the controller.
110d23264a8SAndre Guedes  */
111d23264a8SAndre Guedes enum {
112a8b2d5c2SJohan Hedberg 	HCI_SETUP,
113a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1145e130367SJohan Hedberg 	HCI_RFKILLED,
115a8b2d5c2SJohan Hedberg 	HCI_MGMT,
116a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
117a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
118a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
1194b4148e9SMarcel Holtmann 	HCI_DUT_MODE,
1205afeac14SMarcel Holtmann 	HCI_FORCE_SC,
12194324962SJohan Hovold 	HCI_UNREGISTER,
1220736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
123a8b2d5c2SJohan Hedberg 
124d23264a8SAndre Guedes 	HCI_LE_SCAN,
12584bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
126e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
1276d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
12806199cf8SJohan Hedberg 	HCI_LE_ENABLED,
129f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
1305e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1315e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
1326acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
13347990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
13421693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1351a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
13656f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
13718722c24SJukka Rissanen 	HCI_6LOWPAN_ENABLED,
138d23264a8SAndre Guedes };
139d23264a8SAndre Guedes 
1402cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
1412cc6fb00SJohan Hedberg  * or the HCI device is closed.
1422cc6fb00SJohan Hedberg  */
1431a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
1441a4d3c4bSJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE))
1452cc6fb00SJohan Hedberg 
1461da177e4SLinus Torvalds /* HCI ioctl defines */
1471da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1481da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1491da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1501da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1511da177e4SLinus Torvalds 
1521da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1531da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1541da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1551da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
15640be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1571da177e4SLinus Torvalds 
1581da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1591da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1601da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1611da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1621da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1631da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1641da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1651da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1661da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1671da177e4SLinus Torvalds 
168f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
169f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
170f0358568SJohan Hedberg 
1711da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1721da177e4SLinus Torvalds 
1731da177e4SLinus Torvalds /* HCI timeouts */
1745f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1755f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1765f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
177d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
1785f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1799345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1801da177e4SLinus Torvalds 
1815b7f9909SMarcel Holtmann /* HCI data types */
1821da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1831da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1841da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1851da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1861da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1871da177e4SLinus Torvalds 
1885b7f9909SMarcel Holtmann /* HCI packet types */
1891da177e4SLinus Torvalds #define HCI_DM1		0x0008
1901da177e4SLinus Torvalds #define HCI_DM3		0x0400
1911da177e4SLinus Torvalds #define HCI_DM5		0x4000
1921da177e4SLinus Torvalds #define HCI_DH1		0x0010
1931da177e4SLinus Torvalds #define HCI_DH3		0x0800
1941da177e4SLinus Torvalds #define HCI_DH5		0x8000
1951da177e4SLinus Torvalds 
1961da177e4SLinus Torvalds #define HCI_HV1		0x0020
1971da177e4SLinus Torvalds #define HCI_HV2		0x0040
1981da177e4SLinus Torvalds #define HCI_HV3		0x0080
1991da177e4SLinus Torvalds 
2001da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2011da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2021da177e4SLinus Torvalds 
2035b7f9909SMarcel Holtmann /* eSCO packet types */
2045b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2055b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2065b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2075b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2085b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2095b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
210efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
211efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
212efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
213efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2145b7f9909SMarcel Holtmann 
215a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
216efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
217a8746417SMarcel Holtmann 
2181da177e4SLinus Torvalds /* ACL flags */
219e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2201da177e4SLinus Torvalds #define ACL_CONT		0x01
2211da177e4SLinus Torvalds #define ACL_START		0x02
222d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2231da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2241da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2251da177e4SLinus Torvalds 
2261da177e4SLinus Torvalds /* Baseband links */
2271da177e4SLinus Torvalds #define SCO_LINK	0x00
2281da177e4SLinus Torvalds #define ACL_LINK	0x01
2295b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
230fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
231fcd89c09SVille Tervo #define LE_LINK		0x80
2323161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2331da177e4SLinus Torvalds 
2341da177e4SLinus Torvalds /* LMP features */
2351da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2361da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2371da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2381da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2391da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2401da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2411da177e4SLinus Torvalds #define LMP_HOLD	0x40
24204837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2431da177e4SLinus Torvalds 
2441da177e4SLinus Torvalds #define LMP_PARK	0x01
2451da177e4SLinus Torvalds #define LMP_RSSI	0x02
2461da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2471da177e4SLinus Torvalds #define LMP_SCO		0x08
2481da177e4SLinus Torvalds #define LMP_HV2		0x10
2491da177e4SLinus Torvalds #define LMP_HV3		0x20
2501da177e4SLinus Torvalds #define LMP_ULAW	0x40
2511da177e4SLinus Torvalds #define LMP_ALAW	0x80
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds #define LMP_CVSD	0x01
2541da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2551da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
25607a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2571da177e4SLinus Torvalds 
258d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2595b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2605b7f9909SMarcel Holtmann 
2615b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2625b7f9909SMarcel Holtmann #define LMP_EV5		0x02
26369ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
264d5859e22SJohan Hedberg #define LMP_LE		0x40
2655b7f9909SMarcel Holtmann 
26604837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
267d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
268efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
269efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
270efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
27104837f64SMarcel Holtmann 
272d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
273e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
274769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
275e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
276769be974SMarcel Holtmann 
277d5859e22SJohan Hedberg #define LMP_LSTO	0x01
278d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
279971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
280d5859e22SJohan Hedberg 
281eead27daSAndre Guedes /* Extended LMP features */
28253b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
28353b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
28453b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
28553b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
28653b834d2SMarcel Holtmann 
287d5991585SMarcel Holtmann #define LMP_SC		0x01
288d5991585SMarcel Holtmann #define LMP_PING	0x02
289d5991585SMarcel Holtmann 
29053b834d2SMarcel Holtmann /* Host features */
291cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
292eead27daSAndre Guedes #define LMP_HOST_LE		0x02
293cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
294d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
295eead27daSAndre Guedes 
29604837f64SMarcel Holtmann /* Connection modes */
29704837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
29804837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
29904837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
30004837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
30104837f64SMarcel Holtmann 
3021da177e4SLinus Torvalds /* Link policies */
3031da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3041da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3051da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3061da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3071da177e4SLinus Torvalds 
30804837f64SMarcel Holtmann /* Link modes */
3091da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3101da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3111da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3121da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3131da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3141da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3151da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
316*7b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
3171da177e4SLinus Torvalds 
31840be492fSMarcel Holtmann /* Authentication types */
31940be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
32040be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
32140be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
32240be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
32340be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
32440be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
32540be492fSMarcel Holtmann 
326a77b15a6SMikel Astiz /* I/O capabilities */
327a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
328a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
329a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
330a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
331a77b15a6SMikel Astiz 
332b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
333b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
334b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
335b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
336b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
33711015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
33811015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
339b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
34011015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
34111015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
342b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
343b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
344b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
345b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
346b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
347b6020ba0SWaldemar Rymarkiewicz 
3489f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3499f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
350cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3519f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3529f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
353cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
354cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3559f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3569f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3579f5a0d7bSAndrei Emeltchenko 
3582455a3eaSAndrei Emeltchenko /* Flow control modes */
3592455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3602455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3612455a3eaSAndrei Emeltchenko 
362bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
363bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
364bbaf444aSJohan Hedberg 
36532748db0SJohan Hedberg /* Extended Inquiry Response field types */
36632748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
36732748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
36832748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
36932748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
37032748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
37132748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
37232748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
37332748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
37432748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
37532748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3769ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3779ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3789ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
37932748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
38032748db0SJohan Hedberg 
3813f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
3823f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
3833f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
3843f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
3853f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
3863f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
3873f0f524bSJohan Hedberg 
3881da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3896bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3906bd32326SVille Tervo 
391a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
392a9de9248SMarcel Holtmann struct hci_cp_inquiry {
393a9de9248SMarcel Holtmann 	__u8     lap[3];
394a9de9248SMarcel Holtmann 	__u8     length;
395a9de9248SMarcel Holtmann 	__u8     num_rsp;
39666c853ccSGustavo F. Padovan } __packed;
3971da177e4SLinus Torvalds 
398a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
399a9de9248SMarcel Holtmann 
40079d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
40179d6e068SAndre Guedes 
402a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
403a9de9248SMarcel Holtmann 
404a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
405a9de9248SMarcel Holtmann struct hci_cp_create_conn {
406a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
407a9de9248SMarcel Holtmann 	__le16   pkt_type;
408a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
409a9de9248SMarcel Holtmann 	__u8     pscan_mode;
410a9de9248SMarcel Holtmann 	__le16   clock_offset;
411a9de9248SMarcel Holtmann 	__u8     role_switch;
41266c853ccSGustavo F. Padovan } __packed;
4131da177e4SLinus Torvalds 
414a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
415a9de9248SMarcel Holtmann struct hci_cp_disconnect {
416a9de9248SMarcel Holtmann 	__le16   handle;
417a9de9248SMarcel Holtmann 	__u8     reason;
41866c853ccSGustavo F. Padovan } __packed;
4191da177e4SLinus Torvalds 
420a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
421a9de9248SMarcel Holtmann struct hci_cp_add_sco {
422a9de9248SMarcel Holtmann 	__le16   handle;
423a9de9248SMarcel Holtmann 	__le16   pkt_type;
42466c853ccSGustavo F. Padovan } __packed;
425a9de9248SMarcel Holtmann 
426a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
427a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4281da177e4SLinus Torvalds 	bdaddr_t bdaddr;
42966c853ccSGustavo F. Padovan } __packed;
4301da177e4SLinus Torvalds 
431a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
432a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
433a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
434a9de9248SMarcel Holtmann 	__u8     role;
43566c853ccSGustavo F. Padovan } __packed;
4361da177e4SLinus Torvalds 
437a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
438a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
439a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
440a9de9248SMarcel Holtmann 	__u8     reason;
44166c853ccSGustavo F. Padovan } __packed;
4421da177e4SLinus Torvalds 
443a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
444a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
445a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4469b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
44766c853ccSGustavo F. Padovan } __packed;
4481da177e4SLinus Torvalds 
449a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
450a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
451a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
45266c853ccSGustavo F. Padovan } __packed;
4531da177e4SLinus Torvalds 
454a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
455a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
456a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
457a9de9248SMarcel Holtmann 	__u8     pin_len;
458a9de9248SMarcel Holtmann 	__u8     pin_code[16];
45966c853ccSGustavo F. Padovan } __packed;
460980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
461980e1a53SJohan Hedberg 	__u8     status;
462980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
463980e1a53SJohan Hedberg } __packed;
464a9de9248SMarcel Holtmann 
465a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
466a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
467a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
46866c853ccSGustavo F. Padovan } __packed;
469980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
470980e1a53SJohan Hedberg 	__u8     status;
471980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
472980e1a53SJohan Hedberg } __packed;
473a9de9248SMarcel Holtmann 
474a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
475a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
476a9de9248SMarcel Holtmann 	__le16   handle;
477a9de9248SMarcel Holtmann 	__le16   pkt_type;
47866c853ccSGustavo F. Padovan } __packed;
479a9de9248SMarcel Holtmann 
480a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
481a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
482a9de9248SMarcel Holtmann 	__le16   handle;
48366c853ccSGustavo F. Padovan } __packed;
484a9de9248SMarcel Holtmann 
485a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
486a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
487a9de9248SMarcel Holtmann 	__le16   handle;
488a9de9248SMarcel Holtmann 	__u8     encrypt;
48966c853ccSGustavo F. Padovan } __packed;
490a9de9248SMarcel Holtmann 
491a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
492a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
493a9de9248SMarcel Holtmann 	__le16   handle;
49466c853ccSGustavo F. Padovan } __packed;
495a9de9248SMarcel Holtmann 
496a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
497a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
498a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
499a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
500a9de9248SMarcel Holtmann 	__u8     pscan_mode;
501a9de9248SMarcel Holtmann 	__le16   clock_offset;
50266c853ccSGustavo F. Padovan } __packed;
503a9de9248SMarcel Holtmann 
504a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
505a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
506a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
50766c853ccSGustavo F. Padovan } __packed;
508a9de9248SMarcel Holtmann 
509a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
510a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
511a9de9248SMarcel Holtmann 	__le16   handle;
51266c853ccSGustavo F. Padovan } __packed;
513a9de9248SMarcel Holtmann 
514a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
515a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
516a9de9248SMarcel Holtmann 	__le16   handle;
517a9de9248SMarcel Holtmann 	__u8     page;
51866c853ccSGustavo F. Padovan } __packed;
519a9de9248SMarcel Holtmann 
520a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
521a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
522a9de9248SMarcel Holtmann 	__le16   handle;
52366c853ccSGustavo F. Padovan } __packed;
524a9de9248SMarcel Holtmann 
525a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
526a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
527a9de9248SMarcel Holtmann 	__le16   handle;
528a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
529a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
530a9de9248SMarcel Holtmann 	__le16   max_latency;
531a9de9248SMarcel Holtmann 	__le16   voice_setting;
532a9de9248SMarcel Holtmann 	__u8     retrans_effort;
533a9de9248SMarcel Holtmann 	__le16   pkt_type;
53466c853ccSGustavo F. Padovan } __packed;
535a9de9248SMarcel Holtmann 
536a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
537a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
538a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
539a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
540a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
541a9de9248SMarcel Holtmann 	__le16   max_latency;
542a9de9248SMarcel Holtmann 	__le16   content_format;
543a9de9248SMarcel Holtmann 	__u8     retrans_effort;
544a9de9248SMarcel Holtmann 	__le16   pkt_type;
54566c853ccSGustavo F. Padovan } __packed;
546a9de9248SMarcel Holtmann 
547a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
548a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
549a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
550a9de9248SMarcel Holtmann 	__u8     reason;
55166c853ccSGustavo F. Padovan } __packed;
552a9de9248SMarcel Holtmann 
55317fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
55417fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
55517fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
55617fa4b9dSJohan Hedberg 	__u8     capability;
55717fa4b9dSJohan Hedberg 	__u8     oob_data;
55817fa4b9dSJohan Hedberg 	__u8     authentication;
55917fa4b9dSJohan Hedberg } __packed;
56017fa4b9dSJohan Hedberg 
561a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
562a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
563a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
564a5c29683SJohan Hedberg } __packed;
565a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
566a5c29683SJohan Hedberg 	__u8     status;
567a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
568a5c29683SJohan Hedberg } __packed;
569a5c29683SJohan Hedberg 
570a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
571a5c29683SJohan Hedberg 
5729ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5739ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5749ad4019aSBrian Gix 	bdaddr_t bdaddr;
5759ad4019aSBrian Gix 	__le32	passkey;
5769ad4019aSBrian Gix } __packed;
5779ad4019aSBrian Gix 
5789ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5799ad4019aSBrian Gix 
5802763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5812763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5822763eda6SSzymon Janc 	bdaddr_t bdaddr;
5832763eda6SSzymon Janc 	__u8     hash[16];
5842763eda6SSzymon Janc 	__u8     randomizer[16];
5852763eda6SSzymon Janc } __packed;
5862763eda6SSzymon Janc 
5872763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5882763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5892763eda6SSzymon Janc 	bdaddr_t bdaddr;
5902763eda6SSzymon Janc } __packed;
5912763eda6SSzymon Janc 
59203b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
59303b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
59403b555e1SJohan Hedberg 	bdaddr_t bdaddr;
59503b555e1SJohan Hedberg 	__u8     reason;
59603b555e1SJohan Hedberg } __packed;
59703b555e1SJohan Hedberg 
598523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
599523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
600523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
601523e93cdSAndrei Emeltchenko 	__u8     key_len;
602523e93cdSAndrei Emeltchenko 	__u8     key_type;
603523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
604523e93cdSAndrei Emeltchenko } __packed;
605523e93cdSAndrei Emeltchenko 
606523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
607523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
608523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
609523e93cdSAndrei Emeltchenko 	__u8     key_len;
610523e93cdSAndrei Emeltchenko 	__u8     key_type;
611523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
612523e93cdSAndrei Emeltchenko } __packed;
613523e93cdSAndrei Emeltchenko 
614523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
615523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
616523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
617523e93cdSAndrei Emeltchenko 	__u8     reason;
618b078b564SAndrei Emeltchenko } __packed;
619b078b564SAndrei Emeltchenko 
620b078b564SAndrei Emeltchenko struct ext_flow_spec {
621b078b564SAndrei Emeltchenko 	__u8       id;
622b078b564SAndrei Emeltchenko 	__u8       stype;
623b078b564SAndrei Emeltchenko 	__le16     msdu;
624b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
625b078b564SAndrei Emeltchenko 	__le32     acc_lat;
626b078b564SAndrei Emeltchenko 	__le32     flush_to;
627b078b564SAndrei Emeltchenko } __packed;
628b078b564SAndrei Emeltchenko 
629b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
630b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
631b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
632b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
633b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
634b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
635b078b564SAndrei Emeltchenko } __packed;
636b078b564SAndrei Emeltchenko 
637b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
638b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
639b078b564SAndrei Emeltchenko 	__le16   log_handle;
640b078b564SAndrei Emeltchenko } __packed;
641b078b564SAndrei Emeltchenko 
642b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
643b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
644b078b564SAndrei Emeltchenko 	__u8     phy_handle;
645b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
646b078b564SAndrei Emeltchenko } __packed;
647b078b564SAndrei Emeltchenko 
648b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
649b078b564SAndrei Emeltchenko 	__u8     status;
650b078b564SAndrei Emeltchenko 	__u8     phy_handle;
651b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
652523e93cdSAndrei Emeltchenko } __packed;
653523e93cdSAndrei Emeltchenko 
6548c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
6558c9a041bSDoHyun Pyun struct hci_cp_set_csb {
6568c9a041bSDoHyun Pyun 	__u8	enable;
6578c9a041bSDoHyun Pyun 	__u8	lt_addr;
6588c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
6598c9a041bSDoHyun Pyun 	__le16	packet_type;
6608c9a041bSDoHyun Pyun 	__le16	interval_min;
6618c9a041bSDoHyun Pyun 	__le16	interval_max;
6628c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
6638c9a041bSDoHyun Pyun } __packed;
6648c9a041bSDoHyun Pyun struct hci_rp_set_csb {
6658c9a041bSDoHyun Pyun 	__u8	status;
6668c9a041bSDoHyun Pyun 	__u8	lt_addr;
6678c9a041bSDoHyun Pyun 	__le16	interval;
6688c9a041bSDoHyun Pyun } __packed;
6698c9a041bSDoHyun Pyun 
670cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
671cefded98SDoHyun Pyun 
672e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
673e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
674e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
675e2f99131SMarcel Holtmann 	__u8     hash192[16];
676e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
677e2f99131SMarcel Holtmann 	__u8     hash256[16];
678e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
679e2f99131SMarcel Holtmann } __packed;
680e2f99131SMarcel Holtmann 
681a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
682a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
683a9de9248SMarcel Holtmann 	__le16   handle;
684a9de9248SMarcel Holtmann 	__le16   max_interval;
685a9de9248SMarcel Holtmann 	__le16   min_interval;
686a9de9248SMarcel Holtmann 	__le16   attempt;
687a9de9248SMarcel Holtmann 	__le16   timeout;
68866c853ccSGustavo F. Padovan } __packed;
689a9de9248SMarcel Holtmann 
690a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
691a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
692a9de9248SMarcel Holtmann 	__le16   handle;
69366c853ccSGustavo F. Padovan } __packed;
694a9de9248SMarcel Holtmann 
695a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
696a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
697a9de9248SMarcel Holtmann 	__le16   handle;
69866c853ccSGustavo F. Padovan } __packed;
699a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
700a9de9248SMarcel Holtmann 	__u8     status;
701a9de9248SMarcel Holtmann 	__le16   handle;
702a9de9248SMarcel Holtmann 	__u8     role;
70366c853ccSGustavo F. Padovan } __packed;
704a9de9248SMarcel Holtmann 
705a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
706a9de9248SMarcel Holtmann struct hci_cp_switch_role {
707a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
708a9de9248SMarcel Holtmann 	__u8     role;
70966c853ccSGustavo F. Padovan } __packed;
710a9de9248SMarcel Holtmann 
711a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
712a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
713a9de9248SMarcel Holtmann 	__le16   handle;
71466c853ccSGustavo F. Padovan } __packed;
715a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
716a9de9248SMarcel Holtmann 	__u8     status;
717a9de9248SMarcel Holtmann 	__le16   handle;
718a9de9248SMarcel Holtmann 	__le16   policy;
71966c853ccSGustavo F. Padovan } __packed;
720a9de9248SMarcel Holtmann 
721a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
722a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
723a9de9248SMarcel Holtmann 	__le16   handle;
724a9de9248SMarcel Holtmann 	__le16   policy;
72566c853ccSGustavo F. Padovan } __packed;
726a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
727a9de9248SMarcel Holtmann 	__u8     status;
728a9de9248SMarcel Holtmann 	__le16   handle;
72966c853ccSGustavo F. Padovan } __packed;
730a9de9248SMarcel Holtmann 
731e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
732e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
733e4e8e37cSMarcel Holtmann 	__u8     status;
734e4e8e37cSMarcel Holtmann 	__le16   policy;
73566c853ccSGustavo F. Padovan } __packed;
736e4e8e37cSMarcel Holtmann 
737e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
738e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
739e4e8e37cSMarcel Holtmann 	__le16   policy;
74066c853ccSGustavo F. Padovan } __packed;
741e4e8e37cSMarcel Holtmann 
742a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
743a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
744a9de9248SMarcel Holtmann 	__le16   handle;
745a9de9248SMarcel Holtmann 	__le16   max_latency;
746a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
747a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
74866c853ccSGustavo F. Padovan } __packed;
749a9de9248SMarcel Holtmann 
750a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
751a9de9248SMarcel Holtmann 
752a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
753a9de9248SMarcel Holtmann 
754a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
7551da177e4SLinus Torvalds struct hci_cp_set_event_flt {
7561da177e4SLinus Torvalds 	__u8     flt_type;
7571da177e4SLinus Torvalds 	__u8     cond_type;
7581da177e4SLinus Torvalds 	__u8     condition[0];
75966c853ccSGustavo F. Padovan } __packed;
7601da177e4SLinus Torvalds 
7611da177e4SLinus Torvalds /* Filter types */
7621da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
7631da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
7641da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
7651da177e4SLinus Torvalds 
7661da177e4SLinus Torvalds /* CONN_SETUP Condition types */
7671da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
7681da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
7691da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
7701da177e4SLinus Torvalds 
7711da177e4SLinus Torvalds /* CONN_SETUP Conditions */
7721da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
7731da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
7741da177e4SLinus Torvalds 
775b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
776b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
777b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
778b0916ea0SJohan Hedberg 	__u8     delete_all;
779b0916ea0SJohan Hedberg } __packed;
780b0916ea0SJohan Hedberg 
7811f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
7821f6c6378SJohan Hedberg 
783a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
784a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
7851f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
78666c853ccSGustavo F. Padovan } __packed;
787a9de9248SMarcel Holtmann 
788a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
789a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
790a9de9248SMarcel Holtmann 	__u8     status;
7911f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
79266c853ccSGustavo F. Padovan } __packed;
793a9de9248SMarcel Holtmann 
794a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
795a9de9248SMarcel Holtmann 
796a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
797a9de9248SMarcel Holtmann 
798a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
799a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
800a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
801a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
802a9de9248SMarcel Holtmann 
803a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
804a9de9248SMarcel Holtmann 
805a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
806a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
807a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
808a9de9248SMarcel Holtmann 
809a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
810a9de9248SMarcel Holtmann 
811a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
812a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
813a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
814a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
815a9de9248SMarcel Holtmann 
816a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
817a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
8181da177e4SLinus Torvalds 	__u8     status;
8191da177e4SLinus Torvalds 	__u8     dev_class[3];
82066c853ccSGustavo F. Padovan } __packed;
8211da177e4SLinus Torvalds 
822a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
823a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
8241da177e4SLinus Torvalds 	__u8     dev_class[3];
82566c853ccSGustavo F. Padovan } __packed;
8261da177e4SLinus Torvalds 
827a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
8281da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
8291da177e4SLinus Torvalds 	__u8     status;
8301ebb9252SMarcel Holtmann 	__le16   voice_setting;
83166c853ccSGustavo F. Padovan } __packed;
8321da177e4SLinus Torvalds 
833a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
8341da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
8351ebb9252SMarcel Holtmann 	__le16   voice_setting;
83666c853ccSGustavo F. Padovan } __packed;
8371da177e4SLinus Torvalds 
838a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
8391da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
8401ebb9252SMarcel Holtmann 	__le16   acl_mtu;
8411da177e4SLinus Torvalds 	__u8     sco_mtu;
8421ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
8431ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
84466c853ccSGustavo F. Padovan } __packed;
8451da177e4SLinus Torvalds 
846b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
847b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
848b4cb9fb2SMarcel Holtmann 	__u8	status;
849b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
850b4cb9fb2SMarcel Holtmann } __packed;
851b4cb9fb2SMarcel Holtmann 
8524b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
8534b836f39SMarcel Holtmann 
8543d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
8553d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
8563d505312SMarcel Holtmann 	__u8	num_iac;
8573d505312SMarcel Holtmann 	__u8	iac_lap[6];
8583d505312SMarcel Holtmann } __packed;
8593d505312SMarcel Holtmann 
860d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
861d5859e22SJohan Hedberg 
86280a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
86380a1e1dbSJohan Hedberg 
86480a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
86580a1e1dbSJohan Hedberg struct hci_cp_write_eir {
866816a11d5SJohan Hedberg 	__u8	fec;
867816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
86880a1e1dbSJohan Hedberg } __packed;
86980a1e1dbSJohan Hedberg 
870333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
871333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
872333140b5SMarcel Holtmann 	__u8     status;
873333140b5SMarcel Holtmann 	__u8     mode;
87466c853ccSGustavo F. Padovan } __packed;
875333140b5SMarcel Holtmann 
876333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
877333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
878333140b5SMarcel Holtmann 	__u8     mode;
87966c853ccSGustavo F. Padovan } __packed;
880333140b5SMarcel Holtmann 
881c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
882c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
883c35938b2SSzymon Janc 	__u8     status;
884c35938b2SSzymon Janc 	__u8     hash[16];
885c35938b2SSzymon Janc 	__u8     randomizer[16];
886c35938b2SSzymon Janc } __packed;
887c35938b2SSzymon Janc 
888d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
88991c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
89091c4e9b1SMarcel Holtmann 	__u8     status;
89191c4e9b1SMarcel Holtmann 	__s8     tx_power;
89291c4e9b1SMarcel Holtmann } __packed;
893d5859e22SJohan Hedberg 
894d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
895d62e6d67SJohan Hedberg 
8967528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
8977528ca1cSMarcel Holtmann 
8981e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
8991e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
9001e89cffbSAndrei Emeltchenko 	__u8     status;
9011e89cffbSAndrei Emeltchenko 	__u8     mode;
9021e89cffbSAndrei Emeltchenko } __packed;
9031e89cffbSAndrei Emeltchenko 
904f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
905f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
906f9b49306SAndre Guedes 	__u8	le;
907f9b49306SAndre Guedes 	__u8	simul;
908f9b49306SAndre Guedes } __packed;
909f9b49306SAndre Guedes 
910d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
911d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
912d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
913d0bf75a5SDoHyun Pyun } __packed;
914d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
915d0bf75a5SDoHyun Pyun 	__u8	status;
916d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
917d0bf75a5SDoHyun Pyun } __packed;
918d0bf75a5SDoHyun Pyun 
9196a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
9206a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
9216a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9226a20eaf4SDoHyun Pyun } __packed;
9236a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
9246a20eaf4SDoHyun Pyun 	__u8	status;
9256a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9266a20eaf4SDoHyun Pyun } __packed;
9276a20eaf4SDoHyun Pyun 
9287d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
9297d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
9307d1dab49SDoHyun Pyun 	__u8	lt_addr;
9317d1dab49SDoHyun Pyun 	__u8	fragment;
9327d1dab49SDoHyun Pyun 	__u8	data_length;
9337d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
9347d1dab49SDoHyun Pyun } __packed;
9357d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
9367d1dab49SDoHyun Pyun 	__u8	status;
9377d1dab49SDoHyun Pyun 	__u8	lt_addr;
9387d1dab49SDoHyun Pyun } __packed;
9397d1dab49SDoHyun Pyun 
9405d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
9415d4e7e8dSJohan Hedberg 
942a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
943a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
944a9b07a64SDoHyun Pyun 	__le16	interval_min;
945a9b07a64SDoHyun Pyun 	__le16	interval_max;
946a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
947a9b07a64SDoHyun Pyun 	__u8	service_data;
948a9b07a64SDoHyun Pyun } __packed;
949a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
950a9b07a64SDoHyun Pyun 	__u8	status;
951a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
952a9b07a64SDoHyun Pyun } __packed;
953a9b07a64SDoHyun Pyun 
954eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
955eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
956eb4b95c6SMarcel Holtmann 	__u8	status;
957eb4b95c6SMarcel Holtmann 	__u8	support;
958eb4b95c6SMarcel Holtmann } __packed;
959eb4b95c6SMarcel Holtmann 
960eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
961eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
962eb4b95c6SMarcel Holtmann 	__u8	support;
963eb4b95c6SMarcel Holtmann } __packed;
964eb4b95c6SMarcel Holtmann 
965e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
966e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
967e2f99131SMarcel Holtmann 	__u8     status;
968e2f99131SMarcel Holtmann 	__u8     hash192[16];
969e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
970e2f99131SMarcel Holtmann 	__u8     hash256[16];
971e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
972e2f99131SMarcel Holtmann } __packed;
973e2f99131SMarcel Holtmann 
974a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
975a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
9761da177e4SLinus Torvalds 	__u8     status;
977a9de9248SMarcel Holtmann 	__u8     hci_ver;
978a9de9248SMarcel Holtmann 	__le16   hci_rev;
979a9de9248SMarcel Holtmann 	__u8     lmp_ver;
980a9de9248SMarcel Holtmann 	__le16   manufacturer;
981a9de9248SMarcel Holtmann 	__le16   lmp_subver;
98266c853ccSGustavo F. Padovan } __packed;
9831da177e4SLinus Torvalds 
984a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
985a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
9861da177e4SLinus Torvalds 	__u8     status;
987a9de9248SMarcel Holtmann 	__u8     commands[64];
98866c853ccSGustavo F. Padovan } __packed;
9891da177e4SLinus Torvalds 
990a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
991a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
992a9de9248SMarcel Holtmann 	__u8     status;
993a9de9248SMarcel Holtmann 	__u8     features[8];
99466c853ccSGustavo F. Padovan } __packed;
995a9de9248SMarcel Holtmann 
996a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
997971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
998971e3a4bSAndre Guedes 	__u8     page;
999971e3a4bSAndre Guedes } __packed;
1000a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1001a9de9248SMarcel Holtmann 	__u8     status;
1002a9de9248SMarcel Holtmann 	__u8     page;
1003a9de9248SMarcel Holtmann 	__u8     max_page;
1004a9de9248SMarcel Holtmann 	__u8     features[8];
100566c853ccSGustavo F. Padovan } __packed;
1006a9de9248SMarcel Holtmann 
1007a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1008a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1009a9de9248SMarcel Holtmann 	__u8     status;
1010a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1011a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1012a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1013a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
101466c853ccSGustavo F. Padovan } __packed;
1015a9de9248SMarcel Holtmann 
1016a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1017a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1018a9de9248SMarcel Holtmann 	__u8     status;
10191da177e4SLinus Torvalds 	bdaddr_t bdaddr;
102066c853ccSGustavo F. Padovan } __packed;
10211da177e4SLinus Torvalds 
1022350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1023350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1024350ee4cfSAndrei Emeltchenko 	__u8     status;
1025350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1026350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1027350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1028350ee4cfSAndrei Emeltchenko } __packed;
1029350ee4cfSAndrei Emeltchenko 
1030f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1031f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1032f332ec66SJohan Hedberg 	__u8     status;
1033f332ec66SJohan Hedberg 	__le16   interval;
1034f332ec66SJohan Hedberg 	__le16   window;
1035f332ec66SJohan Hedberg } __packed;
1036f332ec66SJohan Hedberg 
1037f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1038f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1039f6422ec6SAntti Julku 	__le16   interval;
1040f6422ec6SAntti Julku 	__le16   window;
1041f6422ec6SAntti Julku } __packed;
1042f6422ec6SAntti Julku 
1043f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1044f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1045f332ec66SJohan Hedberg 	__u8     status;
1046f332ec66SJohan Hedberg 	__u8     type;
1047f332ec66SJohan Hedberg } __packed;
1048f332ec66SJohan Hedberg 
1049f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1050f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1051f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1052f6422ec6SAntti Julku 
1053928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1054928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1055928abaa7SAndrei Emeltchenko 	__u8     status;
1056928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1057928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1058928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1059928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1060928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1061928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1062928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1063928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1064928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1065928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1066928abaa7SAndrei Emeltchenko } __packed;
1067928abaa7SAndrei Emeltchenko 
1068523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1069523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1070523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1071523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1072523e93cdSAndrei Emeltchenko 	__le16   max_len;
1073523e93cdSAndrei Emeltchenko } __packed;
1074523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1075523e93cdSAndrei Emeltchenko 	__u8     status;
1076523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1077523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1078523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1079523e93cdSAndrei Emeltchenko } __packed;
1080523e93cdSAndrei Emeltchenko 
1081523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1082523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1083523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1084523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1085523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1086523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1087523e93cdSAndrei Emeltchenko } __packed;
1088523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1089523e93cdSAndrei Emeltchenko 	__u8     status;
1090523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1091523e93cdSAndrei Emeltchenko } __packed;
1092523e93cdSAndrei Emeltchenko 
10934b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
10944b4148e9SMarcel Holtmann 
109506f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
109606f5b778SMarcel Holtmann 
109763185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
109863185f64SVille Tervo struct hci_cp_le_set_event_mask {
109963185f64SVille Tervo 	__u8     mask[8];
110063185f64SVille Tervo } __packed;
110163185f64SVille Tervo 
110263185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
110363185f64SVille Tervo struct hci_rp_le_read_buffer_size {
110463185f64SVille Tervo 	__u8     status;
110563185f64SVille Tervo 	__le16   le_mtu;
110663185f64SVille Tervo 	__u8     le_max_pkt;
110763185f64SVille Tervo } __packed;
110863185f64SVille Tervo 
110960e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
111060e77321SJohan Hedberg struct hci_rp_le_read_local_features {
111160e77321SJohan Hedberg 	__u8     status;
111260e77321SJohan Hedberg 	__u8     features[8];
111360e77321SJohan Hedberg } __packed;
111460e77321SJohan Hedberg 
1115d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1116d13eafceSMarcel Holtmann 
11171e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
11181e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
11191e191893SMarcel Holtmann 	__le16   min_interval;
11201e191893SMarcel Holtmann 	__le16   max_interval;
11211e191893SMarcel Holtmann 	__u8     type;
11221e191893SMarcel Holtmann 	__u8     own_address_type;
11231e191893SMarcel Holtmann 	__u8     direct_addr_type;
11241e191893SMarcel Holtmann 	bdaddr_t direct_addr;
11251e191893SMarcel Holtmann 	__u8     channel_map;
11261e191893SMarcel Holtmann 	__u8     filter_policy;
11271e191893SMarcel Holtmann } __packed;
11281e191893SMarcel Holtmann 
11298fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
11308fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
11318fa19098SJohan Hedberg 	__u8	status;
11328fa19098SJohan Hedberg 	__s8	tx_power;
11338fa19098SJohan Hedberg } __packed;
11348fa19098SJohan Hedberg 
11353f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
11363f0f524bSJohan Hedberg 
11373f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
11383f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
11393f0f524bSJohan Hedberg 	__u8	length;
11403f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
11413f0f524bSJohan Hedberg } __packed;
11423f0f524bSJohan Hedberg 
1143f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1144f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1145f14d8f64SMarcel Holtmann 	__u8	length;
1146f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1147f14d8f64SMarcel Holtmann } __packed;
1148f14d8f64SMarcel Holtmann 
1149c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1150c1d5dc4aSJohan Hedberg 
11515df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
11525df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
11535df480b5SAndre Guedes 
115407f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
115507f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
115607f7fa5dSAndre Guedes 	__u8    type;
115707f7fa5dSAndre Guedes 	__le16  interval;
115807f7fa5dSAndre Guedes 	__le16  window;
115907f7fa5dSAndre Guedes 	__u8    own_address_type;
116007f7fa5dSAndre Guedes 	__u8    filter_policy;
116107f7fa5dSAndre Guedes } __packed;
116207f7fa5dSAndre Guedes 
116376a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
116476a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1165525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1166525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
116768a8aea4SAndrei Emeltchenko 
1168eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1169eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1170eb9d91f5SAndre Guedes 	__u8     enable;
1171eb9d91f5SAndre Guedes 	__u8     filter_dup;
1172eb9d91f5SAndre Guedes } __packed;
1173eb9d91f5SAndre Guedes 
117463185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
117563185f64SVille Tervo struct hci_cp_le_create_conn {
117663185f64SVille Tervo 	__le16   scan_interval;
117763185f64SVille Tervo 	__le16   scan_window;
117863185f64SVille Tervo 	__u8     filter_policy;
117963185f64SVille Tervo 	__u8     peer_addr_type;
118063185f64SVille Tervo 	bdaddr_t peer_addr;
118163185f64SVille Tervo 	__u8     own_address_type;
118263185f64SVille Tervo 	__le16   conn_interval_min;
118363185f64SVille Tervo 	__le16   conn_interval_max;
118463185f64SVille Tervo 	__le16   conn_latency;
118563185f64SVille Tervo 	__le16   supervision_timeout;
118663185f64SVille Tervo 	__le16   min_ce_len;
118763185f64SVille Tervo 	__le16   max_ce_len;
118863185f64SVille Tervo } __packed;
118963185f64SVille Tervo 
119063185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
119163185f64SVille Tervo 
1192cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1193cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1194cf1d081fSJohan Hedberg 	__u8	status;
1195cf1d081fSJohan Hedberg 	__u8	size;
1196cf1d081fSJohan Hedberg } __packed;
1197cf1d081fSJohan Hedberg 
11982ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
11992ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
12002ce603ebSClaudio Takahasi 	__le16   handle;
12012ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
12022ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
12032ce603ebSClaudio Takahasi 	__le16   conn_latency;
12042ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
12052ce603ebSClaudio Takahasi 	__le16   min_ce_len;
12062ce603ebSClaudio Takahasi 	__le16   max_ce_len;
12072ce603ebSClaudio Takahasi } __packed;
12082ce603ebSClaudio Takahasi 
1209a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1210a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1211a7a595f6SVinicius Costa Gomes 	__le16	handle;
1212a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
1213a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1214a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1215a7a595f6SVinicius Costa Gomes } __packed;
1216a7a595f6SVinicius Costa Gomes 
1217a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1218a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1219a7a595f6SVinicius Costa Gomes 	__le16	handle;
1220a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1221a7a595f6SVinicius Costa Gomes } __packed;
1222a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1223a7a595f6SVinicius Costa Gomes 	__u8	status;
1224a7a595f6SVinicius Costa Gomes 	__le16	handle;
1225a7a595f6SVinicius Costa Gomes } __packed;
1226a7a595f6SVinicius Costa Gomes 
1227a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1228a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1229a7a595f6SVinicius Costa Gomes 	__le16	handle;
1230a7a595f6SVinicius Costa Gomes } __packed;
1231a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1232a7a595f6SVinicius Costa Gomes 	__u8	status;
1233a7a595f6SVinicius Costa Gomes 	__le16	handle;
1234a7a595f6SVinicius Costa Gomes } __packed;
1235a7a595f6SVinicius Costa Gomes 
12369b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
12379b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
12389b008c04SJohan Hedberg 	__u8	status;
12399b008c04SJohan Hedberg 	__u8	le_states[8];
12409b008c04SJohan Hedberg } __packed;
12419b008c04SJohan Hedberg 
12421da177e4SLinus Torvalds /* ---- HCI Events ---- */
12431da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
12441da177e4SLinus Torvalds 
12451da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
12461da177e4SLinus Torvalds struct inquiry_info {
12471da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12481da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
12491da177e4SLinus Torvalds 	__u8     pscan_period_mode;
12501da177e4SLinus Torvalds 	__u8     pscan_mode;
12511da177e4SLinus Torvalds 	__u8     dev_class[3];
12521ebb9252SMarcel Holtmann 	__le16   clock_offset;
125366c853ccSGustavo F. Padovan } __packed;
12541da177e4SLinus Torvalds 
12551da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
12561da177e4SLinus Torvalds struct hci_ev_conn_complete {
12571da177e4SLinus Torvalds 	__u8     status;
12581ebb9252SMarcel Holtmann 	__le16   handle;
12591da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12601da177e4SLinus Torvalds 	__u8     link_type;
12611da177e4SLinus Torvalds 	__u8     encr_mode;
126266c853ccSGustavo F. Padovan } __packed;
12631da177e4SLinus Torvalds 
12641da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
12651da177e4SLinus Torvalds struct hci_ev_conn_request {
12661da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12671da177e4SLinus Torvalds 	__u8     dev_class[3];
12681da177e4SLinus Torvalds 	__u8     link_type;
126966c853ccSGustavo F. Padovan } __packed;
12701da177e4SLinus Torvalds 
12711da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
12721da177e4SLinus Torvalds struct hci_ev_disconn_complete {
12731da177e4SLinus Torvalds 	__u8     status;
12741ebb9252SMarcel Holtmann 	__le16   handle;
12751da177e4SLinus Torvalds 	__u8     reason;
127666c853ccSGustavo F. Padovan } __packed;
12771da177e4SLinus Torvalds 
12781da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
12791da177e4SLinus Torvalds struct hci_ev_auth_complete {
12801da177e4SLinus Torvalds 	__u8     status;
12811ebb9252SMarcel Holtmann 	__le16   handle;
128266c853ccSGustavo F. Padovan } __packed;
12831da177e4SLinus Torvalds 
1284a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1285a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1286a9de9248SMarcel Holtmann 	__u8     status;
1287a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
12881f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
128966c853ccSGustavo F. Padovan } __packed;
1290a9de9248SMarcel Holtmann 
12911da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
12921da177e4SLinus Torvalds struct hci_ev_encrypt_change {
12931da177e4SLinus Torvalds 	__u8     status;
12941ebb9252SMarcel Holtmann 	__le16   handle;
12951da177e4SLinus Torvalds 	__u8     encrypt;
129666c853ccSGustavo F. Padovan } __packed;
12971da177e4SLinus Torvalds 
1298a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1299a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
13001da177e4SLinus Torvalds 	__u8     status;
13011ebb9252SMarcel Holtmann 	__le16   handle;
130266c853ccSGustavo F. Padovan } __packed;
13031da177e4SLinus Torvalds 
1304a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1305a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1306a9de9248SMarcel Holtmann 	__u8     status;
1307a9de9248SMarcel Holtmann 	__le16   handle;
1308a9de9248SMarcel Holtmann 	__u8     features[8];
130966c853ccSGustavo F. Padovan } __packed;
1310a9de9248SMarcel Holtmann 
1311a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1312a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1313a9de9248SMarcel Holtmann 	__u8     status;
1314a9de9248SMarcel Holtmann 	__le16   handle;
1315a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1316a9de9248SMarcel Holtmann 	__le16   manufacturer;
1317a9de9248SMarcel Holtmann 	__le16   lmp_subver;
131866c853ccSGustavo F. Padovan } __packed;
1319a9de9248SMarcel Holtmann 
1320a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
13211da177e4SLinus Torvalds struct hci_qos {
13221da177e4SLinus Torvalds 	__u8     service_type;
13231da177e4SLinus Torvalds 	__u32    token_rate;
13241da177e4SLinus Torvalds 	__u32    peak_bandwidth;
13251da177e4SLinus Torvalds 	__u32    latency;
13261da177e4SLinus Torvalds 	__u32    delay_variation;
132766c853ccSGustavo F. Padovan } __packed;
13281da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
13291da177e4SLinus Torvalds 	__u8     status;
13301ebb9252SMarcel Holtmann 	__le16   handle;
13311da177e4SLinus Torvalds 	struct   hci_qos qos;
133266c853ccSGustavo F. Padovan } __packed;
13331da177e4SLinus Torvalds 
1334a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
13351da177e4SLinus Torvalds struct hci_ev_cmd_complete {
13361da177e4SLinus Torvalds 	__u8     ncmd;
13371ebb9252SMarcel Holtmann 	__le16   opcode;
133866c853ccSGustavo F. Padovan } __packed;
13391da177e4SLinus Torvalds 
1340a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
13411da177e4SLinus Torvalds struct hci_ev_cmd_status {
13421da177e4SLinus Torvalds 	__u8     status;
13431da177e4SLinus Torvalds 	__u8     ncmd;
13441ebb9252SMarcel Holtmann 	__le16   opcode;
134566c853ccSGustavo F. Padovan } __packed;
13461da177e4SLinus Torvalds 
13471da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
13481da177e4SLinus Torvalds struct hci_ev_role_change {
13491da177e4SLinus Torvalds 	__u8     status;
13501da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13511da177e4SLinus Torvalds 	__u8     role;
135266c853ccSGustavo F. Padovan } __packed;
13531da177e4SLinus Torvalds 
1354a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1355613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1356613a1c0cSAndrei Emeltchenko 	__le16   handle;
1357613a1c0cSAndrei Emeltchenko 	__le16   count;
1358613a1c0cSAndrei Emeltchenko } __packed;
1359613a1c0cSAndrei Emeltchenko 
1360a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1361a9de9248SMarcel Holtmann 	__u8     num_hndl;
1362613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
136366c853ccSGustavo F. Padovan } __packed;
1364a9de9248SMarcel Holtmann 
13651da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
13661da177e4SLinus Torvalds struct hci_ev_mode_change {
13671da177e4SLinus Torvalds 	__u8     status;
13681ebb9252SMarcel Holtmann 	__le16   handle;
13691da177e4SLinus Torvalds 	__u8     mode;
13701ebb9252SMarcel Holtmann 	__le16   interval;
137166c853ccSGustavo F. Padovan } __packed;
13721da177e4SLinus Torvalds 
13731da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
13741da177e4SLinus Torvalds struct hci_ev_pin_code_req {
13751da177e4SLinus Torvalds 	bdaddr_t bdaddr;
137666c853ccSGustavo F. Padovan } __packed;
13771da177e4SLinus Torvalds 
13781da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
13791da177e4SLinus Torvalds struct hci_ev_link_key_req {
13801da177e4SLinus Torvalds 	bdaddr_t bdaddr;
138166c853ccSGustavo F. Padovan } __packed;
13821da177e4SLinus Torvalds 
13831da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
13841da177e4SLinus Torvalds struct hci_ev_link_key_notify {
13851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13869b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
13871da177e4SLinus Torvalds 	__u8     key_type;
138866c853ccSGustavo F. Padovan } __packed;
13891da177e4SLinus Torvalds 
1390a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
13911da177e4SLinus Torvalds struct hci_ev_clock_offset {
13921da177e4SLinus Torvalds 	__u8     status;
13931ebb9252SMarcel Holtmann 	__le16   handle;
13941ebb9252SMarcel Holtmann 	__le16   clock_offset;
139566c853ccSGustavo F. Padovan } __packed;
13961da177e4SLinus Torvalds 
1397a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1398a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1399a8746417SMarcel Holtmann 	__u8     status;
1400a8746417SMarcel Holtmann 	__le16   handle;
1401a8746417SMarcel Holtmann 	__le16   pkt_type;
140266c853ccSGustavo F. Padovan } __packed;
1403a8746417SMarcel Holtmann 
140485a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
140585a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
140685a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
140785a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
140866c853ccSGustavo F. Padovan } __packed;
140985a1e930SMarcel Holtmann 
1410a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1411a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1412a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1413a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1414a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1415a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1416a9de9248SMarcel Holtmann 	__le16   clock_offset;
1417a9de9248SMarcel Holtmann 	__s8     rssi;
141866c853ccSGustavo F. Padovan } __packed;
1419a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1420a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1421a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1422a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1423a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1424a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1425a9de9248SMarcel Holtmann 	__le16   clock_offset;
1426a9de9248SMarcel Holtmann 	__s8     rssi;
142766c853ccSGustavo F. Padovan } __packed;
1428a9de9248SMarcel Holtmann 
1429a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1430a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1431a9de9248SMarcel Holtmann 	__u8     status;
1432a9de9248SMarcel Holtmann 	__le16   handle;
1433a9de9248SMarcel Holtmann 	__u8     page;
1434a9de9248SMarcel Holtmann 	__u8     max_page;
1435a9de9248SMarcel Holtmann 	__u8     features[8];
143666c853ccSGustavo F. Padovan } __packed;
1437a9de9248SMarcel Holtmann 
1438a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1439a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1440a9de9248SMarcel Holtmann 	__u8     status;
1441a9de9248SMarcel Holtmann 	__le16   handle;
1442a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1443a9de9248SMarcel Holtmann 	__u8     link_type;
1444a9de9248SMarcel Holtmann 	__u8     tx_interval;
1445a9de9248SMarcel Holtmann 	__u8     retrans_window;
1446a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1447a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1448a9de9248SMarcel Holtmann 	__u8     air_mode;
144966c853ccSGustavo F. Padovan } __packed;
1450a9de9248SMarcel Holtmann 
1451a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1452a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1453a9de9248SMarcel Holtmann 	__u8     status;
1454a9de9248SMarcel Holtmann 	__le16   handle;
1455a9de9248SMarcel Holtmann 	__u8     tx_interval;
1456a9de9248SMarcel Holtmann 	__u8     retrans_window;
1457a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1458a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
145966c853ccSGustavo F. Padovan } __packed;
1460a9de9248SMarcel Holtmann 
1461a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
146204837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
146304837f64SMarcel Holtmann 	__u8     status;
146404837f64SMarcel Holtmann 	__le16   handle;
146504837f64SMarcel Holtmann 	__le16   max_tx_latency;
146604837f64SMarcel Holtmann 	__le16   max_rx_latency;
146704837f64SMarcel Holtmann 	__le16   max_remote_timeout;
146804837f64SMarcel Holtmann 	__le16   max_local_timeout;
146966c853ccSGustavo F. Padovan } __packed;
147004837f64SMarcel Holtmann 
1471a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1472a9de9248SMarcel Holtmann struct extended_inquiry_info {
1473a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1474a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1475a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1476a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1477a9de9248SMarcel Holtmann 	__le16   clock_offset;
1478a9de9248SMarcel Holtmann 	__s8     rssi;
1479a9de9248SMarcel Holtmann 	__u8     data[240];
148066c853ccSGustavo F. Padovan } __packed;
1481a9de9248SMarcel Holtmann 
14821c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
14831c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
14841c2e0041SJohan Hedberg 	__u8	status;
14851c2e0041SJohan Hedberg 	__le16	handle;
14861c2e0041SJohan Hedberg } __packed;
14871c2e0041SJohan Hedberg 
14880493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
14890493684eSMarcel Holtmann struct hci_ev_io_capa_request {
14900493684eSMarcel Holtmann 	bdaddr_t bdaddr;
149166c853ccSGustavo F. Padovan } __packed;
14920493684eSMarcel Holtmann 
149303b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
149403b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
149503b555e1SJohan Hedberg 	bdaddr_t bdaddr;
149603b555e1SJohan Hedberg 	__u8     capability;
149703b555e1SJohan Hedberg 	__u8     oob_data;
149803b555e1SJohan Hedberg 	__u8     authentication;
149903b555e1SJohan Hedberg } __packed;
150003b555e1SJohan Hedberg 
1501a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1502a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1503a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1504a5c29683SJohan Hedberg 	__le32		passkey;
1505a5c29683SJohan Hedberg } __packed;
1506a5c29683SJohan Hedberg 
15079ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
15089ad4019aSBrian Gix struct hci_ev_user_passkey_req {
15099ad4019aSBrian Gix 	bdaddr_t	bdaddr;
15109ad4019aSBrian Gix } __packed;
15119ad4019aSBrian Gix 
15122763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
15132763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
15142763eda6SSzymon Janc 	bdaddr_t bdaddr;
15152763eda6SSzymon Janc } __packed;
15162763eda6SSzymon Janc 
15170493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
15180493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
15190493684eSMarcel Holtmann 	__u8     status;
15200493684eSMarcel Holtmann 	bdaddr_t bdaddr;
152166c853ccSGustavo F. Padovan } __packed;
15220493684eSMarcel Holtmann 
152392a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
152492a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
152592a25256SJohan Hedberg 	bdaddr_t	bdaddr;
152692a25256SJohan Hedberg 	__le32		passkey;
152792a25256SJohan Hedberg } __packed;
152892a25256SJohan Hedberg 
152992a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
153092a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
153192a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
153292a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
153392a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
153492a25256SJohan Hedberg 
153592a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
153692a25256SJohan Hedberg struct hci_ev_keypress_notify {
153792a25256SJohan Hedberg 	bdaddr_t	bdaddr;
153892a25256SJohan Hedberg 	__u8		type;
153992a25256SJohan Hedberg } __packed;
154092a25256SJohan Hedberg 
154141a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
154241a96212SMarcel Holtmann struct hci_ev_remote_host_features {
154341a96212SMarcel Holtmann 	bdaddr_t bdaddr;
154441a96212SMarcel Holtmann 	__u8     features[8];
154566c853ccSGustavo F. Padovan } __packed;
154641a96212SMarcel Holtmann 
154763185f64SVille Tervo #define HCI_EV_LE_META			0x3e
154863185f64SVille Tervo struct hci_ev_le_meta {
154963185f64SVille Tervo 	__u8     subevent;
155063185f64SVille Tervo } __packed;
155163185f64SVille Tervo 
1552523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1553523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1554523e93cdSAndrei Emeltchenko 	__u8     status;
1555523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1556523e93cdSAndrei Emeltchenko } __packed;
1557523e93cdSAndrei Emeltchenko 
1558523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1559523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1560523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1561523e93cdSAndrei Emeltchenko } __packed;
1562523e93cdSAndrei Emeltchenko 
1563523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1564523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1565523e93cdSAndrei Emeltchenko 	__u8     status;
1566523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1567523e93cdSAndrei Emeltchenko 	__u8     reason;
1568523e93cdSAndrei Emeltchenko } __packed;
1569523e93cdSAndrei Emeltchenko 
1570523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1571523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1572523e93cdSAndrei Emeltchenko 	__u8     status;
1573523e93cdSAndrei Emeltchenko 	__le16   handle;
1574523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1575523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1576523e93cdSAndrei Emeltchenko } __packed;
1577523e93cdSAndrei Emeltchenko 
1578523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1579523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1580523e93cdSAndrei Emeltchenko 	__u8     status;
1581523e93cdSAndrei Emeltchenko 	__le16   handle;
1582523e93cdSAndrei Emeltchenko 	__u8     reason;
1583523e93cdSAndrei Emeltchenko } __packed;
1584523e93cdSAndrei Emeltchenko 
158525e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
158625e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
158725e89e99SAndrei Emeltchenko 	__le16   handle;
158825e89e99SAndrei Emeltchenko 	__le16   pkts;
158925e89e99SAndrei Emeltchenko 	__le16   blocks;
159025e89e99SAndrei Emeltchenko } __packed;
159125e89e99SAndrei Emeltchenko 
159225e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
159325e89e99SAndrei Emeltchenko 	__le16   num_blocks;
159425e89e99SAndrei Emeltchenko 	__u8     num_hndl;
159525e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
159625e89e99SAndrei Emeltchenko } __packed;
159725e89e99SAndrei Emeltchenko 
15982b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
15992b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
16002b359445SDoHyun Pyun 	__u8	status;
16012b359445SDoHyun Pyun } __packed;
16022b359445SDoHyun Pyun 
16032ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
16042ed01805SDoHyun Pyun 
160563185f64SVille Tervo /* Low energy meta events */
1606b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1607b9b343d2SAndre Guedes 
160863185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
160963185f64SVille Tervo struct hci_ev_le_conn_complete {
161063185f64SVille Tervo 	__u8     status;
161163185f64SVille Tervo 	__le16   handle;
161263185f64SVille Tervo 	__u8     role;
161363185f64SVille Tervo 	__u8     bdaddr_type;
161463185f64SVille Tervo 	bdaddr_t bdaddr;
161563185f64SVille Tervo 	__le16   interval;
161663185f64SVille Tervo 	__le16   latency;
161763185f64SVille Tervo 	__le16   supervision_timeout;
161863185f64SVille Tervo 	__u8     clk_accurancy;
161963185f64SVille Tervo } __packed;
162063185f64SVille Tervo 
1621a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1622a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1623a7a595f6SVinicius Costa Gomes 	__le16	handle;
1624a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1625a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1626a7a595f6SVinicius Costa Gomes } __packed;
1627a7a595f6SVinicius Costa Gomes 
162857a56fd4SAnderson Briglia /* Advertising report event types */
1629db3aebf4SMarcel Holtmann #define LE_ADV_IND		0x00
1630db3aebf4SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
1631db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
1632db3aebf4SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
1633db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
163457a56fd4SAnderson Briglia 
163557a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
163657a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
163757a56fd4SAnderson Briglia 
163857a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
163957a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
164057a56fd4SAnderson Briglia 	__u8	 evt_type;
164157a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
164257a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
164357a56fd4SAnderson Briglia 	__u8	 length;
164457a56fd4SAnderson Briglia 	__u8	 data[0];
164557a56fd4SAnderson Briglia } __packed;
164657a56fd4SAnderson Briglia 
16471da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1648a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
16491da177e4SLinus Torvalds struct hci_ev_stack_internal {
16501da177e4SLinus Torvalds 	__u16    type;
16511da177e4SLinus Torvalds 	__u8     data[0];
165266c853ccSGustavo F. Padovan } __packed;
16531da177e4SLinus Torvalds 
16541da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
16551da177e4SLinus Torvalds struct hci_ev_si_device {
16561da177e4SLinus Torvalds 	__u16    event;
16571da177e4SLinus Torvalds 	__u16    dev_id;
165866c853ccSGustavo F. Padovan } __packed;
16591da177e4SLinus Torvalds 
16601da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
16611da177e4SLinus Torvalds struct hci_ev_si_security {
16621da177e4SLinus Torvalds 	__u16    event;
16631da177e4SLinus Torvalds 	__u16    proto;
16641da177e4SLinus Torvalds 	__u16    subproto;
16651da177e4SLinus Torvalds 	__u8     incoming;
166666c853ccSGustavo F. Padovan } __packed;
16671da177e4SLinus Torvalds 
16681da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
16691da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
16701da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
16711da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
16721da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
16731da177e4SLinus Torvalds 
16741da177e4SLinus Torvalds struct hci_command_hdr {
16751ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
16761da177e4SLinus Torvalds 	__u8	plen;
167766c853ccSGustavo F. Padovan } __packed;
16781da177e4SLinus Torvalds 
16791da177e4SLinus Torvalds struct hci_event_hdr {
16801da177e4SLinus Torvalds 	__u8	evt;
16811da177e4SLinus Torvalds 	__u8	plen;
168266c853ccSGustavo F. Padovan } __packed;
16831da177e4SLinus Torvalds 
16841da177e4SLinus Torvalds struct hci_acl_hdr {
16851ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
16861ebb9252SMarcel Holtmann 	__le16	dlen;
168766c853ccSGustavo F. Padovan } __packed;
16881da177e4SLinus Torvalds 
16891da177e4SLinus Torvalds struct hci_sco_hdr {
16901ebb9252SMarcel Holtmann 	__le16	handle;
16911da177e4SLinus Torvalds 	__u8	dlen;
169266c853ccSGustavo F. Padovan } __packed;
16931da177e4SLinus Torvalds 
16942a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
16952a123b86SArnaldo Carvalho de Melo {
16962a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
16972a123b86SArnaldo Carvalho de Melo }
16982a123b86SArnaldo Carvalho de Melo 
16992a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
17002a123b86SArnaldo Carvalho de Melo {
17012a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
17022a123b86SArnaldo Carvalho de Melo }
17032a123b86SArnaldo Carvalho de Melo 
17042a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
17052a123b86SArnaldo Carvalho de Melo {
17062a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
17072a123b86SArnaldo Carvalho de Melo }
17082a123b86SArnaldo Carvalho de Melo 
17091da177e4SLinus Torvalds /* Command opcode pack/unpack */
1710c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
17111da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
17121da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
17131da177e4SLinus Torvalds 
17141da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1715c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
17161da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
17171da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
17181da177e4SLinus Torvalds 
17191da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
17201da177e4SLinus Torvalds 
17211da177e4SLinus Torvalds /* Socket options */
17221da177e4SLinus Torvalds #define HCI_DATA_DIR	1
17231da177e4SLinus Torvalds #define HCI_FILTER	2
17241da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
17251da177e4SLinus Torvalds 
17261da177e4SLinus Torvalds /* CMSG flags */
17271da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
17281da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
17291da177e4SLinus Torvalds 
17301da177e4SLinus Torvalds struct sockaddr_hci {
17311da177e4SLinus Torvalds 	sa_family_t    hci_family;
17321da177e4SLinus Torvalds 	unsigned short hci_dev;
1733c02178d2SJohan Hedberg 	unsigned short hci_channel;
17341da177e4SLinus Torvalds };
17351da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
17361da177e4SLinus Torvalds 
1737c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
173823500189SMarcel Holtmann #define HCI_CHANNEL_USER	1
1739cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
174066f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1741c02178d2SJohan Hedberg 
17421da177e4SLinus Torvalds struct hci_filter {
17431da177e4SLinus Torvalds 	unsigned long type_mask;
17441da177e4SLinus Torvalds 	unsigned long event_mask[2];
1745905f3ed6SAl Viro 	__le16 opcode;
17461da177e4SLinus Torvalds };
17471da177e4SLinus Torvalds 
17481da177e4SLinus Torvalds struct hci_ufilter {
17491da177e4SLinus Torvalds 	__u32  type_mask;
17501da177e4SLinus Torvalds 	__u32  event_mask[2];
1751905f3ed6SAl Viro 	__le16 opcode;
17521da177e4SLinus Torvalds };
17531da177e4SLinus Torvalds 
17541da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
17551da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
17561da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
17571da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
17581da177e4SLinus Torvalds 
17591da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
17601da177e4SLinus Torvalds struct hci_dev_stats {
17611da177e4SLinus Torvalds 	__u32 err_rx;
17621da177e4SLinus Torvalds 	__u32 err_tx;
17631da177e4SLinus Torvalds 	__u32 cmd_tx;
17641da177e4SLinus Torvalds 	__u32 evt_rx;
17651da177e4SLinus Torvalds 	__u32 acl_tx;
17661da177e4SLinus Torvalds 	__u32 acl_rx;
17671da177e4SLinus Torvalds 	__u32 sco_tx;
17681da177e4SLinus Torvalds 	__u32 sco_rx;
17691da177e4SLinus Torvalds 	__u32 byte_rx;
17701da177e4SLinus Torvalds 	__u32 byte_tx;
17711da177e4SLinus Torvalds };
17721da177e4SLinus Torvalds 
17731da177e4SLinus Torvalds struct hci_dev_info {
17741da177e4SLinus Torvalds 	__u16 dev_id;
17751da177e4SLinus Torvalds 	char  name[8];
17761da177e4SLinus Torvalds 
17771da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17781da177e4SLinus Torvalds 
17791da177e4SLinus Torvalds 	__u32 flags;
17801da177e4SLinus Torvalds 	__u8  type;
17811da177e4SLinus Torvalds 
17821da177e4SLinus Torvalds 	__u8  features[8];
17831da177e4SLinus Torvalds 
17841da177e4SLinus Torvalds 	__u32 pkt_type;
17851da177e4SLinus Torvalds 	__u32 link_policy;
17861da177e4SLinus Torvalds 	__u32 link_mode;
17871da177e4SLinus Torvalds 
17881da177e4SLinus Torvalds 	__u16 acl_mtu;
17891da177e4SLinus Torvalds 	__u16 acl_pkts;
17901da177e4SLinus Torvalds 	__u16 sco_mtu;
17911da177e4SLinus Torvalds 	__u16 sco_pkts;
17921da177e4SLinus Torvalds 
17931da177e4SLinus Torvalds 	struct hci_dev_stats stat;
17941da177e4SLinus Torvalds };
17951da177e4SLinus Torvalds 
17961da177e4SLinus Torvalds struct hci_conn_info {
17971da177e4SLinus Torvalds 	__u16    handle;
17981da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17991da177e4SLinus Torvalds 	__u8     type;
18001da177e4SLinus Torvalds 	__u8     out;
18011da177e4SLinus Torvalds 	__u16    state;
18021da177e4SLinus Torvalds 	__u32    link_mode;
18031da177e4SLinus Torvalds };
18041da177e4SLinus Torvalds 
18051da177e4SLinus Torvalds struct hci_dev_req {
18061da177e4SLinus Torvalds 	__u16  dev_id;
18071da177e4SLinus Torvalds 	__u32  dev_opt;
18081da177e4SLinus Torvalds };
18091da177e4SLinus Torvalds 
18101da177e4SLinus Torvalds struct hci_dev_list_req {
18111da177e4SLinus Torvalds 	__u16  dev_num;
18121da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
18131da177e4SLinus Torvalds };
18141da177e4SLinus Torvalds 
18151da177e4SLinus Torvalds struct hci_conn_list_req {
18161da177e4SLinus Torvalds 	__u16  dev_id;
18171da177e4SLinus Torvalds 	__u16  conn_num;
18181da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
18191da177e4SLinus Torvalds };
18201da177e4SLinus Torvalds 
18211da177e4SLinus Torvalds struct hci_conn_info_req {
18221da177e4SLinus Torvalds 	bdaddr_t bdaddr;
18231da177e4SLinus Torvalds 	__u8     type;
18241da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
18251da177e4SLinus Torvalds };
18261da177e4SLinus Torvalds 
182740be492fSMarcel Holtmann struct hci_auth_info_req {
182840be492fSMarcel Holtmann 	bdaddr_t bdaddr;
182940be492fSMarcel Holtmann 	__u8     type;
183040be492fSMarcel Holtmann };
183140be492fSMarcel Holtmann 
18321da177e4SLinus Torvalds struct hci_inquiry_req {
18331da177e4SLinus Torvalds 	__u16 dev_id;
18341da177e4SLinus Torvalds 	__u16 flags;
18351da177e4SLinus Torvalds 	__u8  lap[3];
18361da177e4SLinus Torvalds 	__u8  length;
18371da177e4SLinus Torvalds 	__u8  num_rsp;
18381da177e4SLinus Torvalds };
18391da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
18401da177e4SLinus Torvalds 
18411da177e4SLinus Torvalds #endif /* __HCI_H */
1842