xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 06f5b7785af6beebb7b2a452687b5a102c90ca6e)
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,
86da1f5198SMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE
871da177e4SLinus Torvalds };
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds /* HCI device flags */
901da177e4SLinus Torvalds enum {
911da177e4SLinus Torvalds 	HCI_UP,
921da177e4SLinus Torvalds 	HCI_INIT,
931da177e4SLinus Torvalds 	HCI_RUNNING,
941da177e4SLinus Torvalds 
951da177e4SLinus Torvalds 	HCI_PSCAN,
961da177e4SLinus Torvalds 	HCI_ISCAN,
971da177e4SLinus Torvalds 	HCI_AUTH,
981da177e4SLinus Torvalds 	HCI_ENCRYPT,
991da177e4SLinus Torvalds 	HCI_INQUIRY,
1001da177e4SLinus Torvalds 
1011da177e4SLinus Torvalds 	HCI_RAW,
102ab81cbf9SJohan Hedberg 
10310572132SGustavo F. Padovan 	HCI_RESET,
1041da177e4SLinus Torvalds };
1051da177e4SLinus Torvalds 
106d23264a8SAndre Guedes /*
107d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
108d23264a8SAndre Guedes  * states from the controller.
109d23264a8SAndre Guedes  */
110d23264a8SAndre Guedes enum {
111a8b2d5c2SJohan Hedberg 	HCI_SETUP,
112a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1135e130367SJohan Hedberg 	HCI_RFKILLED,
114a8b2d5c2SJohan Hedberg 	HCI_MGMT,
115a8b2d5c2SJohan Hedberg 	HCI_PAIRABLE,
116a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
117a8b2d5c2SJohan Hedberg 	HCI_DEBUG_KEYS,
11894324962SJohan Hovold 	HCI_UNREGISTER,
1190736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
120a8b2d5c2SJohan Hedberg 
121d23264a8SAndre Guedes 	HCI_LE_SCAN,
12284bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
1236d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
12406199cf8SJohan Hedberg 	HCI_LE_ENABLED,
125f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
1265e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1275e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
1286acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
12947990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
13021693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1311a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
13256f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
133d23264a8SAndre Guedes };
134d23264a8SAndre Guedes 
1352cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
1362cc6fb00SJohan Hedberg  * or the HCI device is closed.
1372cc6fb00SJohan Hedberg  */
1381a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
1391a4d3c4bSJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE))
1402cc6fb00SJohan Hedberg 
1411da177e4SLinus Torvalds /* HCI ioctl defines */
1421da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
1431da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
1441da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
1451da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
1461da177e4SLinus Torvalds 
1471da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
1481da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
1491da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1501da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
15140be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1521da177e4SLinus Torvalds 
1531da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1541da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1551da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1561da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1571da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1581da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1591da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1601da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1611da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1621da177e4SLinus Torvalds 
163f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
164f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
165f0358568SJohan Hedberg 
1661da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1671da177e4SLinus Torvalds 
1681da177e4SLinus Torvalds /* HCI timeouts */
1695f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1705f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
1715f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
172d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
1735f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
1749345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
1751da177e4SLinus Torvalds 
1765b7f9909SMarcel Holtmann /* HCI data types */
1771da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1781da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1791da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1801da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1811da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1821da177e4SLinus Torvalds 
1835b7f9909SMarcel Holtmann /* HCI packet types */
1841da177e4SLinus Torvalds #define HCI_DM1		0x0008
1851da177e4SLinus Torvalds #define HCI_DM3		0x0400
1861da177e4SLinus Torvalds #define HCI_DM5		0x4000
1871da177e4SLinus Torvalds #define HCI_DH1		0x0010
1881da177e4SLinus Torvalds #define HCI_DH3		0x0800
1891da177e4SLinus Torvalds #define HCI_DH5		0x8000
1901da177e4SLinus Torvalds 
1911da177e4SLinus Torvalds #define HCI_HV1		0x0020
1921da177e4SLinus Torvalds #define HCI_HV2		0x0040
1931da177e4SLinus Torvalds #define HCI_HV3		0x0080
1941da177e4SLinus Torvalds 
1951da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1961da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1971da177e4SLinus Torvalds 
1985b7f9909SMarcel Holtmann /* eSCO packet types */
1995b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2005b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2015b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2025b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2035b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2045b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
205efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
206efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
207efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
208efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2095b7f9909SMarcel Holtmann 
210a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
211efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
212a8746417SMarcel Holtmann 
2131da177e4SLinus Torvalds /* ACL flags */
214e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2151da177e4SLinus Torvalds #define ACL_CONT		0x01
2161da177e4SLinus Torvalds #define ACL_START		0x02
217d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2181da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2191da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2201da177e4SLinus Torvalds 
2211da177e4SLinus Torvalds /* Baseband links */
2221da177e4SLinus Torvalds #define SCO_LINK	0x00
2231da177e4SLinus Torvalds #define ACL_LINK	0x01
2245b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
225fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
226fcd89c09SVille Tervo #define LE_LINK		0x80
2273161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2281da177e4SLinus Torvalds 
2291da177e4SLinus Torvalds /* LMP features */
2301da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2311da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2321da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2331da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2341da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2351da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2361da177e4SLinus Torvalds #define LMP_HOLD	0x40
23704837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2381da177e4SLinus Torvalds 
2391da177e4SLinus Torvalds #define LMP_PARK	0x01
2401da177e4SLinus Torvalds #define LMP_RSSI	0x02
2411da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2421da177e4SLinus Torvalds #define LMP_SCO		0x08
2431da177e4SLinus Torvalds #define LMP_HV2		0x10
2441da177e4SLinus Torvalds #define LMP_HV3		0x20
2451da177e4SLinus Torvalds #define LMP_ULAW	0x40
2461da177e4SLinus Torvalds #define LMP_ALAW	0x80
2471da177e4SLinus Torvalds 
2481da177e4SLinus Torvalds #define LMP_CVSD	0x01
2491da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2501da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
25107a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2521da177e4SLinus Torvalds 
253d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2545b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2555b7f9909SMarcel Holtmann 
2565b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2575b7f9909SMarcel Holtmann #define LMP_EV5		0x02
25869ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
259d5859e22SJohan Hedberg #define LMP_LE		0x40
2605b7f9909SMarcel Holtmann 
26104837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
262d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
263efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
264efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
265efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
26604837f64SMarcel Holtmann 
267d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
268e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
269769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
270e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
271769be974SMarcel Holtmann 
272d5859e22SJohan Hedberg #define LMP_LSTO	0x01
273d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
274971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
275d5859e22SJohan Hedberg 
276eead27daSAndre Guedes /* Extended LMP features */
277cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
278eead27daSAndre Guedes #define LMP_HOST_LE		0x02
279cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
280eead27daSAndre Guedes 
28104837f64SMarcel Holtmann /* Connection modes */
28204837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
28304837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
28404837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
28504837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
28604837f64SMarcel Holtmann 
2871da177e4SLinus Torvalds /* Link policies */
2881da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2891da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2901da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2911da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2921da177e4SLinus Torvalds 
29304837f64SMarcel Holtmann /* Link modes */
2941da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2951da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2961da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2971da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2981da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2991da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3001da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
3011da177e4SLinus Torvalds 
30240be492fSMarcel Holtmann /* Authentication types */
30340be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
30440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
30540be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
30640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
30740be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
30840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
30940be492fSMarcel Holtmann 
310a77b15a6SMikel Astiz /* I/O capabilities */
311a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
312a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
313a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
314a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
315a77b15a6SMikel Astiz 
316b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
317b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
318b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
319b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
320b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
321b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
322b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
323b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
324b899efafSVinicius Costa Gomes /* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
325b899efafSVinicius Costa Gomes #define HCI_SMP_STK			0x80
326b899efafSVinicius Costa Gomes #define HCI_SMP_STK_SLAVE		0x81
327b899efafSVinicius Costa Gomes #define HCI_SMP_LTK			0x82
328b899efafSVinicius Costa Gomes #define HCI_SMP_LTK_SLAVE		0x83
329b6020ba0SWaldemar Rymarkiewicz 
3309f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3319f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
332cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
3339f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3349f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
335cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
336cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3379f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3389f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3399f5a0d7bSAndrei Emeltchenko 
3402455a3eaSAndrei Emeltchenko /* Flow control modes */
3412455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
3422455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
3432455a3eaSAndrei Emeltchenko 
344bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
345bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
346bbaf444aSJohan Hedberg 
34732748db0SJohan Hedberg /* Extended Inquiry Response field types */
34832748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
34932748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
35032748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
35132748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
35232748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
35332748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
35432748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
35532748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
35632748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
35732748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
3589ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
3599ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
3609ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
36132748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
36232748db0SJohan Hedberg 
3633f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
3643f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
3653f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
3663f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
3673f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
3683f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
3693f0f524bSJohan Hedberg 
3701da177e4SLinus Torvalds /* -----  HCI Commands ---- */
3716bd32326SVille Tervo #define HCI_OP_NOP			0x0000
3726bd32326SVille Tervo 
373a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
374a9de9248SMarcel Holtmann struct hci_cp_inquiry {
375a9de9248SMarcel Holtmann 	__u8     lap[3];
376a9de9248SMarcel Holtmann 	__u8     length;
377a9de9248SMarcel Holtmann 	__u8     num_rsp;
37866c853ccSGustavo F. Padovan } __packed;
3791da177e4SLinus Torvalds 
380a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
381a9de9248SMarcel Holtmann 
38279d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
38379d6e068SAndre Guedes 
384a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
385a9de9248SMarcel Holtmann 
386a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
387a9de9248SMarcel Holtmann struct hci_cp_create_conn {
388a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
389a9de9248SMarcel Holtmann 	__le16   pkt_type;
390a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
391a9de9248SMarcel Holtmann 	__u8     pscan_mode;
392a9de9248SMarcel Holtmann 	__le16   clock_offset;
393a9de9248SMarcel Holtmann 	__u8     role_switch;
39466c853ccSGustavo F. Padovan } __packed;
3951da177e4SLinus Torvalds 
396a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
397a9de9248SMarcel Holtmann struct hci_cp_disconnect {
398a9de9248SMarcel Holtmann 	__le16   handle;
399a9de9248SMarcel Holtmann 	__u8     reason;
40066c853ccSGustavo F. Padovan } __packed;
4011da177e4SLinus Torvalds 
402a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
403a9de9248SMarcel Holtmann struct hci_cp_add_sco {
404a9de9248SMarcel Holtmann 	__le16   handle;
405a9de9248SMarcel Holtmann 	__le16   pkt_type;
40666c853ccSGustavo F. Padovan } __packed;
407a9de9248SMarcel Holtmann 
408a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
409a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4101da177e4SLinus Torvalds 	bdaddr_t bdaddr;
41166c853ccSGustavo F. Padovan } __packed;
4121da177e4SLinus Torvalds 
413a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
414a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
415a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
416a9de9248SMarcel Holtmann 	__u8     role;
41766c853ccSGustavo F. Padovan } __packed;
4181da177e4SLinus Torvalds 
419a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
420a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
421a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
422a9de9248SMarcel Holtmann 	__u8     reason;
42366c853ccSGustavo F. Padovan } __packed;
4241da177e4SLinus Torvalds 
425a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
426a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
427a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4289b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
42966c853ccSGustavo F. Padovan } __packed;
4301da177e4SLinus Torvalds 
431a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
432a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
433a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
43466c853ccSGustavo F. Padovan } __packed;
4351da177e4SLinus Torvalds 
436a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
437a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
438a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
439a9de9248SMarcel Holtmann 	__u8     pin_len;
440a9de9248SMarcel Holtmann 	__u8     pin_code[16];
44166c853ccSGustavo F. Padovan } __packed;
442980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
443980e1a53SJohan Hedberg 	__u8     status;
444980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
445980e1a53SJohan Hedberg } __packed;
446a9de9248SMarcel Holtmann 
447a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
448a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
449a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
45066c853ccSGustavo F. Padovan } __packed;
451980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
452980e1a53SJohan Hedberg 	__u8     status;
453980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
454980e1a53SJohan Hedberg } __packed;
455a9de9248SMarcel Holtmann 
456a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
457a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
458a9de9248SMarcel Holtmann 	__le16   handle;
459a9de9248SMarcel Holtmann 	__le16   pkt_type;
46066c853ccSGustavo F. Padovan } __packed;
461a9de9248SMarcel Holtmann 
462a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
463a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
464a9de9248SMarcel Holtmann 	__le16   handle;
46566c853ccSGustavo F. Padovan } __packed;
466a9de9248SMarcel Holtmann 
467a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
468a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
469a9de9248SMarcel Holtmann 	__le16   handle;
470a9de9248SMarcel Holtmann 	__u8     encrypt;
47166c853ccSGustavo F. Padovan } __packed;
472a9de9248SMarcel Holtmann 
473a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
474a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
475a9de9248SMarcel Holtmann 	__le16   handle;
47666c853ccSGustavo F. Padovan } __packed;
477a9de9248SMarcel Holtmann 
478a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
479a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
480a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
481a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
482a9de9248SMarcel Holtmann 	__u8     pscan_mode;
483a9de9248SMarcel Holtmann 	__le16   clock_offset;
48466c853ccSGustavo F. Padovan } __packed;
485a9de9248SMarcel Holtmann 
486a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
487a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
488a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
48966c853ccSGustavo F. Padovan } __packed;
490a9de9248SMarcel Holtmann 
491a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
492a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
493a9de9248SMarcel Holtmann 	__le16   handle;
49466c853ccSGustavo F. Padovan } __packed;
495a9de9248SMarcel Holtmann 
496a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
497a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
498a9de9248SMarcel Holtmann 	__le16   handle;
499a9de9248SMarcel Holtmann 	__u8     page;
50066c853ccSGustavo F. Padovan } __packed;
501a9de9248SMarcel Holtmann 
502a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
503a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
504a9de9248SMarcel Holtmann 	__le16   handle;
50566c853ccSGustavo F. Padovan } __packed;
506a9de9248SMarcel Holtmann 
507a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
508a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
509a9de9248SMarcel Holtmann 	__le16   handle;
510a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
511a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
512a9de9248SMarcel Holtmann 	__le16   max_latency;
513a9de9248SMarcel Holtmann 	__le16   voice_setting;
514a9de9248SMarcel Holtmann 	__u8     retrans_effort;
515a9de9248SMarcel Holtmann 	__le16   pkt_type;
51666c853ccSGustavo F. Padovan } __packed;
517a9de9248SMarcel Holtmann 
518a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
519a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
520a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
521a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
522a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
523a9de9248SMarcel Holtmann 	__le16   max_latency;
524a9de9248SMarcel Holtmann 	__le16   content_format;
525a9de9248SMarcel Holtmann 	__u8     retrans_effort;
526a9de9248SMarcel Holtmann 	__le16   pkt_type;
52766c853ccSGustavo F. Padovan } __packed;
528a9de9248SMarcel Holtmann 
529a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
530a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
531a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
532a9de9248SMarcel Holtmann 	__u8     reason;
53366c853ccSGustavo F. Padovan } __packed;
534a9de9248SMarcel Holtmann 
53517fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
53617fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
53717fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
53817fa4b9dSJohan Hedberg 	__u8     capability;
53917fa4b9dSJohan Hedberg 	__u8     oob_data;
54017fa4b9dSJohan Hedberg 	__u8     authentication;
54117fa4b9dSJohan Hedberg } __packed;
54217fa4b9dSJohan Hedberg 
543a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
544a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
545a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
546a5c29683SJohan Hedberg } __packed;
547a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
548a5c29683SJohan Hedberg 	__u8     status;
549a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
550a5c29683SJohan Hedberg } __packed;
551a5c29683SJohan Hedberg 
552a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
553a5c29683SJohan Hedberg 
5549ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
5559ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
5569ad4019aSBrian Gix 	bdaddr_t bdaddr;
5579ad4019aSBrian Gix 	__le32	passkey;
5589ad4019aSBrian Gix } __packed;
5599ad4019aSBrian Gix 
5609ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
5619ad4019aSBrian Gix 
5622763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
5632763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
5642763eda6SSzymon Janc 	bdaddr_t bdaddr;
5652763eda6SSzymon Janc 	__u8     hash[16];
5662763eda6SSzymon Janc 	__u8     randomizer[16];
5672763eda6SSzymon Janc } __packed;
5682763eda6SSzymon Janc 
5692763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
5702763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
5712763eda6SSzymon Janc 	bdaddr_t bdaddr;
5722763eda6SSzymon Janc } __packed;
5732763eda6SSzymon Janc 
57403b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
57503b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
57603b555e1SJohan Hedberg 	bdaddr_t bdaddr;
57703b555e1SJohan Hedberg 	__u8     reason;
57803b555e1SJohan Hedberg } __packed;
57903b555e1SJohan Hedberg 
580523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
581523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
582523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
583523e93cdSAndrei Emeltchenko 	__u8     key_len;
584523e93cdSAndrei Emeltchenko 	__u8     key_type;
585523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
586523e93cdSAndrei Emeltchenko } __packed;
587523e93cdSAndrei Emeltchenko 
588523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
589523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
590523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
591523e93cdSAndrei Emeltchenko 	__u8     key_len;
592523e93cdSAndrei Emeltchenko 	__u8     key_type;
593523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
594523e93cdSAndrei Emeltchenko } __packed;
595523e93cdSAndrei Emeltchenko 
596523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
597523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
598523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
599523e93cdSAndrei Emeltchenko 	__u8     reason;
600b078b564SAndrei Emeltchenko } __packed;
601b078b564SAndrei Emeltchenko 
602b078b564SAndrei Emeltchenko struct ext_flow_spec {
603b078b564SAndrei Emeltchenko 	__u8       id;
604b078b564SAndrei Emeltchenko 	__u8       stype;
605b078b564SAndrei Emeltchenko 	__le16     msdu;
606b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
607b078b564SAndrei Emeltchenko 	__le32     acc_lat;
608b078b564SAndrei Emeltchenko 	__le32     flush_to;
609b078b564SAndrei Emeltchenko } __packed;
610b078b564SAndrei Emeltchenko 
611b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
612b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
613b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
614b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
615b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
616b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
617b078b564SAndrei Emeltchenko } __packed;
618b078b564SAndrei Emeltchenko 
619b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
620b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
621b078b564SAndrei Emeltchenko 	__le16   log_handle;
622b078b564SAndrei Emeltchenko } __packed;
623b078b564SAndrei Emeltchenko 
624b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
625b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
626b078b564SAndrei Emeltchenko 	__u8     phy_handle;
627b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
628b078b564SAndrei Emeltchenko } __packed;
629b078b564SAndrei Emeltchenko 
630b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
631b078b564SAndrei Emeltchenko 	__u8     status;
632b078b564SAndrei Emeltchenko 	__u8     phy_handle;
633b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
634523e93cdSAndrei Emeltchenko } __packed;
635523e93cdSAndrei Emeltchenko 
6368c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
6378c9a041bSDoHyun Pyun struct hci_cp_set_csb {
6388c9a041bSDoHyun Pyun 	__u8	enable;
6398c9a041bSDoHyun Pyun 	__u8	lt_addr;
6408c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
6418c9a041bSDoHyun Pyun 	__le16	packet_type;
6428c9a041bSDoHyun Pyun 	__le16	interval_min;
6438c9a041bSDoHyun Pyun 	__le16	interval_max;
6448c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
6458c9a041bSDoHyun Pyun } __packed;
6468c9a041bSDoHyun Pyun struct hci_rp_set_csb {
6478c9a041bSDoHyun Pyun 	__u8	status;
6488c9a041bSDoHyun Pyun 	__u8	lt_addr;
6498c9a041bSDoHyun Pyun 	__le16	interval;
6508c9a041bSDoHyun Pyun } __packed;
6518c9a041bSDoHyun Pyun 
652cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
653cefded98SDoHyun Pyun 
654a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
655a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
656a9de9248SMarcel Holtmann 	__le16   handle;
657a9de9248SMarcel Holtmann 	__le16   max_interval;
658a9de9248SMarcel Holtmann 	__le16   min_interval;
659a9de9248SMarcel Holtmann 	__le16   attempt;
660a9de9248SMarcel Holtmann 	__le16   timeout;
66166c853ccSGustavo F. Padovan } __packed;
662a9de9248SMarcel Holtmann 
663a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
664a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
665a9de9248SMarcel Holtmann 	__le16   handle;
66666c853ccSGustavo F. Padovan } __packed;
667a9de9248SMarcel Holtmann 
668a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
669a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
670a9de9248SMarcel Holtmann 	__le16   handle;
67166c853ccSGustavo F. Padovan } __packed;
672a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
673a9de9248SMarcel Holtmann 	__u8     status;
674a9de9248SMarcel Holtmann 	__le16   handle;
675a9de9248SMarcel Holtmann 	__u8     role;
67666c853ccSGustavo F. Padovan } __packed;
677a9de9248SMarcel Holtmann 
678a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
679a9de9248SMarcel Holtmann struct hci_cp_switch_role {
680a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
681a9de9248SMarcel Holtmann 	__u8     role;
68266c853ccSGustavo F. Padovan } __packed;
683a9de9248SMarcel Holtmann 
684a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
685a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
686a9de9248SMarcel Holtmann 	__le16   handle;
68766c853ccSGustavo F. Padovan } __packed;
688a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
689a9de9248SMarcel Holtmann 	__u8     status;
690a9de9248SMarcel Holtmann 	__le16   handle;
691a9de9248SMarcel Holtmann 	__le16   policy;
69266c853ccSGustavo F. Padovan } __packed;
693a9de9248SMarcel Holtmann 
694a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
695a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
696a9de9248SMarcel Holtmann 	__le16   handle;
697a9de9248SMarcel Holtmann 	__le16   policy;
69866c853ccSGustavo F. Padovan } __packed;
699a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
700a9de9248SMarcel Holtmann 	__u8     status;
701a9de9248SMarcel Holtmann 	__le16   handle;
70266c853ccSGustavo F. Padovan } __packed;
703a9de9248SMarcel Holtmann 
704e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
705e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
706e4e8e37cSMarcel Holtmann 	__u8     status;
707e4e8e37cSMarcel Holtmann 	__le16   policy;
70866c853ccSGustavo F. Padovan } __packed;
709e4e8e37cSMarcel Holtmann 
710e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
711e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
712e4e8e37cSMarcel Holtmann 	__le16   policy;
71366c853ccSGustavo F. Padovan } __packed;
714e4e8e37cSMarcel Holtmann 
715a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
716a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
717a9de9248SMarcel Holtmann 	__le16   handle;
718a9de9248SMarcel Holtmann 	__le16   max_latency;
719a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
720a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
72166c853ccSGustavo F. Padovan } __packed;
722a9de9248SMarcel Holtmann 
723a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
724a9de9248SMarcel Holtmann 
725a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
726a9de9248SMarcel Holtmann 
727a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
7281da177e4SLinus Torvalds struct hci_cp_set_event_flt {
7291da177e4SLinus Torvalds 	__u8     flt_type;
7301da177e4SLinus Torvalds 	__u8     cond_type;
7311da177e4SLinus Torvalds 	__u8     condition[0];
73266c853ccSGustavo F. Padovan } __packed;
7331da177e4SLinus Torvalds 
7341da177e4SLinus Torvalds /* Filter types */
7351da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
7361da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
7371da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
7381da177e4SLinus Torvalds 
7391da177e4SLinus Torvalds /* CONN_SETUP Condition types */
7401da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
7411da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
7421da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
7431da177e4SLinus Torvalds 
7441da177e4SLinus Torvalds /* CONN_SETUP Conditions */
7451da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
7461da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
7471da177e4SLinus Torvalds 
748b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
749b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
750b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
751b0916ea0SJohan Hedberg 	__u8     delete_all;
752b0916ea0SJohan Hedberg } __packed;
753b0916ea0SJohan Hedberg 
7541f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
7551f6c6378SJohan Hedberg 
756a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
757a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
7581f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
75966c853ccSGustavo F. Padovan } __packed;
760a9de9248SMarcel Holtmann 
761a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
762a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
763a9de9248SMarcel Holtmann 	__u8     status;
7641f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
76566c853ccSGustavo F. Padovan } __packed;
766a9de9248SMarcel Holtmann 
767a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
768a9de9248SMarcel Holtmann 
769a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
770a9de9248SMarcel Holtmann 
771a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
772a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
773a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
774a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
775a9de9248SMarcel Holtmann 
776a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
777a9de9248SMarcel Holtmann 
778a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
779a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
780a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
781a9de9248SMarcel Holtmann 
782a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
783a9de9248SMarcel Holtmann 
784a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
785a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
786a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
787a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
788a9de9248SMarcel Holtmann 
789a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
790a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
7911da177e4SLinus Torvalds 	__u8     status;
7921da177e4SLinus Torvalds 	__u8     dev_class[3];
79366c853ccSGustavo F. Padovan } __packed;
7941da177e4SLinus Torvalds 
795a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
796a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
7971da177e4SLinus Torvalds 	__u8     dev_class[3];
79866c853ccSGustavo F. Padovan } __packed;
7991da177e4SLinus Torvalds 
800a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
8011da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
8021da177e4SLinus Torvalds 	__u8     status;
8031ebb9252SMarcel Holtmann 	__le16   voice_setting;
80466c853ccSGustavo F. Padovan } __packed;
8051da177e4SLinus Torvalds 
806a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
8071da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
8081ebb9252SMarcel Holtmann 	__le16   voice_setting;
80966c853ccSGustavo F. Padovan } __packed;
8101da177e4SLinus Torvalds 
811a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
8121da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
8131ebb9252SMarcel Holtmann 	__le16   acl_mtu;
8141da177e4SLinus Torvalds 	__u8     sco_mtu;
8151ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
8161ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
81766c853ccSGustavo F. Padovan } __packed;
8181da177e4SLinus Torvalds 
819b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
820b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
821b4cb9fb2SMarcel Holtmann 	__u8	status;
822b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
823b4cb9fb2SMarcel Holtmann } __packed;
824b4cb9fb2SMarcel Holtmann 
8254b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
8264b836f39SMarcel Holtmann 
8273d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
8283d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
8293d505312SMarcel Holtmann 	__u8	num_iac;
8303d505312SMarcel Holtmann 	__u8	iac_lap[6];
8313d505312SMarcel Holtmann } __packed;
8323d505312SMarcel Holtmann 
833d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
834d5859e22SJohan Hedberg 
83580a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
83680a1e1dbSJohan Hedberg 
83780a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
83880a1e1dbSJohan Hedberg struct hci_cp_write_eir {
839816a11d5SJohan Hedberg 	__u8	fec;
840816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
84180a1e1dbSJohan Hedberg } __packed;
84280a1e1dbSJohan Hedberg 
843333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
844333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
845333140b5SMarcel Holtmann 	__u8     status;
846333140b5SMarcel Holtmann 	__u8     mode;
84766c853ccSGustavo F. Padovan } __packed;
848333140b5SMarcel Holtmann 
849333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
850333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
851333140b5SMarcel Holtmann 	__u8     mode;
85266c853ccSGustavo F. Padovan } __packed;
853333140b5SMarcel Holtmann 
854c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
855c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
856c35938b2SSzymon Janc 	__u8     status;
857c35938b2SSzymon Janc 	__u8     hash[16];
858c35938b2SSzymon Janc 	__u8     randomizer[16];
859c35938b2SSzymon Janc } __packed;
860c35938b2SSzymon Janc 
861d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
86291c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
86391c4e9b1SMarcel Holtmann 	__u8     status;
86491c4e9b1SMarcel Holtmann 	__s8     tx_power;
86591c4e9b1SMarcel Holtmann } __packed;
866d5859e22SJohan Hedberg 
867d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
868d62e6d67SJohan Hedberg 
8697528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
8707528ca1cSMarcel Holtmann 
8711e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
8721e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
8731e89cffbSAndrei Emeltchenko 	__u8     status;
8741e89cffbSAndrei Emeltchenko 	__u8     mode;
8751e89cffbSAndrei Emeltchenko } __packed;
8761e89cffbSAndrei Emeltchenko 
877f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
878f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
879f9b49306SAndre Guedes 	__u8	le;
880f9b49306SAndre Guedes 	__u8	simul;
881f9b49306SAndre Guedes } __packed;
882f9b49306SAndre Guedes 
883d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
884d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
885d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
886d0bf75a5SDoHyun Pyun } __packed;
887d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
888d0bf75a5SDoHyun Pyun 	__u8	status;
889d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
890d0bf75a5SDoHyun Pyun } __packed;
891d0bf75a5SDoHyun Pyun 
8926a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
8936a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
8946a20eaf4SDoHyun Pyun 	__u8	lt_addr;
8956a20eaf4SDoHyun Pyun } __packed;
8966a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
8976a20eaf4SDoHyun Pyun 	__u8	status;
8986a20eaf4SDoHyun Pyun 	__u8	lt_addr;
8996a20eaf4SDoHyun Pyun } __packed;
9006a20eaf4SDoHyun Pyun 
9017d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
9027d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
9037d1dab49SDoHyun Pyun 	__u8	lt_addr;
9047d1dab49SDoHyun Pyun 	__u8	fragment;
9057d1dab49SDoHyun Pyun 	__u8	data_length;
9067d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
9077d1dab49SDoHyun Pyun } __packed;
9087d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
9097d1dab49SDoHyun Pyun 	__u8	status;
9107d1dab49SDoHyun Pyun 	__u8	lt_addr;
9117d1dab49SDoHyun Pyun } __packed;
9127d1dab49SDoHyun Pyun 
9135d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
9145d4e7e8dSJohan Hedberg 
915a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
916a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
917a9b07a64SDoHyun Pyun 	__le16	interval_min;
918a9b07a64SDoHyun Pyun 	__le16	interval_max;
919a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
920a9b07a64SDoHyun Pyun 	__u8	service_data;
921a9b07a64SDoHyun Pyun } __packed;
922a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
923a9b07a64SDoHyun Pyun 	__u8	status;
924a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
925a9b07a64SDoHyun Pyun } __packed;
926a9b07a64SDoHyun Pyun 
927a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
928a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
9291da177e4SLinus Torvalds 	__u8     status;
930a9de9248SMarcel Holtmann 	__u8     hci_ver;
931a9de9248SMarcel Holtmann 	__le16   hci_rev;
932a9de9248SMarcel Holtmann 	__u8     lmp_ver;
933a9de9248SMarcel Holtmann 	__le16   manufacturer;
934a9de9248SMarcel Holtmann 	__le16   lmp_subver;
93566c853ccSGustavo F. Padovan } __packed;
9361da177e4SLinus Torvalds 
937a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
938a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
9391da177e4SLinus Torvalds 	__u8     status;
940a9de9248SMarcel Holtmann 	__u8     commands[64];
94166c853ccSGustavo F. Padovan } __packed;
9421da177e4SLinus Torvalds 
943a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
944a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
945a9de9248SMarcel Holtmann 	__u8     status;
946a9de9248SMarcel Holtmann 	__u8     features[8];
94766c853ccSGustavo F. Padovan } __packed;
948a9de9248SMarcel Holtmann 
949a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
950971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
951971e3a4bSAndre Guedes 	__u8     page;
952971e3a4bSAndre Guedes } __packed;
953a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
954a9de9248SMarcel Holtmann 	__u8     status;
955a9de9248SMarcel Holtmann 	__u8     page;
956a9de9248SMarcel Holtmann 	__u8     max_page;
957a9de9248SMarcel Holtmann 	__u8     features[8];
95866c853ccSGustavo F. Padovan } __packed;
959a9de9248SMarcel Holtmann 
960a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
961a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
962a9de9248SMarcel Holtmann 	__u8     status;
963a9de9248SMarcel Holtmann 	__le16   acl_mtu;
964a9de9248SMarcel Holtmann 	__u8     sco_mtu;
965a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
966a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
96766c853ccSGustavo F. Padovan } __packed;
968a9de9248SMarcel Holtmann 
969a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
970a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
971a9de9248SMarcel Holtmann 	__u8     status;
9721da177e4SLinus Torvalds 	bdaddr_t bdaddr;
97366c853ccSGustavo F. Padovan } __packed;
9741da177e4SLinus Torvalds 
975350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
976350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
977350ee4cfSAndrei Emeltchenko 	__u8     status;
978350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
979350ee4cfSAndrei Emeltchenko 	__le16   block_len;
980350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
981350ee4cfSAndrei Emeltchenko } __packed;
982350ee4cfSAndrei Emeltchenko 
983f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
984f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
985f332ec66SJohan Hedberg 	__u8     status;
986f332ec66SJohan Hedberg 	__le16   interval;
987f332ec66SJohan Hedberg 	__le16   window;
988f332ec66SJohan Hedberg } __packed;
989f332ec66SJohan Hedberg 
990f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
991f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
992f6422ec6SAntti Julku 	__le16   interval;
993f6422ec6SAntti Julku 	__le16   window;
994f6422ec6SAntti Julku } __packed;
995f6422ec6SAntti Julku 
996f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
997f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
998f332ec66SJohan Hedberg 	__u8     status;
999f332ec66SJohan Hedberg 	__u8     type;
1000f332ec66SJohan Hedberg } __packed;
1001f332ec66SJohan Hedberg 
1002f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1003f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1004f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1005f6422ec6SAntti Julku 
1006928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1007928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1008928abaa7SAndrei Emeltchenko 	__u8     status;
1009928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1010928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1011928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1012928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1013928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1014928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1015928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1016928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1017928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1018928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1019928abaa7SAndrei Emeltchenko } __packed;
1020928abaa7SAndrei Emeltchenko 
1021523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1022523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1023523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1024523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1025523e93cdSAndrei Emeltchenko 	__le16   max_len;
1026523e93cdSAndrei Emeltchenko } __packed;
1027523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1028523e93cdSAndrei Emeltchenko 	__u8     status;
1029523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1030523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1031523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1032523e93cdSAndrei Emeltchenko } __packed;
1033523e93cdSAndrei Emeltchenko 
1034523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1035523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1036523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1037523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1038523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1039523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1040523e93cdSAndrei Emeltchenko } __packed;
1041523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1042523e93cdSAndrei Emeltchenko 	__u8     status;
1043523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1044523e93cdSAndrei Emeltchenko } __packed;
1045523e93cdSAndrei Emeltchenko 
1046*06f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
1047*06f5b778SMarcel Holtmann 
104863185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
104963185f64SVille Tervo struct hci_cp_le_set_event_mask {
105063185f64SVille Tervo 	__u8     mask[8];
105163185f64SVille Tervo } __packed;
105263185f64SVille Tervo 
105363185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
105463185f64SVille Tervo struct hci_rp_le_read_buffer_size {
105563185f64SVille Tervo 	__u8     status;
105663185f64SVille Tervo 	__le16   le_mtu;
105763185f64SVille Tervo 	__u8     le_max_pkt;
105863185f64SVille Tervo } __packed;
105963185f64SVille Tervo 
106060e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
106160e77321SJohan Hedberg struct hci_rp_le_read_local_features {
106260e77321SJohan Hedberg 	__u8     status;
106360e77321SJohan Hedberg 	__u8     features[8];
106460e77321SJohan Hedberg } __packed;
106560e77321SJohan Hedberg 
1066d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1067d13eafceSMarcel Holtmann 
10681e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
10691e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
10701e191893SMarcel Holtmann 	__le16   min_interval;
10711e191893SMarcel Holtmann 	__le16   max_interval;
10721e191893SMarcel Holtmann 	__u8     type;
10731e191893SMarcel Holtmann 	__u8     own_address_type;
10741e191893SMarcel Holtmann 	__u8     direct_addr_type;
10751e191893SMarcel Holtmann 	bdaddr_t direct_addr;
10761e191893SMarcel Holtmann 	__u8     channel_map;
10771e191893SMarcel Holtmann 	__u8     filter_policy;
10781e191893SMarcel Holtmann } __packed;
10791e191893SMarcel Holtmann 
10808fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
10818fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
10828fa19098SJohan Hedberg 	__u8	status;
10838fa19098SJohan Hedberg 	__s8	tx_power;
10848fa19098SJohan Hedberg } __packed;
10858fa19098SJohan Hedberg 
10863f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
10873f0f524bSJohan Hedberg 
10883f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
10893f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
10903f0f524bSJohan Hedberg 	__u8	length;
10913f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
10923f0f524bSJohan Hedberg } __packed;
10933f0f524bSJohan Hedberg 
1094f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1095f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1096f14d8f64SMarcel Holtmann 	__u8	length;
1097f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1098f14d8f64SMarcel Holtmann } __packed;
1099f14d8f64SMarcel Holtmann 
1100c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1101c1d5dc4aSJohan Hedberg 
11025df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
11035df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
11045df480b5SAndre Guedes 
110507f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
110607f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
110707f7fa5dSAndre Guedes 	__u8    type;
110807f7fa5dSAndre Guedes 	__le16  interval;
110907f7fa5dSAndre Guedes 	__le16  window;
111007f7fa5dSAndre Guedes 	__u8    own_address_type;
111107f7fa5dSAndre Guedes 	__u8    filter_policy;
111207f7fa5dSAndre Guedes } __packed;
111307f7fa5dSAndre Guedes 
111476a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
111576a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1116525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1117525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
111868a8aea4SAndrei Emeltchenko 
1119eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1120eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1121eb9d91f5SAndre Guedes 	__u8     enable;
1122eb9d91f5SAndre Guedes 	__u8     filter_dup;
1123eb9d91f5SAndre Guedes } __packed;
1124eb9d91f5SAndre Guedes 
112563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
112663185f64SVille Tervo struct hci_cp_le_create_conn {
112763185f64SVille Tervo 	__le16   scan_interval;
112863185f64SVille Tervo 	__le16   scan_window;
112963185f64SVille Tervo 	__u8     filter_policy;
113063185f64SVille Tervo 	__u8     peer_addr_type;
113163185f64SVille Tervo 	bdaddr_t peer_addr;
113263185f64SVille Tervo 	__u8     own_address_type;
113363185f64SVille Tervo 	__le16   conn_interval_min;
113463185f64SVille Tervo 	__le16   conn_interval_max;
113563185f64SVille Tervo 	__le16   conn_latency;
113663185f64SVille Tervo 	__le16   supervision_timeout;
113763185f64SVille Tervo 	__le16   min_ce_len;
113863185f64SVille Tervo 	__le16   max_ce_len;
113963185f64SVille Tervo } __packed;
114063185f64SVille Tervo 
114163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
114263185f64SVille Tervo 
1143cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1144cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1145cf1d081fSJohan Hedberg 	__u8	status;
1146cf1d081fSJohan Hedberg 	__u8	size;
1147cf1d081fSJohan Hedberg } __packed;
1148cf1d081fSJohan Hedberg 
11492ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
11502ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
11512ce603ebSClaudio Takahasi 	__le16   handle;
11522ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
11532ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
11542ce603ebSClaudio Takahasi 	__le16   conn_latency;
11552ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
11562ce603ebSClaudio Takahasi 	__le16   min_ce_len;
11572ce603ebSClaudio Takahasi 	__le16   max_ce_len;
11582ce603ebSClaudio Takahasi } __packed;
11592ce603ebSClaudio Takahasi 
1160a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1161a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1162a7a595f6SVinicius Costa Gomes 	__le16	handle;
1163a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
1164a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1165a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1166a7a595f6SVinicius Costa Gomes } __packed;
1167a7a595f6SVinicius Costa Gomes 
1168a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1169a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1170a7a595f6SVinicius Costa Gomes 	__le16	handle;
1171a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1172a7a595f6SVinicius Costa Gomes } __packed;
1173a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1174a7a595f6SVinicius Costa Gomes 	__u8	status;
1175a7a595f6SVinicius Costa Gomes 	__le16	handle;
1176a7a595f6SVinicius Costa Gomes } __packed;
1177a7a595f6SVinicius Costa Gomes 
1178a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1179a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1180a7a595f6SVinicius Costa Gomes 	__le16	handle;
1181a7a595f6SVinicius Costa Gomes } __packed;
1182a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1183a7a595f6SVinicius Costa Gomes 	__u8	status;
1184a7a595f6SVinicius Costa Gomes 	__le16	handle;
1185a7a595f6SVinicius Costa Gomes } __packed;
1186a7a595f6SVinicius Costa Gomes 
11879b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
11889b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
11899b008c04SJohan Hedberg 	__u8	status;
11909b008c04SJohan Hedberg 	__u8	le_states[8];
11919b008c04SJohan Hedberg } __packed;
11929b008c04SJohan Hedberg 
11931da177e4SLinus Torvalds /* ---- HCI Events ---- */
11941da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
11951da177e4SLinus Torvalds 
11961da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
11971da177e4SLinus Torvalds struct inquiry_info {
11981da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11991da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
12001da177e4SLinus Torvalds 	__u8     pscan_period_mode;
12011da177e4SLinus Torvalds 	__u8     pscan_mode;
12021da177e4SLinus Torvalds 	__u8     dev_class[3];
12031ebb9252SMarcel Holtmann 	__le16   clock_offset;
120466c853ccSGustavo F. Padovan } __packed;
12051da177e4SLinus Torvalds 
12061da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
12071da177e4SLinus Torvalds struct hci_ev_conn_complete {
12081da177e4SLinus Torvalds 	__u8     status;
12091ebb9252SMarcel Holtmann 	__le16   handle;
12101da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12111da177e4SLinus Torvalds 	__u8     link_type;
12121da177e4SLinus Torvalds 	__u8     encr_mode;
121366c853ccSGustavo F. Padovan } __packed;
12141da177e4SLinus Torvalds 
12151da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
12161da177e4SLinus Torvalds struct hci_ev_conn_request {
12171da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12181da177e4SLinus Torvalds 	__u8     dev_class[3];
12191da177e4SLinus Torvalds 	__u8     link_type;
122066c853ccSGustavo F. Padovan } __packed;
12211da177e4SLinus Torvalds 
12221da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
12231da177e4SLinus Torvalds struct hci_ev_disconn_complete {
12241da177e4SLinus Torvalds 	__u8     status;
12251ebb9252SMarcel Holtmann 	__le16   handle;
12261da177e4SLinus Torvalds 	__u8     reason;
122766c853ccSGustavo F. Padovan } __packed;
12281da177e4SLinus Torvalds 
12291da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
12301da177e4SLinus Torvalds struct hci_ev_auth_complete {
12311da177e4SLinus Torvalds 	__u8     status;
12321ebb9252SMarcel Holtmann 	__le16   handle;
123366c853ccSGustavo F. Padovan } __packed;
12341da177e4SLinus Torvalds 
1235a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1236a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1237a9de9248SMarcel Holtmann 	__u8     status;
1238a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
12391f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
124066c853ccSGustavo F. Padovan } __packed;
1241a9de9248SMarcel Holtmann 
12421da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
12431da177e4SLinus Torvalds struct hci_ev_encrypt_change {
12441da177e4SLinus Torvalds 	__u8     status;
12451ebb9252SMarcel Holtmann 	__le16   handle;
12461da177e4SLinus Torvalds 	__u8     encrypt;
124766c853ccSGustavo F. Padovan } __packed;
12481da177e4SLinus Torvalds 
1249a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1250a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
12511da177e4SLinus Torvalds 	__u8     status;
12521ebb9252SMarcel Holtmann 	__le16   handle;
125366c853ccSGustavo F. Padovan } __packed;
12541da177e4SLinus Torvalds 
1255a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1256a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1257a9de9248SMarcel Holtmann 	__u8     status;
1258a9de9248SMarcel Holtmann 	__le16   handle;
1259a9de9248SMarcel Holtmann 	__u8     features[8];
126066c853ccSGustavo F. Padovan } __packed;
1261a9de9248SMarcel Holtmann 
1262a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1263a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1264a9de9248SMarcel Holtmann 	__u8     status;
1265a9de9248SMarcel Holtmann 	__le16   handle;
1266a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1267a9de9248SMarcel Holtmann 	__le16   manufacturer;
1268a9de9248SMarcel Holtmann 	__le16   lmp_subver;
126966c853ccSGustavo F. Padovan } __packed;
1270a9de9248SMarcel Holtmann 
1271a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
12721da177e4SLinus Torvalds struct hci_qos {
12731da177e4SLinus Torvalds 	__u8     service_type;
12741da177e4SLinus Torvalds 	__u32    token_rate;
12751da177e4SLinus Torvalds 	__u32    peak_bandwidth;
12761da177e4SLinus Torvalds 	__u32    latency;
12771da177e4SLinus Torvalds 	__u32    delay_variation;
127866c853ccSGustavo F. Padovan } __packed;
12791da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
12801da177e4SLinus Torvalds 	__u8     status;
12811ebb9252SMarcel Holtmann 	__le16   handle;
12821da177e4SLinus Torvalds 	struct   hci_qos qos;
128366c853ccSGustavo F. Padovan } __packed;
12841da177e4SLinus Torvalds 
1285a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
12861da177e4SLinus Torvalds struct hci_ev_cmd_complete {
12871da177e4SLinus Torvalds 	__u8     ncmd;
12881ebb9252SMarcel Holtmann 	__le16   opcode;
128966c853ccSGustavo F. Padovan } __packed;
12901da177e4SLinus Torvalds 
1291a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
12921da177e4SLinus Torvalds struct hci_ev_cmd_status {
12931da177e4SLinus Torvalds 	__u8     status;
12941da177e4SLinus Torvalds 	__u8     ncmd;
12951ebb9252SMarcel Holtmann 	__le16   opcode;
129666c853ccSGustavo F. Padovan } __packed;
12971da177e4SLinus Torvalds 
12981da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
12991da177e4SLinus Torvalds struct hci_ev_role_change {
13001da177e4SLinus Torvalds 	__u8     status;
13011da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13021da177e4SLinus Torvalds 	__u8     role;
130366c853ccSGustavo F. Padovan } __packed;
13041da177e4SLinus Torvalds 
1305a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1306613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1307613a1c0cSAndrei Emeltchenko 	__le16   handle;
1308613a1c0cSAndrei Emeltchenko 	__le16   count;
1309613a1c0cSAndrei Emeltchenko } __packed;
1310613a1c0cSAndrei Emeltchenko 
1311a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1312a9de9248SMarcel Holtmann 	__u8     num_hndl;
1313613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
131466c853ccSGustavo F. Padovan } __packed;
1315a9de9248SMarcel Holtmann 
13161da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
13171da177e4SLinus Torvalds struct hci_ev_mode_change {
13181da177e4SLinus Torvalds 	__u8     status;
13191ebb9252SMarcel Holtmann 	__le16   handle;
13201da177e4SLinus Torvalds 	__u8     mode;
13211ebb9252SMarcel Holtmann 	__le16   interval;
132266c853ccSGustavo F. Padovan } __packed;
13231da177e4SLinus Torvalds 
13241da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
13251da177e4SLinus Torvalds struct hci_ev_pin_code_req {
13261da177e4SLinus Torvalds 	bdaddr_t bdaddr;
132766c853ccSGustavo F. Padovan } __packed;
13281da177e4SLinus Torvalds 
13291da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
13301da177e4SLinus Torvalds struct hci_ev_link_key_req {
13311da177e4SLinus Torvalds 	bdaddr_t bdaddr;
133266c853ccSGustavo F. Padovan } __packed;
13331da177e4SLinus Torvalds 
13341da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
13351da177e4SLinus Torvalds struct hci_ev_link_key_notify {
13361da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13379b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
13381da177e4SLinus Torvalds 	__u8     key_type;
133966c853ccSGustavo F. Padovan } __packed;
13401da177e4SLinus Torvalds 
1341a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
13421da177e4SLinus Torvalds struct hci_ev_clock_offset {
13431da177e4SLinus Torvalds 	__u8     status;
13441ebb9252SMarcel Holtmann 	__le16   handle;
13451ebb9252SMarcel Holtmann 	__le16   clock_offset;
134666c853ccSGustavo F. Padovan } __packed;
13471da177e4SLinus Torvalds 
1348a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1349a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1350a8746417SMarcel Holtmann 	__u8     status;
1351a8746417SMarcel Holtmann 	__le16   handle;
1352a8746417SMarcel Holtmann 	__le16   pkt_type;
135366c853ccSGustavo F. Padovan } __packed;
1354a8746417SMarcel Holtmann 
135585a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
135685a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
135785a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
135885a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
135966c853ccSGustavo F. Padovan } __packed;
136085a1e930SMarcel Holtmann 
1361a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1362a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1363a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1364a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1365a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1366a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1367a9de9248SMarcel Holtmann 	__le16   clock_offset;
1368a9de9248SMarcel Holtmann 	__s8     rssi;
136966c853ccSGustavo F. Padovan } __packed;
1370a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1371a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1372a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1373a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1374a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1375a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1376a9de9248SMarcel Holtmann 	__le16   clock_offset;
1377a9de9248SMarcel Holtmann 	__s8     rssi;
137866c853ccSGustavo F. Padovan } __packed;
1379a9de9248SMarcel Holtmann 
1380a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1381a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1382a9de9248SMarcel Holtmann 	__u8     status;
1383a9de9248SMarcel Holtmann 	__le16   handle;
1384a9de9248SMarcel Holtmann 	__u8     page;
1385a9de9248SMarcel Holtmann 	__u8     max_page;
1386a9de9248SMarcel Holtmann 	__u8     features[8];
138766c853ccSGustavo F. Padovan } __packed;
1388a9de9248SMarcel Holtmann 
1389a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1390a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1391a9de9248SMarcel Holtmann 	__u8     status;
1392a9de9248SMarcel Holtmann 	__le16   handle;
1393a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1394a9de9248SMarcel Holtmann 	__u8     link_type;
1395a9de9248SMarcel Holtmann 	__u8     tx_interval;
1396a9de9248SMarcel Holtmann 	__u8     retrans_window;
1397a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1398a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1399a9de9248SMarcel Holtmann 	__u8     air_mode;
140066c853ccSGustavo F. Padovan } __packed;
1401a9de9248SMarcel Holtmann 
1402a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1403a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1404a9de9248SMarcel Holtmann 	__u8     status;
1405a9de9248SMarcel Holtmann 	__le16   handle;
1406a9de9248SMarcel Holtmann 	__u8     tx_interval;
1407a9de9248SMarcel Holtmann 	__u8     retrans_window;
1408a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1409a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
141066c853ccSGustavo F. Padovan } __packed;
1411a9de9248SMarcel Holtmann 
1412a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
141304837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
141404837f64SMarcel Holtmann 	__u8     status;
141504837f64SMarcel Holtmann 	__le16   handle;
141604837f64SMarcel Holtmann 	__le16   max_tx_latency;
141704837f64SMarcel Holtmann 	__le16   max_rx_latency;
141804837f64SMarcel Holtmann 	__le16   max_remote_timeout;
141904837f64SMarcel Holtmann 	__le16   max_local_timeout;
142066c853ccSGustavo F. Padovan } __packed;
142104837f64SMarcel Holtmann 
1422a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1423a9de9248SMarcel Holtmann struct extended_inquiry_info {
1424a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1425a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1426a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1427a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1428a9de9248SMarcel Holtmann 	__le16   clock_offset;
1429a9de9248SMarcel Holtmann 	__s8     rssi;
1430a9de9248SMarcel Holtmann 	__u8     data[240];
143166c853ccSGustavo F. Padovan } __packed;
1432a9de9248SMarcel Holtmann 
14331c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
14341c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
14351c2e0041SJohan Hedberg 	__u8	status;
14361c2e0041SJohan Hedberg 	__le16	handle;
14371c2e0041SJohan Hedberg } __packed;
14381c2e0041SJohan Hedberg 
14390493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
14400493684eSMarcel Holtmann struct hci_ev_io_capa_request {
14410493684eSMarcel Holtmann 	bdaddr_t bdaddr;
144266c853ccSGustavo F. Padovan } __packed;
14430493684eSMarcel Holtmann 
144403b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
144503b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
144603b555e1SJohan Hedberg 	bdaddr_t bdaddr;
144703b555e1SJohan Hedberg 	__u8     capability;
144803b555e1SJohan Hedberg 	__u8     oob_data;
144903b555e1SJohan Hedberg 	__u8     authentication;
145003b555e1SJohan Hedberg } __packed;
145103b555e1SJohan Hedberg 
1452a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1453a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1454a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1455a5c29683SJohan Hedberg 	__le32		passkey;
1456a5c29683SJohan Hedberg } __packed;
1457a5c29683SJohan Hedberg 
14589ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
14599ad4019aSBrian Gix struct hci_ev_user_passkey_req {
14609ad4019aSBrian Gix 	bdaddr_t	bdaddr;
14619ad4019aSBrian Gix } __packed;
14629ad4019aSBrian Gix 
14632763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
14642763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
14652763eda6SSzymon Janc 	bdaddr_t bdaddr;
14662763eda6SSzymon Janc } __packed;
14672763eda6SSzymon Janc 
14680493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
14690493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
14700493684eSMarcel Holtmann 	__u8     status;
14710493684eSMarcel Holtmann 	bdaddr_t bdaddr;
147266c853ccSGustavo F. Padovan } __packed;
14730493684eSMarcel Holtmann 
147492a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
147592a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
147692a25256SJohan Hedberg 	bdaddr_t	bdaddr;
147792a25256SJohan Hedberg 	__le32		passkey;
147892a25256SJohan Hedberg } __packed;
147992a25256SJohan Hedberg 
148092a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
148192a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
148292a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
148392a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
148492a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
148592a25256SJohan Hedberg 
148692a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
148792a25256SJohan Hedberg struct hci_ev_keypress_notify {
148892a25256SJohan Hedberg 	bdaddr_t	bdaddr;
148992a25256SJohan Hedberg 	__u8		type;
149092a25256SJohan Hedberg } __packed;
149192a25256SJohan Hedberg 
149241a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
149341a96212SMarcel Holtmann struct hci_ev_remote_host_features {
149441a96212SMarcel Holtmann 	bdaddr_t bdaddr;
149541a96212SMarcel Holtmann 	__u8     features[8];
149666c853ccSGustavo F. Padovan } __packed;
149741a96212SMarcel Holtmann 
149863185f64SVille Tervo #define HCI_EV_LE_META			0x3e
149963185f64SVille Tervo struct hci_ev_le_meta {
150063185f64SVille Tervo 	__u8     subevent;
150163185f64SVille Tervo } __packed;
150263185f64SVille Tervo 
1503523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1504523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1505523e93cdSAndrei Emeltchenko 	__u8     status;
1506523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1507523e93cdSAndrei Emeltchenko } __packed;
1508523e93cdSAndrei Emeltchenko 
1509523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1510523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1511523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1512523e93cdSAndrei Emeltchenko } __packed;
1513523e93cdSAndrei Emeltchenko 
1514523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1515523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1516523e93cdSAndrei Emeltchenko 	__u8     status;
1517523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1518523e93cdSAndrei Emeltchenko 	__u8     reason;
1519523e93cdSAndrei Emeltchenko } __packed;
1520523e93cdSAndrei Emeltchenko 
1521523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1522523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1523523e93cdSAndrei Emeltchenko 	__u8     status;
1524523e93cdSAndrei Emeltchenko 	__le16   handle;
1525523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1526523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1527523e93cdSAndrei Emeltchenko } __packed;
1528523e93cdSAndrei Emeltchenko 
1529523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1530523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1531523e93cdSAndrei Emeltchenko 	__u8     status;
1532523e93cdSAndrei Emeltchenko 	__le16   handle;
1533523e93cdSAndrei Emeltchenko 	__u8     reason;
1534523e93cdSAndrei Emeltchenko } __packed;
1535523e93cdSAndrei Emeltchenko 
153625e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
153725e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
153825e89e99SAndrei Emeltchenko 	__le16   handle;
153925e89e99SAndrei Emeltchenko 	__le16   pkts;
154025e89e99SAndrei Emeltchenko 	__le16   blocks;
154125e89e99SAndrei Emeltchenko } __packed;
154225e89e99SAndrei Emeltchenko 
154325e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
154425e89e99SAndrei Emeltchenko 	__le16   num_blocks;
154525e89e99SAndrei Emeltchenko 	__u8     num_hndl;
154625e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
154725e89e99SAndrei Emeltchenko } __packed;
154825e89e99SAndrei Emeltchenko 
15492b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
15502b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
15512b359445SDoHyun Pyun 	__u8	status;
15522b359445SDoHyun Pyun } __packed;
15532b359445SDoHyun Pyun 
15542ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
15552ed01805SDoHyun Pyun 
155663185f64SVille Tervo /* Low energy meta events */
1557b9b343d2SAndre Guedes #define LE_CONN_ROLE_MASTER	0x00
1558b9b343d2SAndre Guedes 
155963185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
156063185f64SVille Tervo struct hci_ev_le_conn_complete {
156163185f64SVille Tervo 	__u8     status;
156263185f64SVille Tervo 	__le16   handle;
156363185f64SVille Tervo 	__u8     role;
156463185f64SVille Tervo 	__u8     bdaddr_type;
156563185f64SVille Tervo 	bdaddr_t bdaddr;
156663185f64SVille Tervo 	__le16   interval;
156763185f64SVille Tervo 	__le16   latency;
156863185f64SVille Tervo 	__le16   supervision_timeout;
156963185f64SVille Tervo 	__u8     clk_accurancy;
157063185f64SVille Tervo } __packed;
157163185f64SVille Tervo 
1572a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1573a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1574a7a595f6SVinicius Costa Gomes 	__le16	handle;
1575a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1576a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1577a7a595f6SVinicius Costa Gomes } __packed;
1578a7a595f6SVinicius Costa Gomes 
157957a56fd4SAnderson Briglia /* Advertising report event types */
1580db3aebf4SMarcel Holtmann #define LE_ADV_IND		0x00
1581db3aebf4SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
1582db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
1583db3aebf4SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
1584db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
158557a56fd4SAnderson Briglia 
158657a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
158757a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
158857a56fd4SAnderson Briglia 
158957a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
159057a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
159157a56fd4SAnderson Briglia 	__u8	 evt_type;
159257a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
159357a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
159457a56fd4SAnderson Briglia 	__u8	 length;
159557a56fd4SAnderson Briglia 	__u8	 data[0];
159657a56fd4SAnderson Briglia } __packed;
159757a56fd4SAnderson Briglia 
15981da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1599a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
16001da177e4SLinus Torvalds struct hci_ev_stack_internal {
16011da177e4SLinus Torvalds 	__u16    type;
16021da177e4SLinus Torvalds 	__u8     data[0];
160366c853ccSGustavo F. Padovan } __packed;
16041da177e4SLinus Torvalds 
16051da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
16061da177e4SLinus Torvalds struct hci_ev_si_device {
16071da177e4SLinus Torvalds 	__u16    event;
16081da177e4SLinus Torvalds 	__u16    dev_id;
160966c853ccSGustavo F. Padovan } __packed;
16101da177e4SLinus Torvalds 
16111da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
16121da177e4SLinus Torvalds struct hci_ev_si_security {
16131da177e4SLinus Torvalds 	__u16    event;
16141da177e4SLinus Torvalds 	__u16    proto;
16151da177e4SLinus Torvalds 	__u16    subproto;
16161da177e4SLinus Torvalds 	__u8     incoming;
161766c853ccSGustavo F. Padovan } __packed;
16181da177e4SLinus Torvalds 
16191da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
16201da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
16211da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
16221da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
16231da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
16241da177e4SLinus Torvalds 
16251da177e4SLinus Torvalds struct hci_command_hdr {
16261ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
16271da177e4SLinus Torvalds 	__u8	plen;
162866c853ccSGustavo F. Padovan } __packed;
16291da177e4SLinus Torvalds 
16301da177e4SLinus Torvalds struct hci_event_hdr {
16311da177e4SLinus Torvalds 	__u8	evt;
16321da177e4SLinus Torvalds 	__u8	plen;
163366c853ccSGustavo F. Padovan } __packed;
16341da177e4SLinus Torvalds 
16351da177e4SLinus Torvalds struct hci_acl_hdr {
16361ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
16371ebb9252SMarcel Holtmann 	__le16	dlen;
163866c853ccSGustavo F. Padovan } __packed;
16391da177e4SLinus Torvalds 
16401da177e4SLinus Torvalds struct hci_sco_hdr {
16411ebb9252SMarcel Holtmann 	__le16	handle;
16421da177e4SLinus Torvalds 	__u8	dlen;
164366c853ccSGustavo F. Padovan } __packed;
16441da177e4SLinus Torvalds 
16452a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
16462a123b86SArnaldo Carvalho de Melo {
16472a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
16482a123b86SArnaldo Carvalho de Melo }
16492a123b86SArnaldo Carvalho de Melo 
16502a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
16512a123b86SArnaldo Carvalho de Melo {
16522a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
16532a123b86SArnaldo Carvalho de Melo }
16542a123b86SArnaldo Carvalho de Melo 
16552a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
16562a123b86SArnaldo Carvalho de Melo {
16572a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
16582a123b86SArnaldo Carvalho de Melo }
16592a123b86SArnaldo Carvalho de Melo 
16601da177e4SLinus Torvalds /* Command opcode pack/unpack */
1661c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
16621da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
16631da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
16641da177e4SLinus Torvalds 
16651da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1666c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
16671da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
16681da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
16691da177e4SLinus Torvalds 
16701da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
16711da177e4SLinus Torvalds 
16721da177e4SLinus Torvalds /* Socket options */
16731da177e4SLinus Torvalds #define HCI_DATA_DIR	1
16741da177e4SLinus Torvalds #define HCI_FILTER	2
16751da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
16761da177e4SLinus Torvalds 
16771da177e4SLinus Torvalds /* CMSG flags */
16781da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
16791da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
16801da177e4SLinus Torvalds 
16811da177e4SLinus Torvalds struct sockaddr_hci {
16821da177e4SLinus Torvalds 	sa_family_t    hci_family;
16831da177e4SLinus Torvalds 	unsigned short hci_dev;
1684c02178d2SJohan Hedberg 	unsigned short hci_channel;
16851da177e4SLinus Torvalds };
16861da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
16871da177e4SLinus Torvalds 
1688c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
168923500189SMarcel Holtmann #define HCI_CHANNEL_USER	1
1690cd82e61cSMarcel Holtmann #define HCI_CHANNEL_MONITOR	2
169166f3b913SGustavo Padovan #define HCI_CHANNEL_CONTROL	3
1692c02178d2SJohan Hedberg 
16931da177e4SLinus Torvalds struct hci_filter {
16941da177e4SLinus Torvalds 	unsigned long type_mask;
16951da177e4SLinus Torvalds 	unsigned long event_mask[2];
1696905f3ed6SAl Viro 	__le16 opcode;
16971da177e4SLinus Torvalds };
16981da177e4SLinus Torvalds 
16991da177e4SLinus Torvalds struct hci_ufilter {
17001da177e4SLinus Torvalds 	__u32  type_mask;
17011da177e4SLinus Torvalds 	__u32  event_mask[2];
1702905f3ed6SAl Viro 	__le16 opcode;
17031da177e4SLinus Torvalds };
17041da177e4SLinus Torvalds 
17051da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
17061da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
17071da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
17081da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
17091da177e4SLinus Torvalds 
17101da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
17111da177e4SLinus Torvalds struct hci_dev_stats {
17121da177e4SLinus Torvalds 	__u32 err_rx;
17131da177e4SLinus Torvalds 	__u32 err_tx;
17141da177e4SLinus Torvalds 	__u32 cmd_tx;
17151da177e4SLinus Torvalds 	__u32 evt_rx;
17161da177e4SLinus Torvalds 	__u32 acl_tx;
17171da177e4SLinus Torvalds 	__u32 acl_rx;
17181da177e4SLinus Torvalds 	__u32 sco_tx;
17191da177e4SLinus Torvalds 	__u32 sco_rx;
17201da177e4SLinus Torvalds 	__u32 byte_rx;
17211da177e4SLinus Torvalds 	__u32 byte_tx;
17221da177e4SLinus Torvalds };
17231da177e4SLinus Torvalds 
17241da177e4SLinus Torvalds struct hci_dev_info {
17251da177e4SLinus Torvalds 	__u16 dev_id;
17261da177e4SLinus Torvalds 	char  name[8];
17271da177e4SLinus Torvalds 
17281da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17291da177e4SLinus Torvalds 
17301da177e4SLinus Torvalds 	__u32 flags;
17311da177e4SLinus Torvalds 	__u8  type;
17321da177e4SLinus Torvalds 
17331da177e4SLinus Torvalds 	__u8  features[8];
17341da177e4SLinus Torvalds 
17351da177e4SLinus Torvalds 	__u32 pkt_type;
17361da177e4SLinus Torvalds 	__u32 link_policy;
17371da177e4SLinus Torvalds 	__u32 link_mode;
17381da177e4SLinus Torvalds 
17391da177e4SLinus Torvalds 	__u16 acl_mtu;
17401da177e4SLinus Torvalds 	__u16 acl_pkts;
17411da177e4SLinus Torvalds 	__u16 sco_mtu;
17421da177e4SLinus Torvalds 	__u16 sco_pkts;
17431da177e4SLinus Torvalds 
17441da177e4SLinus Torvalds 	struct hci_dev_stats stat;
17451da177e4SLinus Torvalds };
17461da177e4SLinus Torvalds 
17471da177e4SLinus Torvalds struct hci_conn_info {
17481da177e4SLinus Torvalds 	__u16    handle;
17491da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17501da177e4SLinus Torvalds 	__u8     type;
17511da177e4SLinus Torvalds 	__u8     out;
17521da177e4SLinus Torvalds 	__u16    state;
17531da177e4SLinus Torvalds 	__u32    link_mode;
17541da177e4SLinus Torvalds };
17551da177e4SLinus Torvalds 
17561da177e4SLinus Torvalds struct hci_dev_req {
17571da177e4SLinus Torvalds 	__u16  dev_id;
17581da177e4SLinus Torvalds 	__u32  dev_opt;
17591da177e4SLinus Torvalds };
17601da177e4SLinus Torvalds 
17611da177e4SLinus Torvalds struct hci_dev_list_req {
17621da177e4SLinus Torvalds 	__u16  dev_num;
17631da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
17641da177e4SLinus Torvalds };
17651da177e4SLinus Torvalds 
17661da177e4SLinus Torvalds struct hci_conn_list_req {
17671da177e4SLinus Torvalds 	__u16  dev_id;
17681da177e4SLinus Torvalds 	__u16  conn_num;
17691da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
17701da177e4SLinus Torvalds };
17711da177e4SLinus Torvalds 
17721da177e4SLinus Torvalds struct hci_conn_info_req {
17731da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17741da177e4SLinus Torvalds 	__u8     type;
17751da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
17761da177e4SLinus Torvalds };
17771da177e4SLinus Torvalds 
177840be492fSMarcel Holtmann struct hci_auth_info_req {
177940be492fSMarcel Holtmann 	bdaddr_t bdaddr;
178040be492fSMarcel Holtmann 	__u8     type;
178140be492fSMarcel Holtmann };
178240be492fSMarcel Holtmann 
17831da177e4SLinus Torvalds struct hci_inquiry_req {
17841da177e4SLinus Torvalds 	__u16 dev_id;
17851da177e4SLinus Torvalds 	__u16 flags;
17861da177e4SLinus Torvalds 	__u8  lap[3];
17871da177e4SLinus Torvalds 	__u8  length;
17881da177e4SLinus Torvalds 	__u8  num_rsp;
17891da177e4SLinus Torvalds };
17901da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
17911da177e4SLinus Torvalds 
17921da177e4SLinus Torvalds #endif /* __HCI_H */
1793