xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 5075b972f20ddad5bb19542ea4f5794d06673375)
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
474a3f95b7SMarcel Holtmann #define HCI_DEV_OPEN			7
484a3f95b7SMarcel Holtmann #define HCI_DEV_CLOSE			8
49e131d74aSMarcel Holtmann #define HCI_DEV_SETUP			9
501da177e4SLinus Torvalds 
511da177e4SLinus Torvalds /* HCI notify events */
521da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
531da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
541da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
551da177e4SLinus Torvalds 
56c13854ceSMarcel Holtmann /* HCI bus types */
570ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
581da177e4SLinus Torvalds #define HCI_USB		1
591da177e4SLinus Torvalds #define HCI_PCCARD	2
601da177e4SLinus Torvalds #define HCI_UART	3
611da177e4SLinus Torvalds #define HCI_RS232	4
621da177e4SLinus Torvalds #define HCI_PCI		5
630ac53939SMarcel Holtmann #define HCI_SDIO	6
645c0e03cdSJohan Hedberg #define HCI_SPI		7
655c0e03cdSJohan Hedberg #define HCI_I2C		8
6665010e68SBjorn Andersson #define HCI_SMD		9
671da177e4SLinus Torvalds 
68943da25dSMarcel Holtmann /* HCI controller types */
69ca8bee5dSMarcel Holtmann #define HCI_PRIMARY	0x00
708f1e1742SDavid Vrabel #define HCI_AMP		0x01
71943da25dSMarcel Holtmann 
728598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
736ed971caSMarcel Holtmann #define AMP_ID_BREDR	0x00
748598d064SAndrei Emeltchenko 
757c13823dSMarcel Holtmann /* AMP controller types */
767c13823dSMarcel Holtmann #define AMP_TYPE_BREDR	0x00
777c13823dSMarcel Holtmann #define AMP_TYPE_80211	0x01
787c13823dSMarcel Holtmann 
79ab846ec4SAndrei Emeltchenko /* AMP controller status */
80536619e8SMarcel Holtmann #define AMP_STATUS_POWERED_DOWN			0x00
81536619e8SMarcel Holtmann #define AMP_STATUS_BLUETOOTH_ONLY		0x01
82536619e8SMarcel Holtmann #define AMP_STATUS_NO_CAPACITY			0x02
83536619e8SMarcel Holtmann #define AMP_STATUS_LOW_CAPACITY			0x03
84536619e8SMarcel Holtmann #define AMP_STATUS_MEDIUM_CAPACITY		0x04
85536619e8SMarcel Holtmann #define AMP_STATUS_HIGH_CAPACITY		0x05
86536619e8SMarcel Holtmann #define AMP_STATUS_FULL_CAPACITY		0x06
87ab846ec4SAndrei Emeltchenko 
881da177e4SLinus Torvalds /* HCI device quirks */
891da177e4SLinus Torvalds enum {
90118305b5SMarcel Holtmann 	/* When this quirk is set, the HCI Reset command is send when
91118305b5SMarcel Holtmann 	 * closing the transport instead of when opening it.
92118305b5SMarcel Holtmann 	 *
93118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
94118305b5SMarcel Holtmann 	 */
95a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
96118305b5SMarcel Holtmann 
97118305b5SMarcel Holtmann 	/* When this quirk is set, the device is turned into a raw-only
98118305b5SMarcel Holtmann 	 * device and it will stay in unconfigured state.
99118305b5SMarcel Holtmann 	 *
100118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
101118305b5SMarcel Holtmann 	 */
102da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
103118305b5SMarcel Holtmann 
104118305b5SMarcel Holtmann 	/* When this quirk is set, the buffer sizes reported by
105118305b5SMarcel Holtmann 	 * HCI Read Buffer Size command are corrected if invalid.
106118305b5SMarcel Holtmann 	 *
107118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
108118305b5SMarcel Holtmann 	 */
109f9f462faSMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE,
110118305b5SMarcel Holtmann 
111043ec9bfSMarcel Holtmann 	/* When this quirk is set, then a controller that does not
112043ec9bfSMarcel Holtmann 	 * indicate support for Inquiry Result with RSSI is assumed to
113043ec9bfSMarcel Holtmann 	 * support it anyway. Some early Bluetooth 1.2 controllers had
114043ec9bfSMarcel Holtmann 	 * wrongly configured local features that will require forcing
115043ec9bfSMarcel Holtmann 	 * them to enable this mode. Getting RSSI information with the
116043ec9bfSMarcel Holtmann 	 * inquiry responses is preferred since it allows for a better
117043ec9bfSMarcel Holtmann 	 * user expierence.
118043ec9bfSMarcel Holtmann 	 *
119043ec9bfSMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
120043ec9bfSMarcel Holtmann 	 */
121043ec9bfSMarcel Holtmann 	HCI_QUIRK_FIXUP_INQUIRY_MODE,
122043ec9bfSMarcel Holtmann 
123711ffa78SMarcel Holtmann 	/* When this quirk is set, then the HCI Read Local Supported
124711ffa78SMarcel Holtmann 	 * Commands command is not supported. In general Bluetooth 1.2
125711ffa78SMarcel Holtmann 	 * and later controllers should support this command. However
126711ffa78SMarcel Holtmann 	 * some controllers indicate Bluetooth 1.2 support, but do
127711ffa78SMarcel Holtmann 	 * not support this command.
128711ffa78SMarcel Holtmann 	 *
129711ffa78SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
130711ffa78SMarcel Holtmann 	 */
131711ffa78SMarcel Holtmann 	HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
132711ffa78SMarcel Holtmann 
133118305b5SMarcel Holtmann 	/* When this quirk is set, then no stored link key handling
134118305b5SMarcel Holtmann 	 * is performed. This is mainly due to the fact that the
135118305b5SMarcel Holtmann 	 * HCI Delete Stored Link Key command is advertised, but
136118305b5SMarcel Holtmann 	 * not supported.
137118305b5SMarcel Holtmann 	 *
138118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
139118305b5SMarcel Holtmann 	 */
140f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
14189bc22d2SMarcel Holtmann 
142eb1904f4SMarcel Holtmann 	/* When this quirk is set, an external configuration step
143eb1904f4SMarcel Holtmann 	 * is required and will be indicated with the controller
144eb1904f4SMarcel Holtmann 	 * configuation.
145eb1904f4SMarcel Holtmann 	 *
146eb1904f4SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
147eb1904f4SMarcel Holtmann 	 * during the hdev->setup vendor callback.
148eb1904f4SMarcel Holtmann 	 */
149eb1904f4SMarcel Holtmann 	HCI_QUIRK_EXTERNAL_CONFIG,
150eb1904f4SMarcel Holtmann 
15189bc22d2SMarcel Holtmann 	/* When this quirk is set, the public Bluetooth address
15289bc22d2SMarcel Holtmann 	 * initially reported by HCI Read BD Address command
15389bc22d2SMarcel Holtmann 	 * is considered invalid. Controller configuration is
15489bc22d2SMarcel Holtmann 	 * required before this device can be used.
15589bc22d2SMarcel Holtmann 	 *
15689bc22d2SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
15789bc22d2SMarcel Holtmann 	 * during the hdev->setup vendor callback.
15889bc22d2SMarcel Holtmann 	 */
15989bc22d2SMarcel Holtmann 	HCI_QUIRK_INVALID_BDADDR,
16043d6bc46SMarcel Holtmann 
16143d6bc46SMarcel Holtmann 	/* When this quirk is set, the duplicate filtering during
16243d6bc46SMarcel Holtmann 	 * scanning is based on Bluetooth devices addresses. To allow
16343d6bc46SMarcel Holtmann 	 * RSSI based updates, restart scanning if needed.
16443d6bc46SMarcel Holtmann 	 *
16543d6bc46SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
16643d6bc46SMarcel Holtmann 	 * during the hdev->setup vendor callback.
16743d6bc46SMarcel Holtmann 	 */
16843d6bc46SMarcel Holtmann 	HCI_QUIRK_STRICT_DUPLICATE_FILTER,
169695c4cb6SJakub Pawlowski 
170695c4cb6SJakub Pawlowski 	/* When this quirk is set, LE scan and BR/EDR inquiry is done
171695c4cb6SJakub Pawlowski 	 * simultaneously, otherwise it's interleaved.
172695c4cb6SJakub Pawlowski 	 *
173695c4cb6SJakub Pawlowski 	 * This quirk can be set before hci_register_dev is called or
174695c4cb6SJakub Pawlowski 	 * during the hdev->setup vendor callback.
175695c4cb6SJakub Pawlowski 	 */
176695c4cb6SJakub Pawlowski 	HCI_QUIRK_SIMULTANEOUS_DISCOVERY,
1777e995b9eSMarcel Holtmann 
1787e995b9eSMarcel Holtmann 	/* When this quirk is set, the enabling of diagnostic mode is
1797e995b9eSMarcel Holtmann 	 * not persistent over HCI Reset. Every time the controller
1807e995b9eSMarcel Holtmann 	 * is brought up it needs to be reprogrammed.
1817e995b9eSMarcel Holtmann 	 *
1827e995b9eSMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
1837e995b9eSMarcel Holtmann 	 * during the hdev->setup vendor callback.
1847e995b9eSMarcel Holtmann 	 */
1857e995b9eSMarcel Holtmann 	HCI_QUIRK_NON_PERSISTENT_DIAG,
1861da177e4SLinus Torvalds };
1871da177e4SLinus Torvalds 
1881da177e4SLinus Torvalds /* HCI device flags */
1891da177e4SLinus Torvalds enum {
1901da177e4SLinus Torvalds 	HCI_UP,
1911da177e4SLinus Torvalds 	HCI_INIT,
1921da177e4SLinus Torvalds 	HCI_RUNNING,
1931da177e4SLinus Torvalds 
1941da177e4SLinus Torvalds 	HCI_PSCAN,
1951da177e4SLinus Torvalds 	HCI_ISCAN,
1961da177e4SLinus Torvalds 	HCI_AUTH,
1971da177e4SLinus Torvalds 	HCI_ENCRYPT,
1981da177e4SLinus Torvalds 	HCI_INQUIRY,
1991da177e4SLinus Torvalds 
2001da177e4SLinus Torvalds 	HCI_RAW,
201ab81cbf9SJohan Hedberg 
20210572132SGustavo F. Padovan 	HCI_RESET,
2031da177e4SLinus Torvalds };
2041da177e4SLinus Torvalds 
205f9207338SMarcel Holtmann /* HCI socket flags */
206f9207338SMarcel Holtmann enum {
20750ebc055SMarcel Holtmann 	HCI_SOCK_TRUSTED,
208f9207338SMarcel Holtmann 	HCI_MGMT_INDEX_EVENTS,
209f9207338SMarcel Holtmann 	HCI_MGMT_UNCONF_INDEX_EVENTS,
210ced85549SMarcel Holtmann 	HCI_MGMT_EXT_INDEX_EVENTS,
211321c6feeSMarcel Holtmann 	HCI_MGMT_EXT_INFO_EVENTS,
2125504c3a3SMarcel Holtmann 	HCI_MGMT_OPTION_EVENTS,
2135504c3a3SMarcel Holtmann 	HCI_MGMT_SETTING_EVENTS,
2145504c3a3SMarcel Holtmann 	HCI_MGMT_DEV_CLASS_EVENTS,
2155504c3a3SMarcel Holtmann 	HCI_MGMT_LOCAL_NAME_EVENTS,
21672000df2SMarcel Holtmann 	HCI_MGMT_OOB_DATA_EVENTS,
217f9207338SMarcel Holtmann };
218f9207338SMarcel Holtmann 
219d23264a8SAndre Guedes /*
220d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
221d23264a8SAndre Guedes  * states from the controller.
222d23264a8SAndre Guedes  */
223d23264a8SAndre Guedes enum {
224a8b2d5c2SJohan Hedberg 	HCI_SETUP,
225d603b76bSMarcel Holtmann 	HCI_CONFIG,
226a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
2275e130367SJohan Hedberg 	HCI_RFKILLED,
228a8b2d5c2SJohan Hedberg 	HCI_MGMT,
229b6ae8457SJohan Hedberg 	HCI_BONDABLE,
230a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
2310663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
2323769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
23394324962SJohan Hovold 	HCI_UNREGISTER,
2344a964404SMarcel Holtmann 	HCI_UNCONFIGURED,
2350736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
236dbece37aSMarcel Holtmann 	HCI_EXT_CONFIGURED,
23766c417c1SJohan Hedberg 	HCI_LE_ADV,
238d23264a8SAndre Guedes 	HCI_LE_SCAN,
23984bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
240e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
241134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
242863efaf2SJohan Hedberg 	HCI_PRIVACY,
24382a37adeSJohan Hedberg 	HCI_LIMITED_PRIVACY,
244d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
24541edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
2466d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
24706199cf8SJohan Hedberg 	HCI_LE_ENABLED,
248f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
249cc91cb04SMarcel Holtmann 	HCI_ADVERTISING_CONNECTABLE,
2505e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
2515e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
2526acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
25347990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
25421693c15SAndre Guedes 	HCI_PERIODIC_INQ,
2551a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
25656f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
25781ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
258b7cb93e5SMarcel Holtmann 
259b7cb93e5SMarcel Holtmann 	HCI_DUT_MODE,
2604b4113d6SMarcel Holtmann 	HCI_VENDOR_DIAG,
261b7cb93e5SMarcel Holtmann 	HCI_FORCE_BREDR_SMP,
262b7cb93e5SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
263b7cb93e5SMarcel Holtmann 
264eacb44dfSMarcel Holtmann 	__HCI_NUM_FLAGS,
265d23264a8SAndre Guedes };
266d23264a8SAndre Guedes 
2671da177e4SLinus Torvalds /* HCI timeouts */
2685f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2695f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
2705f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
271d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
2725f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
2739345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
274a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
2759489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
2761f01d8beSKonrad Zapałowicz #define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(4000)	/* 4 seconds */
2771da177e4SLinus Torvalds 
2785b7f9909SMarcel Holtmann /* HCI data types */
2791da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
2801da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
2811da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
2821da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
283e875ff84SMarcel Holtmann #define HCI_DIAG_PKT		0xf0
2841da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2851da177e4SLinus Torvalds 
2865b7f9909SMarcel Holtmann /* HCI packet types */
2871da177e4SLinus Torvalds #define HCI_DM1		0x0008
2881da177e4SLinus Torvalds #define HCI_DM3		0x0400
2891da177e4SLinus Torvalds #define HCI_DM5		0x4000
2901da177e4SLinus Torvalds #define HCI_DH1		0x0010
2911da177e4SLinus Torvalds #define HCI_DH3		0x0800
2921da177e4SLinus Torvalds #define HCI_DH5		0x8000
2931da177e4SLinus Torvalds 
294*5075b972SJaganath Kanakkassery /* HCI packet types inverted masks */
295*5075b972SJaganath Kanakkassery #define HCI_2DH1	0x0002
296*5075b972SJaganath Kanakkassery #define HCI_3DH1	0x0004
297*5075b972SJaganath Kanakkassery #define HCI_2DH3	0x0100
298*5075b972SJaganath Kanakkassery #define HCI_3DH3	0x0200
299*5075b972SJaganath Kanakkassery #define HCI_2DH5	0x1000
300*5075b972SJaganath Kanakkassery #define HCI_3DH5	0x2000
301*5075b972SJaganath Kanakkassery 
3021da177e4SLinus Torvalds #define HCI_HV1		0x0020
3031da177e4SLinus Torvalds #define HCI_HV2		0x0040
3041da177e4SLinus Torvalds #define HCI_HV3		0x0080
3051da177e4SLinus Torvalds 
3061da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
3071da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
3081da177e4SLinus Torvalds 
3095b7f9909SMarcel Holtmann /* eSCO packet types */
3105b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
3115b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
3125b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
3135b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
3145b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
3155b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
316efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
317efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
318efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
319efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
3205b7f9909SMarcel Holtmann 
321a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
322efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
323a8746417SMarcel Holtmann 
3241da177e4SLinus Torvalds /* ACL flags */
325e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
3261da177e4SLinus Torvalds #define ACL_CONT		0x01
3271da177e4SLinus Torvalds #define ACL_START		0x02
328d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
3291da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
3301da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
3311da177e4SLinus Torvalds 
3321da177e4SLinus Torvalds /* Baseband links */
3331da177e4SLinus Torvalds #define SCO_LINK	0x00
3341da177e4SLinus Torvalds #define ACL_LINK	0x01
3355b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
336fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
337fcd89c09SVille Tervo #define LE_LINK		0x80
3383161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
339845472e8SMarcel Holtmann #define INVALID_LINK	0xff
3401da177e4SLinus Torvalds 
3411da177e4SLinus Torvalds /* LMP features */
3421da177e4SLinus Torvalds #define LMP_3SLOT	0x01
3431da177e4SLinus Torvalds #define LMP_5SLOT	0x02
3441da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
3451da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
3461da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
3471da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
3481da177e4SLinus Torvalds #define LMP_HOLD	0x40
34904837f64SMarcel Holtmann #define LMP_SNIFF	0x80
3501da177e4SLinus Torvalds 
3511da177e4SLinus Torvalds #define LMP_PARK	0x01
3521da177e4SLinus Torvalds #define LMP_RSSI	0x02
3531da177e4SLinus Torvalds #define LMP_QUALITY	0x04
3541da177e4SLinus Torvalds #define LMP_SCO		0x08
3551da177e4SLinus Torvalds #define LMP_HV2		0x10
3561da177e4SLinus Torvalds #define LMP_HV3		0x20
3571da177e4SLinus Torvalds #define LMP_ULAW	0x40
3581da177e4SLinus Torvalds #define LMP_ALAW	0x80
3591da177e4SLinus Torvalds 
3601da177e4SLinus Torvalds #define LMP_CVSD	0x01
3611da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
3621da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
36307a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
3641da177e4SLinus Torvalds 
365*5075b972SJaganath Kanakkassery #define LMP_EDR_2M		0x02
366*5075b972SJaganath Kanakkassery #define LMP_EDR_3M		0x04
367d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
3685b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
3695b7f9909SMarcel Holtmann 
3705b7f9909SMarcel Holtmann #define LMP_EV4		0x01
3715b7f9909SMarcel Holtmann #define LMP_EV5		0x02
37269ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
373d5859e22SJohan Hedberg #define LMP_LE		0x40
374*5075b972SJaganath Kanakkassery #define LMP_EDR_3SLOT	0x80
3755b7f9909SMarcel Holtmann 
376*5075b972SJaganath Kanakkassery #define LMP_EDR_5SLOT	0x01
37704837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
378d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
379efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
380efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
381efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
38204837f64SMarcel Holtmann 
383d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
384e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
385769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
386e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
387769be974SMarcel Holtmann 
388d5859e22SJohan Hedberg #define LMP_LSTO	0x01
389d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
390971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
391d5859e22SJohan Hedberg 
392eead27daSAndre Guedes /* Extended LMP features */
39353b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
39453b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
39553b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
39653b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
39753b834d2SMarcel Holtmann 
398d5991585SMarcel Holtmann #define LMP_SC		0x01
399d5991585SMarcel Holtmann #define LMP_PING	0x02
400d5991585SMarcel Holtmann 
40153b834d2SMarcel Holtmann /* Host features */
402cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
403eead27daSAndre Guedes #define LMP_HOST_LE		0x02
404cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
405d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
406eead27daSAndre Guedes 
407662bc2e6SAndre Guedes /* LE features */
4080da71f1bSMarcel Holtmann #define HCI_LE_ENCRYPTION		0x01
409662bc2e6SAndre Guedes #define HCI_LE_CONN_PARAM_REQ_PROC	0x02
4100fe29fd1SMarcel Holtmann #define HCI_LE_SLAVE_FEATURES		0x08
411cd7ca0ecSMarcel Holtmann #define HCI_LE_PING			0x10
41294a3bd02SMarcel Holtmann #define HCI_LE_DATA_LEN_EXT		0x20
4134b71bba4SMarcel Holtmann #define HCI_LE_EXT_SCAN_POLICY		0x80
414*5075b972SJaganath Kanakkassery #define HCI_LE_PHY_2M			0x01
415*5075b972SJaganath Kanakkassery #define HCI_LE_PHY_CODED		0x08
4169756d33bSMarcel Holtmann #define HCI_LE_CHAN_SEL_ALG2		0x40
417662bc2e6SAndre Guedes 
41804837f64SMarcel Holtmann /* Connection modes */
41904837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
42004837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
42104837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
42204837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
42304837f64SMarcel Holtmann 
4241da177e4SLinus Torvalds /* Link policies */
4251da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
4261da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
4271da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
4281da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
4291da177e4SLinus Torvalds 
43004837f64SMarcel Holtmann /* Link modes */
4311da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
4321da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
4331da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
4341da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
4351da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
4361da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
4371da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
4387b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
4391da177e4SLinus Torvalds 
44040be492fSMarcel Holtmann /* Authentication types */
44140be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
44240be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
44340be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
44440be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
44540be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
44640be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
44740be492fSMarcel Holtmann 
448a77b15a6SMikel Astiz /* I/O capabilities */
449a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
450a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
451a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
452a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
453a77b15a6SMikel Astiz 
454b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
455b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
456b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
457b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
458b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
45911015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
46011015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
461b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
46211015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
46311015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
464b6020ba0SWaldemar Rymarkiewicz 
4659f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
4668e75b46aSAndre Guedes #define HCI_ERROR_UNKNOWN_CONN_ID	0x02
4679f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
468160b9251SSzymon Janc #define HCI_ERROR_PIN_OR_KEY_MISSING	0x06
4692acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
470cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
471d41c15cfSJohan Hedberg #define HCI_ERROR_REJ_LIMITED_RESOURCES	0x0d
4729f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
4739f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
474cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
475cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
4769f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
4779f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
4784ebeee2dSJohan Hedberg #define HCI_ERROR_INVALID_LL_PARAMS	0x1e
4794ebeee2dSJohan Hedberg #define HCI_ERROR_UNSPECIFIED		0x1f
4803c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
4819f5a0d7bSAndrei Emeltchenko 
4822455a3eaSAndrei Emeltchenko /* Flow control modes */
4832455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
4842455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
4852455a3eaSAndrei Emeltchenko 
486bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
487bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
488a89612aaSMarcel Holtmann #define HCI_RSSI_INVALID	127
489bbaf444aSJohan Hedberg 
490ba165a90SJohan Hedberg #define HCI_ROLE_MASTER		0x00
491ba165a90SJohan Hedberg #define HCI_ROLE_SLAVE		0x01
492ba165a90SJohan Hedberg 
49332748db0SJohan Hedberg /* Extended Inquiry Response field types */
49432748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
49532748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
49632748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
49732748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
49832748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
49932748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
50032748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
50132748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
50232748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
50332748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
5049ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
505d619ffcfSJohan Hedberg #define EIR_SSP_HASH_C192	0x0E /* Simple Pairing Hash C-192 */
506d619ffcfSJohan Hedberg #define EIR_SSP_RAND_R192	0x0F /* Simple Pairing Randomizer R-192 */
50732748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
5084453b006SArman Uguray #define EIR_APPEARANCE		0x19 /* Device appearance */
5091471aae0SMarcel Holtmann #define EIR_LE_BDADDR		0x1B /* LE Bluetooth device address */
5101471aae0SMarcel Holtmann #define EIR_LE_ROLE		0x1C /* LE role */
511d619ffcfSJohan Hedberg #define EIR_SSP_HASH_C256	0x1D /* Simple Pairing Hash C-256 */
512d619ffcfSJohan Hedberg #define EIR_SSP_RAND_R256	0x1E /* Simple Pairing Rand R-256 */
513f709bfcfSMarcel Holtmann #define EIR_LE_SC_CONFIRM	0x22 /* LE SC Confirmation Value */
514f709bfcfSMarcel Holtmann #define EIR_LE_SC_RANDOM	0x23 /* LE SC Random Value */
51532748db0SJohan Hedberg 
5163f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
5173f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
5183f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
5193f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
5203f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
5213f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
5223f0f524bSJohan Hedberg 
5231da177e4SLinus Torvalds /* -----  HCI Commands ---- */
5246bd32326SVille Tervo #define HCI_OP_NOP			0x0000
5256bd32326SVille Tervo 
526a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
527a9de9248SMarcel Holtmann struct hci_cp_inquiry {
528a9de9248SMarcel Holtmann 	__u8     lap[3];
529a9de9248SMarcel Holtmann 	__u8     length;
530a9de9248SMarcel Holtmann 	__u8     num_rsp;
53166c853ccSGustavo F. Padovan } __packed;
5321da177e4SLinus Torvalds 
533a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
534a9de9248SMarcel Holtmann 
53579d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
53679d6e068SAndre Guedes 
537a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
538a9de9248SMarcel Holtmann 
539a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
540a9de9248SMarcel Holtmann struct hci_cp_create_conn {
541a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
542a9de9248SMarcel Holtmann 	__le16   pkt_type;
543a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
544a9de9248SMarcel Holtmann 	__u8     pscan_mode;
545a9de9248SMarcel Holtmann 	__le16   clock_offset;
546a9de9248SMarcel Holtmann 	__u8     role_switch;
54766c853ccSGustavo F. Padovan } __packed;
5481da177e4SLinus Torvalds 
549a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
550a9de9248SMarcel Holtmann struct hci_cp_disconnect {
551a9de9248SMarcel Holtmann 	__le16   handle;
552a9de9248SMarcel Holtmann 	__u8     reason;
55366c853ccSGustavo F. Padovan } __packed;
5541da177e4SLinus Torvalds 
555a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
556a9de9248SMarcel Holtmann struct hci_cp_add_sco {
557a9de9248SMarcel Holtmann 	__le16   handle;
558a9de9248SMarcel Holtmann 	__le16   pkt_type;
55966c853ccSGustavo F. Padovan } __packed;
560a9de9248SMarcel Holtmann 
561a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
562a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
5631da177e4SLinus Torvalds 	bdaddr_t bdaddr;
56466c853ccSGustavo F. Padovan } __packed;
5651da177e4SLinus Torvalds 
566a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
567a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
568a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
569a9de9248SMarcel Holtmann 	__u8     role;
57066c853ccSGustavo F. Padovan } __packed;
5711da177e4SLinus Torvalds 
572a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
573a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
574a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
575a9de9248SMarcel Holtmann 	__u8     reason;
57666c853ccSGustavo F. Padovan } __packed;
5771da177e4SLinus Torvalds 
578a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
579a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
580a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
5819b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
58266c853ccSGustavo F. Padovan } __packed;
5831da177e4SLinus Torvalds 
584a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
585a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
586a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
58766c853ccSGustavo F. Padovan } __packed;
5881da177e4SLinus Torvalds 
589a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
590a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
591a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
592a9de9248SMarcel Holtmann 	__u8     pin_len;
593a9de9248SMarcel Holtmann 	__u8     pin_code[16];
59466c853ccSGustavo F. Padovan } __packed;
595980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
596980e1a53SJohan Hedberg 	__u8     status;
597980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
598980e1a53SJohan Hedberg } __packed;
599a9de9248SMarcel Holtmann 
600a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
601a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
602a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
60366c853ccSGustavo F. Padovan } __packed;
604980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
605980e1a53SJohan Hedberg 	__u8     status;
606980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
607980e1a53SJohan Hedberg } __packed;
608a9de9248SMarcel Holtmann 
609a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
610a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
611a9de9248SMarcel Holtmann 	__le16   handle;
612a9de9248SMarcel Holtmann 	__le16   pkt_type;
61366c853ccSGustavo F. Padovan } __packed;
614a9de9248SMarcel Holtmann 
615a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
616a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
617a9de9248SMarcel Holtmann 	__le16   handle;
61866c853ccSGustavo F. Padovan } __packed;
619a9de9248SMarcel Holtmann 
620a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
621a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
622a9de9248SMarcel Holtmann 	__le16   handle;
623a9de9248SMarcel Holtmann 	__u8     encrypt;
62466c853ccSGustavo F. Padovan } __packed;
625a9de9248SMarcel Holtmann 
626a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
627a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
628a9de9248SMarcel Holtmann 	__le16   handle;
62966c853ccSGustavo F. Padovan } __packed;
630a9de9248SMarcel Holtmann 
631a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
632a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
633a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
634a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
635a9de9248SMarcel Holtmann 	__u8     pscan_mode;
636a9de9248SMarcel Holtmann 	__le16   clock_offset;
63766c853ccSGustavo F. Padovan } __packed;
638a9de9248SMarcel Holtmann 
639a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
640a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
641a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
64266c853ccSGustavo F. Padovan } __packed;
643a9de9248SMarcel Holtmann 
644a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
645a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
646a9de9248SMarcel Holtmann 	__le16   handle;
64766c853ccSGustavo F. Padovan } __packed;
648a9de9248SMarcel Holtmann 
649a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
650a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
651a9de9248SMarcel Holtmann 	__le16   handle;
652a9de9248SMarcel Holtmann 	__u8     page;
65366c853ccSGustavo F. Padovan } __packed;
654a9de9248SMarcel Holtmann 
655a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
656a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
657a9de9248SMarcel Holtmann 	__le16   handle;
65866c853ccSGustavo F. Padovan } __packed;
659a9de9248SMarcel Holtmann 
660df935429SMarcel Holtmann #define HCI_OP_READ_CLOCK_OFFSET	0x041f
661df935429SMarcel Holtmann struct hci_cp_read_clock_offset {
662df935429SMarcel Holtmann 	__le16   handle;
663df935429SMarcel Holtmann } __packed;
664df935429SMarcel Holtmann 
665a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
666a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
667a9de9248SMarcel Holtmann 	__le16   handle;
668a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
669a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
670a9de9248SMarcel Holtmann 	__le16   max_latency;
671a9de9248SMarcel Holtmann 	__le16   voice_setting;
672a9de9248SMarcel Holtmann 	__u8     retrans_effort;
673a9de9248SMarcel Holtmann 	__le16   pkt_type;
67466c853ccSGustavo F. Padovan } __packed;
675a9de9248SMarcel Holtmann 
676a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
677a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
678a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
679a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
680a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
681a9de9248SMarcel Holtmann 	__le16   max_latency;
682a9de9248SMarcel Holtmann 	__le16   content_format;
683a9de9248SMarcel Holtmann 	__u8     retrans_effort;
684a9de9248SMarcel Holtmann 	__le16   pkt_type;
68566c853ccSGustavo F. Padovan } __packed;
686a9de9248SMarcel Holtmann 
687a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
688a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
689a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
690a9de9248SMarcel Holtmann 	__u8     reason;
69166c853ccSGustavo F. Padovan } __packed;
692a9de9248SMarcel Holtmann 
69317fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
69417fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
69517fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
69617fa4b9dSJohan Hedberg 	__u8     capability;
69717fa4b9dSJohan Hedberg 	__u8     oob_data;
69817fa4b9dSJohan Hedberg 	__u8     authentication;
69917fa4b9dSJohan Hedberg } __packed;
70017fa4b9dSJohan Hedberg 
701a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
702a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
703a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
704a5c29683SJohan Hedberg } __packed;
705a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
706a5c29683SJohan Hedberg 	__u8     status;
707a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
708a5c29683SJohan Hedberg } __packed;
709a5c29683SJohan Hedberg 
710a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
711a5c29683SJohan Hedberg 
7129ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
7139ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
7149ad4019aSBrian Gix 	bdaddr_t bdaddr;
7159ad4019aSBrian Gix 	__le32	passkey;
7169ad4019aSBrian Gix } __packed;
7179ad4019aSBrian Gix 
7189ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
7199ad4019aSBrian Gix 
7202763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
7212763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
7222763eda6SSzymon Janc 	bdaddr_t bdaddr;
7232763eda6SSzymon Janc 	__u8     hash[16];
72438da1703SJohan Hedberg 	__u8     rand[16];
7252763eda6SSzymon Janc } __packed;
7262763eda6SSzymon Janc 
7272763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
7282763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
7292763eda6SSzymon Janc 	bdaddr_t bdaddr;
7302763eda6SSzymon Janc } __packed;
7312763eda6SSzymon Janc 
73203b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
73303b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
73403b555e1SJohan Hedberg 	bdaddr_t bdaddr;
73503b555e1SJohan Hedberg 	__u8     reason;
73603b555e1SJohan Hedberg } __packed;
73703b555e1SJohan Hedberg 
738523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
739523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
740523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
741523e93cdSAndrei Emeltchenko 	__u8     key_len;
742523e93cdSAndrei Emeltchenko 	__u8     key_type;
743523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
744523e93cdSAndrei Emeltchenko } __packed;
745523e93cdSAndrei Emeltchenko 
746523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
747523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
748523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
749523e93cdSAndrei Emeltchenko 	__u8     key_len;
750523e93cdSAndrei Emeltchenko 	__u8     key_type;
751523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
752523e93cdSAndrei Emeltchenko } __packed;
753523e93cdSAndrei Emeltchenko 
754523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
755523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
756523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
757523e93cdSAndrei Emeltchenko 	__u8     reason;
758b078b564SAndrei Emeltchenko } __packed;
759b078b564SAndrei Emeltchenko 
760b078b564SAndrei Emeltchenko struct ext_flow_spec {
761b078b564SAndrei Emeltchenko 	__u8       id;
762b078b564SAndrei Emeltchenko 	__u8       stype;
763b078b564SAndrei Emeltchenko 	__le16     msdu;
764b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
765b078b564SAndrei Emeltchenko 	__le32     acc_lat;
766b078b564SAndrei Emeltchenko 	__le32     flush_to;
767b078b564SAndrei Emeltchenko } __packed;
768b078b564SAndrei Emeltchenko 
769b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
770b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
771b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
772b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
773b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
774b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
775b078b564SAndrei Emeltchenko } __packed;
776b078b564SAndrei Emeltchenko 
777b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
778b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
779b078b564SAndrei Emeltchenko 	__le16   log_handle;
780b078b564SAndrei Emeltchenko } __packed;
781b078b564SAndrei Emeltchenko 
782b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
783b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
784b078b564SAndrei Emeltchenko 	__u8     phy_handle;
785b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
786b078b564SAndrei Emeltchenko } __packed;
787b078b564SAndrei Emeltchenko 
788b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
789b078b564SAndrei Emeltchenko 	__u8     status;
790b078b564SAndrei Emeltchenko 	__u8     phy_handle;
791b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
792523e93cdSAndrei Emeltchenko } __packed;
793523e93cdSAndrei Emeltchenko 
7948c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
7958c9a041bSDoHyun Pyun struct hci_cp_set_csb {
7968c9a041bSDoHyun Pyun 	__u8	enable;
7978c9a041bSDoHyun Pyun 	__u8	lt_addr;
7988c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
7998c9a041bSDoHyun Pyun 	__le16	packet_type;
8008c9a041bSDoHyun Pyun 	__le16	interval_min;
8018c9a041bSDoHyun Pyun 	__le16	interval_max;
8028c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
8038c9a041bSDoHyun Pyun } __packed;
8048c9a041bSDoHyun Pyun struct hci_rp_set_csb {
8058c9a041bSDoHyun Pyun 	__u8	status;
8068c9a041bSDoHyun Pyun 	__u8	lt_addr;
8078c9a041bSDoHyun Pyun 	__le16	interval;
8088c9a041bSDoHyun Pyun } __packed;
8098c9a041bSDoHyun Pyun 
810cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
811cefded98SDoHyun Pyun 
812e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
813e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
814e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
815e2f99131SMarcel Holtmann 	__u8     hash192[16];
81638da1703SJohan Hedberg 	__u8     rand192[16];
817e2f99131SMarcel Holtmann 	__u8     hash256[16];
81838da1703SJohan Hedberg 	__u8     rand256[16];
819e2f99131SMarcel Holtmann } __packed;
820e2f99131SMarcel Holtmann 
821a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
822a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
823a9de9248SMarcel Holtmann 	__le16   handle;
824a9de9248SMarcel Holtmann 	__le16   max_interval;
825a9de9248SMarcel Holtmann 	__le16   min_interval;
826a9de9248SMarcel Holtmann 	__le16   attempt;
827a9de9248SMarcel Holtmann 	__le16   timeout;
82866c853ccSGustavo F. Padovan } __packed;
829a9de9248SMarcel Holtmann 
830a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
831a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
832a9de9248SMarcel Holtmann 	__le16   handle;
83366c853ccSGustavo F. Padovan } __packed;
834a9de9248SMarcel Holtmann 
835a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
836a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
837a9de9248SMarcel Holtmann 	__le16   handle;
83866c853ccSGustavo F. Padovan } __packed;
839a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
840a9de9248SMarcel Holtmann 	__u8     status;
841a9de9248SMarcel Holtmann 	__le16   handle;
842a9de9248SMarcel Holtmann 	__u8     role;
84366c853ccSGustavo F. Padovan } __packed;
844a9de9248SMarcel Holtmann 
845a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
846a9de9248SMarcel Holtmann struct hci_cp_switch_role {
847a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
848a9de9248SMarcel Holtmann 	__u8     role;
84966c853ccSGustavo F. Padovan } __packed;
850a9de9248SMarcel Holtmann 
851a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
852a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
853a9de9248SMarcel Holtmann 	__le16   handle;
85466c853ccSGustavo F. Padovan } __packed;
855a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
856a9de9248SMarcel Holtmann 	__u8     status;
857a9de9248SMarcel Holtmann 	__le16   handle;
858a9de9248SMarcel Holtmann 	__le16   policy;
85966c853ccSGustavo F. Padovan } __packed;
860a9de9248SMarcel Holtmann 
861a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
862a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
863a9de9248SMarcel Holtmann 	__le16   handle;
864a9de9248SMarcel Holtmann 	__le16   policy;
86566c853ccSGustavo F. Padovan } __packed;
866a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
867a9de9248SMarcel Holtmann 	__u8     status;
868a9de9248SMarcel Holtmann 	__le16   handle;
86966c853ccSGustavo F. Padovan } __packed;
870a9de9248SMarcel Holtmann 
871e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
872e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
873e4e8e37cSMarcel Holtmann 	__u8     status;
874e4e8e37cSMarcel Holtmann 	__le16   policy;
87566c853ccSGustavo F. Padovan } __packed;
876e4e8e37cSMarcel Holtmann 
877e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
878e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
879e4e8e37cSMarcel Holtmann 	__le16   policy;
88066c853ccSGustavo F. Padovan } __packed;
881e4e8e37cSMarcel Holtmann 
882a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
883a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
884a9de9248SMarcel Holtmann 	__le16   handle;
885a9de9248SMarcel Holtmann 	__le16   max_latency;
886a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
887a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
88866c853ccSGustavo F. Padovan } __packed;
889a9de9248SMarcel Holtmann 
890a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
891a9de9248SMarcel Holtmann 
892a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
893a9de9248SMarcel Holtmann 
894a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
8951da177e4SLinus Torvalds struct hci_cp_set_event_flt {
8961da177e4SLinus Torvalds 	__u8     flt_type;
8971da177e4SLinus Torvalds 	__u8     cond_type;
8981da177e4SLinus Torvalds 	__u8     condition[0];
89966c853ccSGustavo F. Padovan } __packed;
9001da177e4SLinus Torvalds 
9011da177e4SLinus Torvalds /* Filter types */
9021da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
9031da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
9041da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
9051da177e4SLinus Torvalds 
9061da177e4SLinus Torvalds /* CONN_SETUP Condition types */
9071da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
9081da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
9091da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
9101da177e4SLinus Torvalds 
9111da177e4SLinus Torvalds /* CONN_SETUP Conditions */
9121da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
9131da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
9141da177e4SLinus Torvalds 
915cb962780SMarcel Holtmann #define HCI_OP_READ_STORED_LINK_KEY	0x0c0d
916cb962780SMarcel Holtmann struct hci_cp_read_stored_link_key {
917cb962780SMarcel Holtmann 	bdaddr_t bdaddr;
918cb962780SMarcel Holtmann 	__u8     read_all;
919cb962780SMarcel Holtmann } __packed;
920cb962780SMarcel Holtmann struct hci_rp_read_stored_link_key {
921cb962780SMarcel Holtmann 	__u8     status;
922cb962780SMarcel Holtmann 	__u8     max_keys;
923cb962780SMarcel Holtmann 	__u8     num_keys;
924cb962780SMarcel Holtmann } __packed;
925cb962780SMarcel Holtmann 
926b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
927b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
928b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
929b0916ea0SJohan Hedberg 	__u8     delete_all;
930b0916ea0SJohan Hedberg } __packed;
931039d4e41SMarcel Holtmann struct hci_rp_delete_stored_link_key {
932039d4e41SMarcel Holtmann 	__u8     status;
933039d4e41SMarcel Holtmann 	__u8     num_keys;
934039d4e41SMarcel Holtmann } __packed;
935b0916ea0SJohan Hedberg 
9361f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
9371f6c6378SJohan Hedberg 
938a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
939a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
9401f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
94166c853ccSGustavo F. Padovan } __packed;
942a9de9248SMarcel Holtmann 
943a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
944a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
945a9de9248SMarcel Holtmann 	__u8     status;
9461f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
94766c853ccSGustavo F. Padovan } __packed;
948a9de9248SMarcel Holtmann 
949a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
950a9de9248SMarcel Holtmann 
951a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
952a9de9248SMarcel Holtmann 
953a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
954a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
955a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
956a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
957a9de9248SMarcel Holtmann 
958a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
959a9de9248SMarcel Holtmann 
960a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
961a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
962a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
963a9de9248SMarcel Holtmann 
964a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
965a9de9248SMarcel Holtmann 
966a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
967a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
968a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
969a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
970a9de9248SMarcel Holtmann 
971a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
972a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
9731da177e4SLinus Torvalds 	__u8     status;
9741da177e4SLinus Torvalds 	__u8     dev_class[3];
97566c853ccSGustavo F. Padovan } __packed;
9761da177e4SLinus Torvalds 
977a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
978a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
9791da177e4SLinus Torvalds 	__u8     dev_class[3];
98066c853ccSGustavo F. Padovan } __packed;
9811da177e4SLinus Torvalds 
982a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
9831da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
9841da177e4SLinus Torvalds 	__u8     status;
9851ebb9252SMarcel Holtmann 	__le16   voice_setting;
98666c853ccSGustavo F. Padovan } __packed;
9871da177e4SLinus Torvalds 
988a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
9891da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
9901ebb9252SMarcel Holtmann 	__le16   voice_setting;
99166c853ccSGustavo F. Padovan } __packed;
9921da177e4SLinus Torvalds 
993a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
9941da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
9951ebb9252SMarcel Holtmann 	__le16   acl_mtu;
9961da177e4SLinus Torvalds 	__u8     sco_mtu;
9971ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
9981ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
99966c853ccSGustavo F. Padovan } __packed;
10001da177e4SLinus Torvalds 
1001b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
1002b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
1003b4cb9fb2SMarcel Holtmann 	__u8	status;
1004b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
1005b4cb9fb2SMarcel Holtmann } __packed;
1006b4cb9fb2SMarcel Holtmann 
10074b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
10084b836f39SMarcel Holtmann 
10093d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
10103d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
10113d505312SMarcel Holtmann 	__u8	num_iac;
10123d505312SMarcel Holtmann 	__u8	iac_lap[6];
10133d505312SMarcel Holtmann } __packed;
10143d505312SMarcel Holtmann 
1015d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
1016d5859e22SJohan Hedberg 
101780a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
101880a1e1dbSJohan Hedberg 
101980a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
102080a1e1dbSJohan Hedberg struct hci_cp_write_eir {
1021816a11d5SJohan Hedberg 	__u8	fec;
1022816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
102380a1e1dbSJohan Hedberg } __packed;
102480a1e1dbSJohan Hedberg 
1025333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
1026333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
1027333140b5SMarcel Holtmann 	__u8     status;
1028333140b5SMarcel Holtmann 	__u8     mode;
102966c853ccSGustavo F. Padovan } __packed;
1030333140b5SMarcel Holtmann 
1031333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
1032333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
1033333140b5SMarcel Holtmann 	__u8     mode;
103466c853ccSGustavo F. Padovan } __packed;
1035333140b5SMarcel Holtmann 
1036c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
1037c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
1038c35938b2SSzymon Janc 	__u8     status;
1039c35938b2SSzymon Janc 	__u8     hash[16];
104038da1703SJohan Hedberg 	__u8     rand[16];
1041c35938b2SSzymon Janc } __packed;
1042c35938b2SSzymon Janc 
1043d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
104491c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
104591c4e9b1SMarcel Holtmann 	__u8     status;
104691c4e9b1SMarcel Holtmann 	__s8     tx_power;
104791c4e9b1SMarcel Holtmann } __packed;
1048d5859e22SJohan Hedberg 
1049d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
1050d62e6d67SJohan Hedberg 
10517528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
10527528ca1cSMarcel Holtmann 
10531e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
10541e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
10551e89cffbSAndrei Emeltchenko 	__u8     status;
10561e89cffbSAndrei Emeltchenko 	__u8     mode;
10571e89cffbSAndrei Emeltchenko } __packed;
10581e89cffbSAndrei Emeltchenko 
1059f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
1060f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
1061f9b49306SAndre Guedes 	__u8	le;
1062f9b49306SAndre Guedes 	__u8	simul;
1063f9b49306SAndre Guedes } __packed;
1064f9b49306SAndre Guedes 
1065d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
1066d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
1067d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1068d0bf75a5SDoHyun Pyun } __packed;
1069d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
1070d0bf75a5SDoHyun Pyun 	__u8	status;
1071d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1072d0bf75a5SDoHyun Pyun } __packed;
1073d0bf75a5SDoHyun Pyun 
10746a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
10756a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
10766a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10776a20eaf4SDoHyun Pyun } __packed;
10786a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
10796a20eaf4SDoHyun Pyun 	__u8	status;
10806a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10816a20eaf4SDoHyun Pyun } __packed;
10826a20eaf4SDoHyun Pyun 
10837d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
10847d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
10857d1dab49SDoHyun Pyun 	__u8	lt_addr;
10867d1dab49SDoHyun Pyun 	__u8	fragment;
10877d1dab49SDoHyun Pyun 	__u8	data_length;
10887d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
10897d1dab49SDoHyun Pyun } __packed;
10907d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
10917d1dab49SDoHyun Pyun 	__u8	status;
10927d1dab49SDoHyun Pyun 	__u8	lt_addr;
10937d1dab49SDoHyun Pyun } __packed;
10947d1dab49SDoHyun Pyun 
10955d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
10965d4e7e8dSJohan Hedberg 
1097a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
1098a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
1099a9b07a64SDoHyun Pyun 	__le16	interval_min;
1100a9b07a64SDoHyun Pyun 	__le16	interval_max;
1101a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
1102a9b07a64SDoHyun Pyun 	__u8	service_data;
1103a9b07a64SDoHyun Pyun } __packed;
1104a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
1105a9b07a64SDoHyun Pyun 	__u8	status;
1106a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
1107a9b07a64SDoHyun Pyun } __packed;
1108a9b07a64SDoHyun Pyun 
1109eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
1110eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
1111eb4b95c6SMarcel Holtmann 	__u8	status;
1112eb4b95c6SMarcel Holtmann 	__u8	support;
1113eb4b95c6SMarcel Holtmann } __packed;
1114eb4b95c6SMarcel Holtmann 
1115eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
1116eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
1117eb4b95c6SMarcel Holtmann 	__u8	support;
1118eb4b95c6SMarcel Holtmann } __packed;
1119eb4b95c6SMarcel Holtmann 
1120e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
1121e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
1122e2f99131SMarcel Holtmann 	__u8     status;
1123e2f99131SMarcel Holtmann 	__u8     hash192[16];
112438da1703SJohan Hedberg 	__u8     rand192[16];
1125e2f99131SMarcel Holtmann 	__u8     hash256[16];
112638da1703SJohan Hedberg 	__u8     rand256[16];
1127e2f99131SMarcel Holtmann } __packed;
1128e2f99131SMarcel Holtmann 
1129a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
1130a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
11311da177e4SLinus Torvalds 	__u8     status;
1132a9de9248SMarcel Holtmann 	__u8     hci_ver;
1133a9de9248SMarcel Holtmann 	__le16   hci_rev;
1134a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1135a9de9248SMarcel Holtmann 	__le16   manufacturer;
1136a9de9248SMarcel Holtmann 	__le16   lmp_subver;
113766c853ccSGustavo F. Padovan } __packed;
11381da177e4SLinus Torvalds 
1139a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
1140a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
11411da177e4SLinus Torvalds 	__u8     status;
1142a9de9248SMarcel Holtmann 	__u8     commands[64];
114366c853ccSGustavo F. Padovan } __packed;
11441da177e4SLinus Torvalds 
1145a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1146a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1147a9de9248SMarcel Holtmann 	__u8     status;
1148a9de9248SMarcel Holtmann 	__u8     features[8];
114966c853ccSGustavo F. Padovan } __packed;
1150a9de9248SMarcel Holtmann 
1151a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1152971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1153971e3a4bSAndre Guedes 	__u8     page;
1154971e3a4bSAndre Guedes } __packed;
1155a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1156a9de9248SMarcel Holtmann 	__u8     status;
1157a9de9248SMarcel Holtmann 	__u8     page;
1158a9de9248SMarcel Holtmann 	__u8     max_page;
1159a9de9248SMarcel Holtmann 	__u8     features[8];
116066c853ccSGustavo F. Padovan } __packed;
1161a9de9248SMarcel Holtmann 
1162a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1163a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1164a9de9248SMarcel Holtmann 	__u8     status;
1165a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1166a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1167a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1168a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
116966c853ccSGustavo F. Padovan } __packed;
1170a9de9248SMarcel Holtmann 
1171a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1172a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1173a9de9248SMarcel Holtmann 	__u8     status;
11741da177e4SLinus Torvalds 	bdaddr_t bdaddr;
117566c853ccSGustavo F. Padovan } __packed;
11761da177e4SLinus Torvalds 
1177350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1178350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1179350ee4cfSAndrei Emeltchenko 	__u8     status;
1180350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1181350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1182350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1183350ee4cfSAndrei Emeltchenko } __packed;
1184350ee4cfSAndrei Emeltchenko 
1185109e3191SMarcel Holtmann #define HCI_OP_READ_LOCAL_CODECS	0x100b
1186109e3191SMarcel Holtmann 
1187f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1188f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1189f332ec66SJohan Hedberg 	__u8     status;
1190f332ec66SJohan Hedberg 	__le16   interval;
1191f332ec66SJohan Hedberg 	__le16   window;
1192f332ec66SJohan Hedberg } __packed;
1193f332ec66SJohan Hedberg 
1194f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1195f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1196f6422ec6SAntti Julku 	__le16   interval;
1197f6422ec6SAntti Julku 	__le16   window;
1198f6422ec6SAntti Julku } __packed;
1199f6422ec6SAntti Julku 
12005a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
12015a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
12025a134faeSAndrzej Kaczmarek 	__le16   handle;
12035a134faeSAndrzej Kaczmarek 	__u8     type;
12045a134faeSAndrzej Kaczmarek } __packed;
12055a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
12065a134faeSAndrzej Kaczmarek 	__u8     status;
12075a134faeSAndrzej Kaczmarek 	__le16   handle;
12085a134faeSAndrzej Kaczmarek 	__s8     tx_power;
12095a134faeSAndrzej Kaczmarek } __packed;
12105a134faeSAndrzej Kaczmarek 
1211f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1212f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1213f332ec66SJohan Hedberg 	__u8     status;
1214f332ec66SJohan Hedberg 	__u8     type;
1215f332ec66SJohan Hedberg } __packed;
1216f332ec66SJohan Hedberg 
1217f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1218f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1219f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1220f6422ec6SAntti Julku 
12215ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
12225ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
12235ae76a94SAndrzej Kaczmarek 	__le16   handle;
12245ae76a94SAndrzej Kaczmarek } __packed;
12255ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
12265ae76a94SAndrzej Kaczmarek 	__u8     status;
12275ae76a94SAndrzej Kaczmarek 	__le16   handle;
12285ae76a94SAndrzej Kaczmarek 	__s8     rssi;
12295ae76a94SAndrzej Kaczmarek } __packed;
12305ae76a94SAndrzej Kaczmarek 
123133f35721SJohan Hedberg #define HCI_OP_READ_CLOCK		0x1407
123233f35721SJohan Hedberg struct hci_cp_read_clock {
123333f35721SJohan Hedberg 	__le16   handle;
123433f35721SJohan Hedberg 	__u8     which;
123533f35721SJohan Hedberg } __packed;
123633f35721SJohan Hedberg struct hci_rp_read_clock {
123733f35721SJohan Hedberg 	__u8     status;
123833f35721SJohan Hedberg 	__le16   handle;
123933f35721SJohan Hedberg 	__le32   clock;
124033f35721SJohan Hedberg 	__le16   accuracy;
124133f35721SJohan Hedberg } __packed;
124233f35721SJohan Hedberg 
1243821f3766SJohan Hedberg #define HCI_OP_READ_ENC_KEY_SIZE	0x1408
1244821f3766SJohan Hedberg struct hci_cp_read_enc_key_size {
1245821f3766SJohan Hedberg 	__le16   handle;
1246821f3766SJohan Hedberg } __packed;
1247821f3766SJohan Hedberg struct hci_rp_read_enc_key_size {
1248821f3766SJohan Hedberg 	__u8     status;
1249821f3766SJohan Hedberg 	__le16   handle;
1250821f3766SJohan Hedberg 	__u8     key_size;
1251821f3766SJohan Hedberg } __packed;
1252821f3766SJohan Hedberg 
1253928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1254928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1255928abaa7SAndrei Emeltchenko 	__u8     status;
1256928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1257928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1258928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1259928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1260928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1261928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1262928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1263928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1264928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1265928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1266928abaa7SAndrei Emeltchenko } __packed;
1267928abaa7SAndrei Emeltchenko 
1268523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1269523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1270523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1271523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1272523e93cdSAndrei Emeltchenko 	__le16   max_len;
1273523e93cdSAndrei Emeltchenko } __packed;
1274523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1275523e93cdSAndrei Emeltchenko 	__u8     status;
1276523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1277523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1278523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1279523e93cdSAndrei Emeltchenko } __packed;
1280523e93cdSAndrei Emeltchenko 
1281523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1282523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1283523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1284523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1285523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1286523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1287523e93cdSAndrei Emeltchenko } __packed;
1288523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1289523e93cdSAndrei Emeltchenko 	__u8     status;
1290523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1291523e93cdSAndrei Emeltchenko } __packed;
1292523e93cdSAndrei Emeltchenko 
1293f4fe73edSMarcel Holtmann #define HCI_OP_GET_MWS_TRANSPORT_CONFIG	0x140c
1294f4fe73edSMarcel Holtmann 
12954b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
12964b4148e9SMarcel Holtmann 
129706f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
129806f5b778SMarcel Holtmann 
129963185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
130063185f64SVille Tervo struct hci_cp_le_set_event_mask {
130163185f64SVille Tervo 	__u8     mask[8];
130263185f64SVille Tervo } __packed;
130363185f64SVille Tervo 
130463185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
130563185f64SVille Tervo struct hci_rp_le_read_buffer_size {
130663185f64SVille Tervo 	__u8     status;
130763185f64SVille Tervo 	__le16   le_mtu;
130863185f64SVille Tervo 	__u8     le_max_pkt;
130963185f64SVille Tervo } __packed;
131063185f64SVille Tervo 
131160e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
131260e77321SJohan Hedberg struct hci_rp_le_read_local_features {
131360e77321SJohan Hedberg 	__u8     status;
131460e77321SJohan Hedberg 	__u8     features[8];
131560e77321SJohan Hedberg } __packed;
131660e77321SJohan Hedberg 
1317d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1318d13eafceSMarcel Holtmann 
13191e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
13201e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
13211e191893SMarcel Holtmann 	__le16   min_interval;
13221e191893SMarcel Holtmann 	__le16   max_interval;
13231e191893SMarcel Holtmann 	__u8     type;
13241e191893SMarcel Holtmann 	__u8     own_address_type;
13251e191893SMarcel Holtmann 	__u8     direct_addr_type;
13261e191893SMarcel Holtmann 	bdaddr_t direct_addr;
13271e191893SMarcel Holtmann 	__u8     channel_map;
13281e191893SMarcel Holtmann 	__u8     filter_policy;
13291e191893SMarcel Holtmann } __packed;
13301e191893SMarcel Holtmann 
13318fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
13328fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
13338fa19098SJohan Hedberg 	__u8	status;
13348fa19098SJohan Hedberg 	__s8	tx_power;
13358fa19098SJohan Hedberg } __packed;
13368fa19098SJohan Hedberg 
13373f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
13383f0f524bSJohan Hedberg 
13393f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
13403f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
13413f0f524bSJohan Hedberg 	__u8	length;
13423f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
13433f0f524bSJohan Hedberg } __packed;
13443f0f524bSJohan Hedberg 
1345f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1346f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1347f14d8f64SMarcel Holtmann 	__u8	length;
1348f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1349f14d8f64SMarcel Holtmann } __packed;
1350f14d8f64SMarcel Holtmann 
1351c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1352c1d5dc4aSJohan Hedberg 
13535df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
13545df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
13555df480b5SAndre Guedes 
135607f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
135707f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
135807f7fa5dSAndre Guedes 	__u8    type;
135907f7fa5dSAndre Guedes 	__le16  interval;
136007f7fa5dSAndre Guedes 	__le16  window;
136107f7fa5dSAndre Guedes 	__u8    own_address_type;
136207f7fa5dSAndre Guedes 	__u8    filter_policy;
136307f7fa5dSAndre Guedes } __packed;
136407f7fa5dSAndre Guedes 
136576a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
136676a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1367525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1368525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
136968a8aea4SAndrei Emeltchenko 
1370eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1371eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1372eb9d91f5SAndre Guedes 	__u8     enable;
1373eb9d91f5SAndre Guedes 	__u8     filter_dup;
1374eb9d91f5SAndre Guedes } __packed;
1375eb9d91f5SAndre Guedes 
1376a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1377a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1378a7139eddSJohan Hedberg 
137963185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
138063185f64SVille Tervo struct hci_cp_le_create_conn {
138163185f64SVille Tervo 	__le16   scan_interval;
138263185f64SVille Tervo 	__le16   scan_window;
138363185f64SVille Tervo 	__u8     filter_policy;
138463185f64SVille Tervo 	__u8     peer_addr_type;
138563185f64SVille Tervo 	bdaddr_t peer_addr;
138663185f64SVille Tervo 	__u8     own_address_type;
138763185f64SVille Tervo 	__le16   conn_interval_min;
138863185f64SVille Tervo 	__le16   conn_interval_max;
138963185f64SVille Tervo 	__le16   conn_latency;
139063185f64SVille Tervo 	__le16   supervision_timeout;
139163185f64SVille Tervo 	__le16   min_ce_len;
139263185f64SVille Tervo 	__le16   max_ce_len;
139363185f64SVille Tervo } __packed;
139463185f64SVille Tervo 
139563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
139663185f64SVille Tervo 
1397cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1398cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1399cf1d081fSJohan Hedberg 	__u8	status;
1400cf1d081fSJohan Hedberg 	__u8	size;
1401cf1d081fSJohan Hedberg } __packed;
1402cf1d081fSJohan Hedberg 
1403d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1404d9a7b0a5SMarcel Holtmann 
1405d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1406d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1407d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1408d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1409d9a7b0a5SMarcel Holtmann } __packed;
1410d9a7b0a5SMarcel Holtmann 
1411d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1412d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1413d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1414d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1415d9a7b0a5SMarcel Holtmann } __packed;
1416d9a7b0a5SMarcel Holtmann 
14172ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
14182ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
14192ce603ebSClaudio Takahasi 	__le16   handle;
14202ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
14212ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
14222ce603ebSClaudio Takahasi 	__le16   conn_latency;
14232ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
14242ce603ebSClaudio Takahasi 	__le16   min_ce_len;
14252ce603ebSClaudio Takahasi 	__le16   max_ce_len;
14262ce603ebSClaudio Takahasi } __packed;
14272ce603ebSClaudio Takahasi 
14280fe29fd1SMarcel Holtmann #define HCI_OP_LE_READ_REMOTE_FEATURES	0x2016
14290fe29fd1SMarcel Holtmann struct hci_cp_le_read_remote_features {
14300fe29fd1SMarcel Holtmann 	__le16	 handle;
14310fe29fd1SMarcel Holtmann } __packed;
14320fe29fd1SMarcel Holtmann 
1433a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1434a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1435a7a595f6SVinicius Costa Gomes 	__le16	handle;
1436fe39c7b2SMarcel Holtmann 	__le64	rand;
1437a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1438a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1439a7a595f6SVinicius Costa Gomes } __packed;
1440a7a595f6SVinicius Costa Gomes 
1441a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1442a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1443a7a595f6SVinicius Costa Gomes 	__le16	handle;
1444a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1445a7a595f6SVinicius Costa Gomes } __packed;
1446a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1447a7a595f6SVinicius Costa Gomes 	__u8	status;
1448a7a595f6SVinicius Costa Gomes 	__le16	handle;
1449a7a595f6SVinicius Costa Gomes } __packed;
1450a7a595f6SVinicius Costa Gomes 
1451a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1452a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1453a7a595f6SVinicius Costa Gomes 	__le16	handle;
1454a7a595f6SVinicius Costa Gomes } __packed;
1455a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1456a7a595f6SVinicius Costa Gomes 	__u8	status;
1457a7a595f6SVinicius Costa Gomes 	__le16	handle;
1458a7a595f6SVinicius Costa Gomes } __packed;
1459a7a595f6SVinicius Costa Gomes 
14609b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
14619b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
14629b008c04SJohan Hedberg 	__u8	status;
14639b008c04SJohan Hedberg 	__u8	le_states[8];
14649b008c04SJohan Hedberg } __packed;
14659b008c04SJohan Hedberg 
14668e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_REPLY	0x2020
14678e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_reply {
14688e75b46aSAndre Guedes 	__le16	handle;
14698e75b46aSAndre Guedes 	__le16	interval_min;
14708e75b46aSAndre Guedes 	__le16	interval_max;
14718e75b46aSAndre Guedes 	__le16	latency;
14728e75b46aSAndre Guedes 	__le16	timeout;
14738e75b46aSAndre Guedes 	__le16	min_ce_len;
14748e75b46aSAndre Guedes 	__le16	max_ce_len;
14758e75b46aSAndre Guedes } __packed;
14768e75b46aSAndre Guedes 
14778e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY	0x2021
14788e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_neg_reply {
14798e75b46aSAndre Guedes 	__le16	handle;
14808e75b46aSAndre Guedes 	__u8	reason;
14818e75b46aSAndre Guedes } __packed;
14828e75b46aSAndre Guedes 
148394a3bd02SMarcel Holtmann #define HCI_OP_LE_SET_DATA_LEN		0x2022
148494a3bd02SMarcel Holtmann struct hci_cp_le_set_data_len {
148594a3bd02SMarcel Holtmann 	__le16	handle;
148694a3bd02SMarcel Holtmann 	__le16	tx_len;
148794a3bd02SMarcel Holtmann 	__le16	tx_time;
148894a3bd02SMarcel Holtmann } __packed;
148994a3bd02SMarcel Holtmann struct hci_rp_le_set_data_len {
149094a3bd02SMarcel Holtmann 	__u8	status;
149194a3bd02SMarcel Holtmann 	__le16	handle;
149294a3bd02SMarcel Holtmann } __packed;
149394a3bd02SMarcel Holtmann 
149494a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_DEF_DATA_LEN	0x2023
149594a3bd02SMarcel Holtmann struct hci_rp_le_read_def_data_len {
149694a3bd02SMarcel Holtmann 	__u8	status;
149794a3bd02SMarcel Holtmann 	__le16	tx_len;
149894a3bd02SMarcel Holtmann 	__le16	tx_time;
149994a3bd02SMarcel Holtmann } __packed;
150094a3bd02SMarcel Holtmann 
150194a3bd02SMarcel Holtmann #define HCI_OP_LE_WRITE_DEF_DATA_LEN	0x2024
150294a3bd02SMarcel Holtmann struct hci_cp_le_write_def_data_len {
150394a3bd02SMarcel Holtmann 	__le16	tx_len;
150494a3bd02SMarcel Holtmann 	__le16	tx_time;
150594a3bd02SMarcel Holtmann } __packed;
150694a3bd02SMarcel Holtmann 
1507545f2596SAnkit Navik #define HCI_OP_LE_CLEAR_RESOLV_LIST	0x2029
1508545f2596SAnkit Navik 
1509cfdb0c2dSAnkit Navik #define HCI_OP_LE_READ_RESOLV_LIST_SIZE	0x202a
1510cfdb0c2dSAnkit Navik struct hci_rp_le_read_resolv_list_size {
1511cfdb0c2dSAnkit Navik 	__u8	status;
1512cfdb0c2dSAnkit Navik 	__u8	size;
1513cfdb0c2dSAnkit Navik } __packed;
1514cfdb0c2dSAnkit Navik 
151594a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_MAX_DATA_LEN	0x202f
151694a3bd02SMarcel Holtmann struct hci_rp_le_read_max_data_len {
151794a3bd02SMarcel Holtmann 	__u8	status;
151894a3bd02SMarcel Holtmann 	__le16	tx_len;
151994a3bd02SMarcel Holtmann 	__le16	tx_time;
152094a3bd02SMarcel Holtmann 	__le16	rx_len;
152194a3bd02SMarcel Holtmann 	__le16	rx_time;
152294a3bd02SMarcel Holtmann } __packed;
152394a3bd02SMarcel Holtmann 
1524de2ba303SMarcel Holtmann #define HCI_OP_LE_SET_DEFAULT_PHY	0x2031
1525de2ba303SMarcel Holtmann struct hci_cp_le_set_default_phy {
1526de2ba303SMarcel Holtmann 	__u8    all_phys;
1527de2ba303SMarcel Holtmann 	__u8    tx_phys;
1528de2ba303SMarcel Holtmann 	__u8    rx_phys;
1529de2ba303SMarcel Holtmann } __packed;
1530de2ba303SMarcel Holtmann 
15316decb5b4SJaganath Kanakkassery #define HCI_LE_SET_PHY_1M		0x01
15326decb5b4SJaganath Kanakkassery #define HCI_LE_SET_PHY_2M		0x02
15336decb5b4SJaganath Kanakkassery #define HCI_LE_SET_PHY_CODED		0x04
15346decb5b4SJaganath Kanakkassery 
1535a2344b9eSJaganath Kanakkassery #define HCI_OP_LE_SET_EXT_SCAN_PARAMS   0x2041
1536a2344b9eSJaganath Kanakkassery struct hci_cp_le_set_ext_scan_params {
1537a2344b9eSJaganath Kanakkassery 	__u8    own_addr_type;
1538a2344b9eSJaganath Kanakkassery 	__u8    filter_policy;
1539a2344b9eSJaganath Kanakkassery 	__u8    scanning_phys;
1540a2344b9eSJaganath Kanakkassery 	__u8    data[0];
1541a2344b9eSJaganath Kanakkassery } __packed;
1542a2344b9eSJaganath Kanakkassery 
1543a2344b9eSJaganath Kanakkassery #define LE_SCAN_PHY_1M 0x01
1544a2344b9eSJaganath Kanakkassery 
1545a2344b9eSJaganath Kanakkassery struct hci_cp_le_scan_phy_params {
1546a2344b9eSJaganath Kanakkassery 	__u8    type;
1547a2344b9eSJaganath Kanakkassery 	__le16  interval;
1548a2344b9eSJaganath Kanakkassery 	__le16  window;
1549a2344b9eSJaganath Kanakkassery } __packed;
1550a2344b9eSJaganath Kanakkassery 
1551a2344b9eSJaganath Kanakkassery #define HCI_OP_LE_SET_EXT_SCAN_ENABLE   0x2042
1552a2344b9eSJaganath Kanakkassery struct hci_cp_le_set_ext_scan_enable {
1553a2344b9eSJaganath Kanakkassery 	__u8    enable;
1554a2344b9eSJaganath Kanakkassery 	__u8    filter_dup;
1555a2344b9eSJaganath Kanakkassery 	__le16  duration;
1556a2344b9eSJaganath Kanakkassery 	__le16  period;
1557a2344b9eSJaganath Kanakkassery } __packed;
1558a2344b9eSJaganath Kanakkassery 
15594d94f95dSJaganath Kanakkassery #define HCI_OP_LE_EXT_CREATE_CONN    0x2043
15604d94f95dSJaganath Kanakkassery struct hci_cp_le_ext_create_conn {
15614d94f95dSJaganath Kanakkassery 	__u8      filter_policy;
15624d94f95dSJaganath Kanakkassery 	__u8      own_addr_type;
15634d94f95dSJaganath Kanakkassery 	__u8      peer_addr_type;
15644d94f95dSJaganath Kanakkassery 	bdaddr_t  peer_addr;
15654d94f95dSJaganath Kanakkassery 	__u8      phys;
15664d94f95dSJaganath Kanakkassery 	__u8      data[0];
15674d94f95dSJaganath Kanakkassery } __packed;
15684d94f95dSJaganath Kanakkassery 
15694d94f95dSJaganath Kanakkassery struct hci_cp_le_ext_conn_param {
15704d94f95dSJaganath Kanakkassery 	__le16 scan_interval;
15714d94f95dSJaganath Kanakkassery 	__le16 scan_window;
15724d94f95dSJaganath Kanakkassery 	__le16 conn_interval_min;
15734d94f95dSJaganath Kanakkassery 	__le16 conn_interval_max;
15744d94f95dSJaganath Kanakkassery 	__le16 conn_latency;
15754d94f95dSJaganath Kanakkassery 	__le16 supervision_timeout;
15764d94f95dSJaganath Kanakkassery 	__le16 min_ce_len;
15774d94f95dSJaganath Kanakkassery 	__le16 max_ce_len;
15784d94f95dSJaganath Kanakkassery } __packed;
15794d94f95dSJaganath Kanakkassery 
15801da177e4SLinus Torvalds /* ---- HCI Events ---- */
15811da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
15821da177e4SLinus Torvalds 
15831da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
15841da177e4SLinus Torvalds struct inquiry_info {
15851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15861da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
15871da177e4SLinus Torvalds 	__u8     pscan_period_mode;
15881da177e4SLinus Torvalds 	__u8     pscan_mode;
15891da177e4SLinus Torvalds 	__u8     dev_class[3];
15901ebb9252SMarcel Holtmann 	__le16   clock_offset;
159166c853ccSGustavo F. Padovan } __packed;
15921da177e4SLinus Torvalds 
15931da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
15941da177e4SLinus Torvalds struct hci_ev_conn_complete {
15951da177e4SLinus Torvalds 	__u8     status;
15961ebb9252SMarcel Holtmann 	__le16   handle;
15971da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15981da177e4SLinus Torvalds 	__u8     link_type;
15991da177e4SLinus Torvalds 	__u8     encr_mode;
160066c853ccSGustavo F. Padovan } __packed;
16011da177e4SLinus Torvalds 
16021da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
16031da177e4SLinus Torvalds struct hci_ev_conn_request {
16041da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16051da177e4SLinus Torvalds 	__u8     dev_class[3];
16061da177e4SLinus Torvalds 	__u8     link_type;
160766c853ccSGustavo F. Padovan } __packed;
16081da177e4SLinus Torvalds 
16091da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
16101da177e4SLinus Torvalds struct hci_ev_disconn_complete {
16111da177e4SLinus Torvalds 	__u8     status;
16121ebb9252SMarcel Holtmann 	__le16   handle;
16131da177e4SLinus Torvalds 	__u8     reason;
161466c853ccSGustavo F. Padovan } __packed;
16151da177e4SLinus Torvalds 
16161da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
16171da177e4SLinus Torvalds struct hci_ev_auth_complete {
16181da177e4SLinus Torvalds 	__u8     status;
16191ebb9252SMarcel Holtmann 	__le16   handle;
162066c853ccSGustavo F. Padovan } __packed;
16211da177e4SLinus Torvalds 
1622a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1623a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1624a9de9248SMarcel Holtmann 	__u8     status;
1625a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
16261f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
162766c853ccSGustavo F. Padovan } __packed;
1628a9de9248SMarcel Holtmann 
16291da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
16301da177e4SLinus Torvalds struct hci_ev_encrypt_change {
16311da177e4SLinus Torvalds 	__u8     status;
16321ebb9252SMarcel Holtmann 	__le16   handle;
16331da177e4SLinus Torvalds 	__u8     encrypt;
163466c853ccSGustavo F. Padovan } __packed;
16351da177e4SLinus Torvalds 
1636a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1637a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
16381da177e4SLinus Torvalds 	__u8     status;
16391ebb9252SMarcel Holtmann 	__le16   handle;
164066c853ccSGustavo F. Padovan } __packed;
16411da177e4SLinus Torvalds 
1642a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1643a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1644a9de9248SMarcel Holtmann 	__u8     status;
1645a9de9248SMarcel Holtmann 	__le16   handle;
1646a9de9248SMarcel Holtmann 	__u8     features[8];
164766c853ccSGustavo F. Padovan } __packed;
1648a9de9248SMarcel Holtmann 
1649a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1650a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1651a9de9248SMarcel Holtmann 	__u8     status;
1652a9de9248SMarcel Holtmann 	__le16   handle;
1653a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1654a9de9248SMarcel Holtmann 	__le16   manufacturer;
1655a9de9248SMarcel Holtmann 	__le16   lmp_subver;
165666c853ccSGustavo F. Padovan } __packed;
1657a9de9248SMarcel Holtmann 
1658a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
16591da177e4SLinus Torvalds struct hci_qos {
16601da177e4SLinus Torvalds 	__u8     service_type;
16611da177e4SLinus Torvalds 	__u32    token_rate;
16621da177e4SLinus Torvalds 	__u32    peak_bandwidth;
16631da177e4SLinus Torvalds 	__u32    latency;
16641da177e4SLinus Torvalds 	__u32    delay_variation;
166566c853ccSGustavo F. Padovan } __packed;
16661da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
16671da177e4SLinus Torvalds 	__u8     status;
16681ebb9252SMarcel Holtmann 	__le16   handle;
16691da177e4SLinus Torvalds 	struct   hci_qos qos;
167066c853ccSGustavo F. Padovan } __packed;
16711da177e4SLinus Torvalds 
1672a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
16731da177e4SLinus Torvalds struct hci_ev_cmd_complete {
16741da177e4SLinus Torvalds 	__u8     ncmd;
16751ebb9252SMarcel Holtmann 	__le16   opcode;
167666c853ccSGustavo F. Padovan } __packed;
16771da177e4SLinus Torvalds 
1678a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
16791da177e4SLinus Torvalds struct hci_ev_cmd_status {
16801da177e4SLinus Torvalds 	__u8     status;
16811da177e4SLinus Torvalds 	__u8     ncmd;
16821ebb9252SMarcel Holtmann 	__le16   opcode;
168366c853ccSGustavo F. Padovan } __packed;
16841da177e4SLinus Torvalds 
168524dfa343SMarcel Holtmann #define HCI_EV_HARDWARE_ERROR		0x10
168624dfa343SMarcel Holtmann struct hci_ev_hardware_error {
168724dfa343SMarcel Holtmann 	__u8     code;
168824dfa343SMarcel Holtmann } __packed;
168924dfa343SMarcel Holtmann 
16901da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
16911da177e4SLinus Torvalds struct hci_ev_role_change {
16921da177e4SLinus Torvalds 	__u8     status;
16931da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16941da177e4SLinus Torvalds 	__u8     role;
169566c853ccSGustavo F. Padovan } __packed;
16961da177e4SLinus Torvalds 
1697a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1698613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1699613a1c0cSAndrei Emeltchenko 	__le16   handle;
1700613a1c0cSAndrei Emeltchenko 	__le16   count;
1701613a1c0cSAndrei Emeltchenko } __packed;
1702613a1c0cSAndrei Emeltchenko 
1703a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1704a9de9248SMarcel Holtmann 	__u8     num_hndl;
1705613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
170666c853ccSGustavo F. Padovan } __packed;
1707a9de9248SMarcel Holtmann 
17081da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
17091da177e4SLinus Torvalds struct hci_ev_mode_change {
17101da177e4SLinus Torvalds 	__u8     status;
17111ebb9252SMarcel Holtmann 	__le16   handle;
17121da177e4SLinus Torvalds 	__u8     mode;
17131ebb9252SMarcel Holtmann 	__le16   interval;
171466c853ccSGustavo F. Padovan } __packed;
17151da177e4SLinus Torvalds 
17161da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
17171da177e4SLinus Torvalds struct hci_ev_pin_code_req {
17181da177e4SLinus Torvalds 	bdaddr_t bdaddr;
171966c853ccSGustavo F. Padovan } __packed;
17201da177e4SLinus Torvalds 
17211da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
17221da177e4SLinus Torvalds struct hci_ev_link_key_req {
17231da177e4SLinus Torvalds 	bdaddr_t bdaddr;
172466c853ccSGustavo F. Padovan } __packed;
17251da177e4SLinus Torvalds 
17261da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
17271da177e4SLinus Torvalds struct hci_ev_link_key_notify {
17281da177e4SLinus Torvalds 	bdaddr_t bdaddr;
17299b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
17301da177e4SLinus Torvalds 	__u8     key_type;
173166c853ccSGustavo F. Padovan } __packed;
17321da177e4SLinus Torvalds 
1733a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
17341da177e4SLinus Torvalds struct hci_ev_clock_offset {
17351da177e4SLinus Torvalds 	__u8     status;
17361ebb9252SMarcel Holtmann 	__le16   handle;
17371ebb9252SMarcel Holtmann 	__le16   clock_offset;
173866c853ccSGustavo F. Padovan } __packed;
17391da177e4SLinus Torvalds 
1740a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1741a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1742a8746417SMarcel Holtmann 	__u8     status;
1743a8746417SMarcel Holtmann 	__le16   handle;
1744a8746417SMarcel Holtmann 	__le16   pkt_type;
174566c853ccSGustavo F. Padovan } __packed;
1746a8746417SMarcel Holtmann 
174785a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
174885a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
174985a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
175085a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
175166c853ccSGustavo F. Padovan } __packed;
175285a1e930SMarcel Holtmann 
1753a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1754a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1755a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1756a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1757a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1758a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1759a9de9248SMarcel Holtmann 	__le16   clock_offset;
1760a9de9248SMarcel Holtmann 	__s8     rssi;
176166c853ccSGustavo F. Padovan } __packed;
1762a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1763a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1764a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1765a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1766a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1767a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1768a9de9248SMarcel Holtmann 	__le16   clock_offset;
1769a9de9248SMarcel Holtmann 	__s8     rssi;
177066c853ccSGustavo F. Padovan } __packed;
1771a9de9248SMarcel Holtmann 
1772a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1773a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1774a9de9248SMarcel Holtmann 	__u8     status;
1775a9de9248SMarcel Holtmann 	__le16   handle;
1776a9de9248SMarcel Holtmann 	__u8     page;
1777a9de9248SMarcel Holtmann 	__u8     max_page;
1778a9de9248SMarcel Holtmann 	__u8     features[8];
177966c853ccSGustavo F. Padovan } __packed;
1780a9de9248SMarcel Holtmann 
1781a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1782a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1783a9de9248SMarcel Holtmann 	__u8     status;
1784a9de9248SMarcel Holtmann 	__le16   handle;
1785a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1786a9de9248SMarcel Holtmann 	__u8     link_type;
1787a9de9248SMarcel Holtmann 	__u8     tx_interval;
1788a9de9248SMarcel Holtmann 	__u8     retrans_window;
1789a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1790a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1791a9de9248SMarcel Holtmann 	__u8     air_mode;
179266c853ccSGustavo F. Padovan } __packed;
1793a9de9248SMarcel Holtmann 
1794a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1795a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1796a9de9248SMarcel Holtmann 	__u8     status;
1797a9de9248SMarcel Holtmann 	__le16   handle;
1798a9de9248SMarcel Holtmann 	__u8     tx_interval;
1799a9de9248SMarcel Holtmann 	__u8     retrans_window;
1800a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1801a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
180266c853ccSGustavo F. Padovan } __packed;
1803a9de9248SMarcel Holtmann 
1804a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
180504837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
180604837f64SMarcel Holtmann 	__u8     status;
180704837f64SMarcel Holtmann 	__le16   handle;
180804837f64SMarcel Holtmann 	__le16   max_tx_latency;
180904837f64SMarcel Holtmann 	__le16   max_rx_latency;
181004837f64SMarcel Holtmann 	__le16   max_remote_timeout;
181104837f64SMarcel Holtmann 	__le16   max_local_timeout;
181266c853ccSGustavo F. Padovan } __packed;
181304837f64SMarcel Holtmann 
1814a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1815a9de9248SMarcel Holtmann struct extended_inquiry_info {
1816a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1817a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1818a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1819a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1820a9de9248SMarcel Holtmann 	__le16   clock_offset;
1821a9de9248SMarcel Holtmann 	__s8     rssi;
1822a9de9248SMarcel Holtmann 	__u8     data[240];
182366c853ccSGustavo F. Padovan } __packed;
1824a9de9248SMarcel Holtmann 
18251c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
18261c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
18271c2e0041SJohan Hedberg 	__u8	status;
18281c2e0041SJohan Hedberg 	__le16	handle;
18291c2e0041SJohan Hedberg } __packed;
18301c2e0041SJohan Hedberg 
18310493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
18320493684eSMarcel Holtmann struct hci_ev_io_capa_request {
18330493684eSMarcel Holtmann 	bdaddr_t bdaddr;
183466c853ccSGustavo F. Padovan } __packed;
18350493684eSMarcel Holtmann 
183603b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
183703b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
183803b555e1SJohan Hedberg 	bdaddr_t bdaddr;
183903b555e1SJohan Hedberg 	__u8     capability;
184003b555e1SJohan Hedberg 	__u8     oob_data;
184103b555e1SJohan Hedberg 	__u8     authentication;
184203b555e1SJohan Hedberg } __packed;
184303b555e1SJohan Hedberg 
1844a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1845a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1846a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1847a5c29683SJohan Hedberg 	__le32		passkey;
1848a5c29683SJohan Hedberg } __packed;
1849a5c29683SJohan Hedberg 
18509ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
18519ad4019aSBrian Gix struct hci_ev_user_passkey_req {
18529ad4019aSBrian Gix 	bdaddr_t	bdaddr;
18539ad4019aSBrian Gix } __packed;
18549ad4019aSBrian Gix 
18552763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
18562763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
18572763eda6SSzymon Janc 	bdaddr_t bdaddr;
18582763eda6SSzymon Janc } __packed;
18592763eda6SSzymon Janc 
18600493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
18610493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
18620493684eSMarcel Holtmann 	__u8     status;
18630493684eSMarcel Holtmann 	bdaddr_t bdaddr;
186466c853ccSGustavo F. Padovan } __packed;
18650493684eSMarcel Holtmann 
186692a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
186792a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
186892a25256SJohan Hedberg 	bdaddr_t	bdaddr;
186992a25256SJohan Hedberg 	__le32		passkey;
187092a25256SJohan Hedberg } __packed;
187192a25256SJohan Hedberg 
187292a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
187392a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
187492a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
187592a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
187692a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
187792a25256SJohan Hedberg 
187892a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
187992a25256SJohan Hedberg struct hci_ev_keypress_notify {
188092a25256SJohan Hedberg 	bdaddr_t	bdaddr;
188192a25256SJohan Hedberg 	__u8		type;
188292a25256SJohan Hedberg } __packed;
188392a25256SJohan Hedberg 
188441a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
188541a96212SMarcel Holtmann struct hci_ev_remote_host_features {
188641a96212SMarcel Holtmann 	bdaddr_t bdaddr;
188741a96212SMarcel Holtmann 	__u8     features[8];
188866c853ccSGustavo F. Padovan } __packed;
188941a96212SMarcel Holtmann 
189063185f64SVille Tervo #define HCI_EV_LE_META			0x3e
189163185f64SVille Tervo struct hci_ev_le_meta {
189263185f64SVille Tervo 	__u8     subevent;
189363185f64SVille Tervo } __packed;
189463185f64SVille Tervo 
1895523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1896523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1897523e93cdSAndrei Emeltchenko 	__u8     status;
1898523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1899523e93cdSAndrei Emeltchenko } __packed;
1900523e93cdSAndrei Emeltchenko 
1901523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1902523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1903523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1904523e93cdSAndrei Emeltchenko } __packed;
1905523e93cdSAndrei Emeltchenko 
1906523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1907523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1908523e93cdSAndrei Emeltchenko 	__u8     status;
1909523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1910523e93cdSAndrei Emeltchenko 	__u8     reason;
1911523e93cdSAndrei Emeltchenko } __packed;
1912523e93cdSAndrei Emeltchenko 
1913523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1914523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1915523e93cdSAndrei Emeltchenko 	__u8     status;
1916523e93cdSAndrei Emeltchenko 	__le16   handle;
1917523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1918523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1919523e93cdSAndrei Emeltchenko } __packed;
1920523e93cdSAndrei Emeltchenko 
1921523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1922523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1923523e93cdSAndrei Emeltchenko 	__u8     status;
1924523e93cdSAndrei Emeltchenko 	__le16   handle;
1925523e93cdSAndrei Emeltchenko 	__u8     reason;
1926523e93cdSAndrei Emeltchenko } __packed;
1927523e93cdSAndrei Emeltchenko 
192825e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
192925e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
193025e89e99SAndrei Emeltchenko 	__le16   handle;
193125e89e99SAndrei Emeltchenko 	__le16   pkts;
193225e89e99SAndrei Emeltchenko 	__le16   blocks;
193325e89e99SAndrei Emeltchenko } __packed;
193425e89e99SAndrei Emeltchenko 
193525e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
193625e89e99SAndrei Emeltchenko 	__le16   num_blocks;
193725e89e99SAndrei Emeltchenko 	__u8     num_hndl;
193825e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
193925e89e99SAndrei Emeltchenko } __packed;
194025e89e99SAndrei Emeltchenko 
19412b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
19422b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
19432b359445SDoHyun Pyun 	__u8	status;
19442b359445SDoHyun Pyun } __packed;
19452b359445SDoHyun Pyun 
19462ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
19472ed01805SDoHyun Pyun 
194863185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
194963185f64SVille Tervo struct hci_ev_le_conn_complete {
195063185f64SVille Tervo 	__u8     status;
195163185f64SVille Tervo 	__le16   handle;
195263185f64SVille Tervo 	__u8     role;
195363185f64SVille Tervo 	__u8     bdaddr_type;
195463185f64SVille Tervo 	bdaddr_t bdaddr;
195563185f64SVille Tervo 	__le16   interval;
195663185f64SVille Tervo 	__le16   latency;
195763185f64SVille Tervo 	__le16   supervision_timeout;
195863185f64SVille Tervo 	__u8     clk_accurancy;
195963185f64SVille Tervo } __packed;
196063185f64SVille Tervo 
19612331fd46SMarcel Holtmann /* Advertising report event types */
19622331fd46SMarcel Holtmann #define LE_ADV_IND		0x00
19632331fd46SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
19642331fd46SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
19652331fd46SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
19662331fd46SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
1967c215e939SJaganath Kanakkassery #define LE_ADV_INVALID		0x05
1968c215e939SJaganath Kanakkassery 
1969c215e939SJaganath Kanakkassery /* Legacy event types in extended adv report */
1970c215e939SJaganath Kanakkassery #define LE_LEGACY_ADV_IND		0x0013
1971c215e939SJaganath Kanakkassery #define LE_LEGACY_ADV_DIRECT_IND 	0x0015
1972c215e939SJaganath Kanakkassery #define LE_LEGACY_ADV_SCAN_IND		0x0012
1973c215e939SJaganath Kanakkassery #define LE_LEGACY_NONCONN_IND		0x0010
1974c215e939SJaganath Kanakkassery #define LE_LEGACY_SCAN_RSP_ADV		0x001b
1975c215e939SJaganath Kanakkassery #define LE_LEGACY_SCAN_RSP_ADV_SCAN	0x001a
19762331fd46SMarcel Holtmann 
19772331fd46SMarcel Holtmann #define ADDR_LE_DEV_PUBLIC	0x00
19782331fd46SMarcel Holtmann #define ADDR_LE_DEV_RANDOM	0x01
19792331fd46SMarcel Holtmann 
19802331fd46SMarcel Holtmann #define HCI_EV_LE_ADVERTISING_REPORT	0x02
19812331fd46SMarcel Holtmann struct hci_ev_le_advertising_info {
19822331fd46SMarcel Holtmann 	__u8	 evt_type;
19832331fd46SMarcel Holtmann 	__u8	 bdaddr_type;
19842331fd46SMarcel Holtmann 	bdaddr_t bdaddr;
19852331fd46SMarcel Holtmann 	__u8	 length;
19862331fd46SMarcel Holtmann 	__u8	 data[0];
19872331fd46SMarcel Holtmann } __packed;
19882331fd46SMarcel Holtmann 
19891855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
19901855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
19911855d92dSMarcel Holtmann 	__u8     status;
19921855d92dSMarcel Holtmann 	__le16   handle;
19931855d92dSMarcel Holtmann 	__le16   interval;
19941855d92dSMarcel Holtmann 	__le16   latency;
19951855d92dSMarcel Holtmann 	__le16   supervision_timeout;
19961855d92dSMarcel Holtmann } __packed;
19971855d92dSMarcel Holtmann 
19980fe29fd1SMarcel Holtmann #define HCI_EV_LE_REMOTE_FEAT_COMPLETE	0x04
19990fe29fd1SMarcel Holtmann struct hci_ev_le_remote_feat_complete {
20000fe29fd1SMarcel Holtmann 	__u8     status;
20010fe29fd1SMarcel Holtmann 	__le16   handle;
20020fe29fd1SMarcel Holtmann 	__u8     features[8];
20030fe29fd1SMarcel Holtmann } __packed;
20040fe29fd1SMarcel Holtmann 
2005a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
2006a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
2007a7a595f6SVinicius Costa Gomes 	__le16	handle;
2008fe39c7b2SMarcel Holtmann 	__le64	rand;
2009a7a595f6SVinicius Costa Gomes 	__le16	ediv;
2010a7a595f6SVinicius Costa Gomes } __packed;
2011a7a595f6SVinicius Costa Gomes 
20128e75b46aSAndre Guedes #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ	0x06
20138e75b46aSAndre Guedes struct hci_ev_le_remote_conn_param_req {
20148e75b46aSAndre Guedes 	__le16 handle;
20158e75b46aSAndre Guedes 	__le16 interval_min;
20168e75b46aSAndre Guedes 	__le16 interval_max;
20178e75b46aSAndre Guedes 	__le16 latency;
20188e75b46aSAndre Guedes 	__le16 timeout;
20198e75b46aSAndre Guedes } __packed;
20208e75b46aSAndre Guedes 
202194a3bd02SMarcel Holtmann #define HCI_EV_LE_DATA_LEN_CHANGE	0x07
202294a3bd02SMarcel Holtmann struct hci_ev_le_data_len_change {
202394a3bd02SMarcel Holtmann 	__le16	handle;
202494a3bd02SMarcel Holtmann 	__le16	tx_len;
202594a3bd02SMarcel Holtmann 	__le16	tx_time;
202694a3bd02SMarcel Holtmann 	__le16	rx_len;
202794a3bd02SMarcel Holtmann 	__le16	rx_time;
202894a3bd02SMarcel Holtmann } __packed;
202994a3bd02SMarcel Holtmann 
203032c9d43fSMarcel Holtmann #define HCI_EV_LE_DIRECT_ADV_REPORT	0x0B
203132c9d43fSMarcel Holtmann struct hci_ev_le_direct_adv_info {
203232c9d43fSMarcel Holtmann 	__u8	 evt_type;
203332c9d43fSMarcel Holtmann 	__u8	 bdaddr_type;
203432c9d43fSMarcel Holtmann 	bdaddr_t bdaddr;
203532c9d43fSMarcel Holtmann 	__u8	 direct_addr_type;
203632c9d43fSMarcel Holtmann 	bdaddr_t direct_addr;
203732c9d43fSMarcel Holtmann 	__s8	 rssi;
203832c9d43fSMarcel Holtmann } __packed;
203932c9d43fSMarcel Holtmann 
2040c215e939SJaganath Kanakkassery #define HCI_EV_LE_EXT_ADV_REPORT    0x0d
2041c215e939SJaganath Kanakkassery struct hci_ev_le_ext_adv_report {
2042c215e939SJaganath Kanakkassery 	__le16 	 evt_type;
2043c215e939SJaganath Kanakkassery 	__u8	 bdaddr_type;
2044c215e939SJaganath Kanakkassery 	bdaddr_t bdaddr;
2045c215e939SJaganath Kanakkassery 	__u8	 primary_phy;
2046c215e939SJaganath Kanakkassery 	__u8	 secondary_phy;
2047c215e939SJaganath Kanakkassery 	__u8	 sid;
2048c215e939SJaganath Kanakkassery 	__u8	 tx_power;
2049c215e939SJaganath Kanakkassery 	__s8	 rssi;
2050c215e939SJaganath Kanakkassery 	__le16 	 interval;
2051c215e939SJaganath Kanakkassery 	__u8  	 direct_addr_type;
2052c215e939SJaganath Kanakkassery 	bdaddr_t direct_addr;
2053c215e939SJaganath Kanakkassery 	__u8  	 length;
2054c215e939SJaganath Kanakkassery 	__u8	 data[0];
2055c215e939SJaganath Kanakkassery } __packed;
2056c215e939SJaganath Kanakkassery 
20574d94f95dSJaganath Kanakkassery #define HCI_EV_LE_ENHANCED_CONN_COMPLETE    0x0a
20584d94f95dSJaganath Kanakkassery struct hci_ev_le_enh_conn_complete {
20594d94f95dSJaganath Kanakkassery 	__u8      status;
20604d94f95dSJaganath Kanakkassery 	__le16    handle;
20614d94f95dSJaganath Kanakkassery 	__u8      role;
20624d94f95dSJaganath Kanakkassery 	__u8      bdaddr_type;
20634d94f95dSJaganath Kanakkassery 	bdaddr_t  bdaddr;
20644d94f95dSJaganath Kanakkassery 	bdaddr_t  local_rpa;
20654d94f95dSJaganath Kanakkassery 	bdaddr_t  peer_rpa;
20664d94f95dSJaganath Kanakkassery 	__le16    interval;
20674d94f95dSJaganath Kanakkassery 	__le16    latency;
20684d94f95dSJaganath Kanakkassery 	__le16    supervision_timeout;
20694d94f95dSJaganath Kanakkassery 	__u8      clk_accurancy;
20704d94f95dSJaganath Kanakkassery } __packed;
20714d94f95dSJaganath Kanakkassery 
20721da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
2073a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
20741da177e4SLinus Torvalds struct hci_ev_stack_internal {
20751da177e4SLinus Torvalds 	__u16    type;
20761da177e4SLinus Torvalds 	__u8     data[0];
207766c853ccSGustavo F. Padovan } __packed;
20781da177e4SLinus Torvalds 
20791da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
20801da177e4SLinus Torvalds struct hci_ev_si_device {
20811da177e4SLinus Torvalds 	__u16    event;
20821da177e4SLinus Torvalds 	__u16    dev_id;
208366c853ccSGustavo F. Padovan } __packed;
20841da177e4SLinus Torvalds 
20851da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
20861da177e4SLinus Torvalds struct hci_ev_si_security {
20871da177e4SLinus Torvalds 	__u16    event;
20881da177e4SLinus Torvalds 	__u16    proto;
20891da177e4SLinus Torvalds 	__u16    subproto;
20901da177e4SLinus Torvalds 	__u8     incoming;
209166c853ccSGustavo F. Padovan } __packed;
20921da177e4SLinus Torvalds 
20931da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
20941da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
20951da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
20961da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
20971da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
20981da177e4SLinus Torvalds 
20991da177e4SLinus Torvalds struct hci_command_hdr {
21001ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
21011da177e4SLinus Torvalds 	__u8	plen;
210266c853ccSGustavo F. Padovan } __packed;
21031da177e4SLinus Torvalds 
21041da177e4SLinus Torvalds struct hci_event_hdr {
21051da177e4SLinus Torvalds 	__u8	evt;
21061da177e4SLinus Torvalds 	__u8	plen;
210766c853ccSGustavo F. Padovan } __packed;
21081da177e4SLinus Torvalds 
21091da177e4SLinus Torvalds struct hci_acl_hdr {
21101ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
21111ebb9252SMarcel Holtmann 	__le16	dlen;
211266c853ccSGustavo F. Padovan } __packed;
21131da177e4SLinus Torvalds 
21141da177e4SLinus Torvalds struct hci_sco_hdr {
21151ebb9252SMarcel Holtmann 	__le16	handle;
21161da177e4SLinus Torvalds 	__u8	dlen;
211766c853ccSGustavo F. Padovan } __packed;
21181da177e4SLinus Torvalds 
21192a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
21202a123b86SArnaldo Carvalho de Melo {
21212a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
21222a123b86SArnaldo Carvalho de Melo }
21232a123b86SArnaldo Carvalho de Melo 
21242a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
21252a123b86SArnaldo Carvalho de Melo {
21262a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
21272a123b86SArnaldo Carvalho de Melo }
21282a123b86SArnaldo Carvalho de Melo 
21292a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
21302a123b86SArnaldo Carvalho de Melo {
21312a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
21322a123b86SArnaldo Carvalho de Melo }
21332a123b86SArnaldo Carvalho de Melo 
21341da177e4SLinus Torvalds /* Command opcode pack/unpack */
2135c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
21361da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
21371da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
21381da177e4SLinus Torvalds 
21391da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
2140c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
21411da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
21421da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
21431da177e4SLinus Torvalds 
21441da177e4SLinus Torvalds #endif /* __HCI_H */
2145