xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 711ffa78f4b23e25a6c91cb80be436a48b5e725d)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds    BlueZ - Bluetooth protocol stack for Linux
31da177e4SLinus Torvalds    Copyright (C) 2000-2001 Qualcomm Incorporated
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
61da177e4SLinus Torvalds 
71da177e4SLinus Torvalds    This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds    it under the terms of the GNU General Public License version 2 as
91da177e4SLinus Torvalds    published by the Free Software Foundation;
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
121da177e4SLinus Torvalds    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131da177e4SLinus Torvalds    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
141da177e4SLinus Torvalds    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
151da177e4SLinus Torvalds    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
161da177e4SLinus Torvalds    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171da177e4SLinus Torvalds    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
181da177e4SLinus Torvalds    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
211da177e4SLinus Torvalds    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
221da177e4SLinus Torvalds    SOFTWARE IS DISCLAIMED.
231da177e4SLinus Torvalds */
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds #ifndef __HCI_H
261da177e4SLinus Torvalds #define __HCI_H
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE	1024
291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE	255
301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE	260
311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE	(HCI_MAX_ACL_SIZE + 4)
321da177e4SLinus Torvalds 
339b3b4460SAndrei Emeltchenko #define HCI_LINK_KEY_SIZE	16
34523e93cdSAndrei Emeltchenko #define HCI_AMP_LINK_KEY_SIZE	(2 * HCI_LINK_KEY_SIZE)
359b3b4460SAndrei Emeltchenko 
36903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE	672
37903e4541SAndrei Emeltchenko 
387d1dab49SDoHyun Pyun #define HCI_MAX_CSB_DATA_SIZE	252
397d1dab49SDoHyun Pyun 
401da177e4SLinus Torvalds /* HCI dev events */
411da177e4SLinus Torvalds #define HCI_DEV_REG			1
421da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
431da177e4SLinus Torvalds #define HCI_DEV_UP			3
441da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
451da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
461da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds /* HCI notify events */
491da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
501da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
511da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
521da177e4SLinus Torvalds 
53c13854ceSMarcel Holtmann /* HCI bus types */
540ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
551da177e4SLinus Torvalds #define HCI_USB		1
561da177e4SLinus Torvalds #define HCI_PCCARD	2
571da177e4SLinus Torvalds #define HCI_UART	3
581da177e4SLinus Torvalds #define HCI_RS232	4
591da177e4SLinus Torvalds #define HCI_PCI		5
600ac53939SMarcel Holtmann #define HCI_SDIO	6
611da177e4SLinus Torvalds 
62943da25dSMarcel Holtmann /* HCI controller types */
63943da25dSMarcel Holtmann #define HCI_BREDR	0x00
648f1e1742SDavid Vrabel #define HCI_AMP		0x01
65943da25dSMarcel Holtmann 
668598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
676ed971caSMarcel Holtmann #define AMP_ID_BREDR	0x00
688598d064SAndrei Emeltchenko 
697c13823dSMarcel Holtmann /* AMP controller types */
707c13823dSMarcel Holtmann #define AMP_TYPE_BREDR	0x00
717c13823dSMarcel Holtmann #define AMP_TYPE_80211	0x01
727c13823dSMarcel Holtmann 
73ab846ec4SAndrei Emeltchenko /* AMP controller status */
74536619e8SMarcel Holtmann #define AMP_STATUS_POWERED_DOWN			0x00
75536619e8SMarcel Holtmann #define AMP_STATUS_BLUETOOTH_ONLY		0x01
76536619e8SMarcel Holtmann #define AMP_STATUS_NO_CAPACITY			0x02
77536619e8SMarcel Holtmann #define AMP_STATUS_LOW_CAPACITY			0x03
78536619e8SMarcel Holtmann #define AMP_STATUS_MEDIUM_CAPACITY		0x04
79536619e8SMarcel Holtmann #define AMP_STATUS_HIGH_CAPACITY		0x05
80536619e8SMarcel Holtmann #define AMP_STATUS_FULL_CAPACITY		0x06
81ab846ec4SAndrei Emeltchenko 
821da177e4SLinus Torvalds /* HCI device quirks */
831da177e4SLinus Torvalds enum {
84118305b5SMarcel Holtmann 	/* When this quirk is set, the HCI Reset command is send when
85118305b5SMarcel Holtmann 	 * closing the transport instead of when opening it.
86118305b5SMarcel Holtmann 	 *
87118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
88118305b5SMarcel Holtmann 	 */
89a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
90118305b5SMarcel Holtmann 
91118305b5SMarcel Holtmann 	/* When this quirk is set, the device is turned into a raw-only
92118305b5SMarcel Holtmann 	 * device and it will stay in unconfigured state.
93118305b5SMarcel Holtmann 	 *
94118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
95118305b5SMarcel Holtmann 	 */
96da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
97118305b5SMarcel Holtmann 
98118305b5SMarcel Holtmann 	/* When this quirk is set, the buffer sizes reported by
99118305b5SMarcel Holtmann 	 * HCI Read Buffer Size command are corrected if invalid.
100118305b5SMarcel Holtmann 	 *
101118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
102118305b5SMarcel Holtmann 	 */
103f9f462faSMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE,
104118305b5SMarcel Holtmann 
105*711ffa78SMarcel Holtmann 	/* When this quirk is set, then the HCI Read Local Supported
106*711ffa78SMarcel Holtmann 	 * Commands command is not supported. In general Bluetooth 1.2
107*711ffa78SMarcel Holtmann 	 * and later controllers should support this command. However
108*711ffa78SMarcel Holtmann 	 * some controllers indicate Bluetooth 1.2 support, but do
109*711ffa78SMarcel Holtmann 	 * not support this command.
110*711ffa78SMarcel Holtmann 	 *
111*711ffa78SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
112*711ffa78SMarcel Holtmann 	 */
113*711ffa78SMarcel Holtmann 	HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
114*711ffa78SMarcel Holtmann 
115118305b5SMarcel Holtmann 	/* When this quirk is set, then no stored link key handling
116118305b5SMarcel Holtmann 	 * is performed. This is mainly due to the fact that the
117118305b5SMarcel Holtmann 	 * HCI Delete Stored Link Key command is advertised, but
118118305b5SMarcel Holtmann 	 * not supported.
119118305b5SMarcel Holtmann 	 *
120118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
121118305b5SMarcel Holtmann 	 */
122f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
12389bc22d2SMarcel Holtmann 
124eb1904f4SMarcel Holtmann 	/* When this quirk is set, an external configuration step
125eb1904f4SMarcel Holtmann 	 * is required and will be indicated with the controller
126eb1904f4SMarcel Holtmann 	 * configuation.
127eb1904f4SMarcel Holtmann 	 *
128eb1904f4SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
129eb1904f4SMarcel Holtmann 	 * during the hdev->setup vendor callback.
130eb1904f4SMarcel Holtmann 	 */
131eb1904f4SMarcel Holtmann 	HCI_QUIRK_EXTERNAL_CONFIG,
132eb1904f4SMarcel Holtmann 
13389bc22d2SMarcel Holtmann 	/* When this quirk is set, the public Bluetooth address
13489bc22d2SMarcel Holtmann 	 * initially reported by HCI Read BD Address command
13589bc22d2SMarcel Holtmann 	 * is considered invalid. Controller configuration is
13689bc22d2SMarcel Holtmann 	 * required before this device can be used.
13789bc22d2SMarcel Holtmann 	 *
13889bc22d2SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
13989bc22d2SMarcel Holtmann 	 * during the hdev->setup vendor callback.
14089bc22d2SMarcel Holtmann 	 */
14189bc22d2SMarcel Holtmann 	HCI_QUIRK_INVALID_BDADDR,
14243d6bc46SMarcel Holtmann 
14343d6bc46SMarcel Holtmann 	/* When this quirk is set, the duplicate filtering during
14443d6bc46SMarcel Holtmann 	 * scanning is based on Bluetooth devices addresses. To allow
14543d6bc46SMarcel Holtmann 	 * RSSI based updates, restart scanning if needed.
14643d6bc46SMarcel Holtmann 	 *
14743d6bc46SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
14843d6bc46SMarcel Holtmann 	 * during the hdev->setup vendor callback.
14943d6bc46SMarcel Holtmann 	 */
15043d6bc46SMarcel Holtmann 	HCI_QUIRK_STRICT_DUPLICATE_FILTER,
1511da177e4SLinus Torvalds };
1521da177e4SLinus Torvalds 
1531da177e4SLinus Torvalds /* HCI device flags */
1541da177e4SLinus Torvalds enum {
1551da177e4SLinus Torvalds 	HCI_UP,
1561da177e4SLinus Torvalds 	HCI_INIT,
1571da177e4SLinus Torvalds 	HCI_RUNNING,
1581da177e4SLinus Torvalds 
1591da177e4SLinus Torvalds 	HCI_PSCAN,
1601da177e4SLinus Torvalds 	HCI_ISCAN,
1611da177e4SLinus Torvalds 	HCI_AUTH,
1621da177e4SLinus Torvalds 	HCI_ENCRYPT,
1631da177e4SLinus Torvalds 	HCI_INQUIRY,
1641da177e4SLinus Torvalds 
1651da177e4SLinus Torvalds 	HCI_RAW,
166ab81cbf9SJohan Hedberg 
16710572132SGustavo F. Padovan 	HCI_RESET,
1681da177e4SLinus Torvalds };
1691da177e4SLinus Torvalds 
170111902f7SMarcel Holtmann /* BR/EDR and/or LE controller flags: the flags defined here should represent
171111902f7SMarcel Holtmann  * states configured via debugfs for debugging and testing purposes only.
172111902f7SMarcel Holtmann  */
173111902f7SMarcel Holtmann enum {
174111902f7SMarcel Holtmann 	HCI_DUT_MODE,
175111902f7SMarcel Holtmann 	HCI_FORCE_SC,
176858cdc78SJohan Hedberg 	HCI_FORCE_LESC,
177111902f7SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
178111902f7SMarcel Holtmann };
179111902f7SMarcel Holtmann 
180d23264a8SAndre Guedes /*
181d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
182d23264a8SAndre Guedes  * states from the controller.
183d23264a8SAndre Guedes  */
184d23264a8SAndre Guedes enum {
185a8b2d5c2SJohan Hedberg 	HCI_SETUP,
186d603b76bSMarcel Holtmann 	HCI_CONFIG,
187a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1885e130367SJohan Hedberg 	HCI_RFKILLED,
189a8b2d5c2SJohan Hedberg 	HCI_MGMT,
190b6ae8457SJohan Hedberg 	HCI_BONDABLE,
191a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
1920663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
1933769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
19494324962SJohan Hovold 	HCI_UNREGISTER,
1954a964404SMarcel Holtmann 	HCI_UNCONFIGURED,
1960736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
197dbece37aSMarcel Holtmann 	HCI_EXT_CONFIGURED,
19866c417c1SJohan Hedberg 	HCI_LE_ADV,
199d23264a8SAndre Guedes 	HCI_LE_SCAN,
20084bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
201e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
202134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
203863efaf2SJohan Hedberg 	HCI_PRIVACY,
204d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
20541edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
2066d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
20706199cf8SJohan Hedberg 	HCI_LE_ENABLED,
208f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
2095e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
2105e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
2116acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
21247990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
21321693c15SAndre Guedes 	HCI_PERIODIC_INQ,
2141a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
21556f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
21681ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
217d23264a8SAndre Guedes };
218d23264a8SAndre Guedes 
2192cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
2202cc6fb00SJohan Hedberg  * or the HCI device is closed.
2212cc6fb00SJohan Hedberg  */
2221a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
22366c417c1SJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
2242cc6fb00SJohan Hedberg 
2251da177e4SLinus Torvalds /* HCI timeouts */
2265f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2275f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
2285f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
229d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
2305f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
2319345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
232a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
2339489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
23409ae260bSJohan Hedberg #define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2351da177e4SLinus Torvalds 
2365b7f9909SMarcel Holtmann /* HCI data types */
2371da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
2381da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
2391da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
2401da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
2411da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2421da177e4SLinus Torvalds 
2435b7f9909SMarcel Holtmann /* HCI packet types */
2441da177e4SLinus Torvalds #define HCI_DM1		0x0008
2451da177e4SLinus Torvalds #define HCI_DM3		0x0400
2461da177e4SLinus Torvalds #define HCI_DM5		0x4000
2471da177e4SLinus Torvalds #define HCI_DH1		0x0010
2481da177e4SLinus Torvalds #define HCI_DH3		0x0800
2491da177e4SLinus Torvalds #define HCI_DH5		0x8000
2501da177e4SLinus Torvalds 
2511da177e4SLinus Torvalds #define HCI_HV1		0x0020
2521da177e4SLinus Torvalds #define HCI_HV2		0x0040
2531da177e4SLinus Torvalds #define HCI_HV3		0x0080
2541da177e4SLinus Torvalds 
2551da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2561da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2571da177e4SLinus Torvalds 
2585b7f9909SMarcel Holtmann /* eSCO packet types */
2595b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2605b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2615b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2625b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2635b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2645b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
265efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
266efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
267efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
268efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2695b7f9909SMarcel Holtmann 
270a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
271efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
272a8746417SMarcel Holtmann 
2731da177e4SLinus Torvalds /* ACL flags */
274e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2751da177e4SLinus Torvalds #define ACL_CONT		0x01
2761da177e4SLinus Torvalds #define ACL_START		0x02
277d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2781da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2791da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2801da177e4SLinus Torvalds 
2811da177e4SLinus Torvalds /* Baseband links */
2821da177e4SLinus Torvalds #define SCO_LINK	0x00
2831da177e4SLinus Torvalds #define ACL_LINK	0x01
2845b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
285fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
286fcd89c09SVille Tervo #define LE_LINK		0x80
2873161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
288845472e8SMarcel Holtmann #define INVALID_LINK	0xff
2891da177e4SLinus Torvalds 
2901da177e4SLinus Torvalds /* LMP features */
2911da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2921da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2931da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2941da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2951da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2961da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2971da177e4SLinus Torvalds #define LMP_HOLD	0x40
29804837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2991da177e4SLinus Torvalds 
3001da177e4SLinus Torvalds #define LMP_PARK	0x01
3011da177e4SLinus Torvalds #define LMP_RSSI	0x02
3021da177e4SLinus Torvalds #define LMP_QUALITY	0x04
3031da177e4SLinus Torvalds #define LMP_SCO		0x08
3041da177e4SLinus Torvalds #define LMP_HV2		0x10
3051da177e4SLinus Torvalds #define LMP_HV3		0x20
3061da177e4SLinus Torvalds #define LMP_ULAW	0x40
3071da177e4SLinus Torvalds #define LMP_ALAW	0x80
3081da177e4SLinus Torvalds 
3091da177e4SLinus Torvalds #define LMP_CVSD	0x01
3101da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
3111da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
31207a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
3131da177e4SLinus Torvalds 
314d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
3155b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
3165b7f9909SMarcel Holtmann 
3175b7f9909SMarcel Holtmann #define LMP_EV4		0x01
3185b7f9909SMarcel Holtmann #define LMP_EV5		0x02
31969ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
320d5859e22SJohan Hedberg #define LMP_LE		0x40
3215b7f9909SMarcel Holtmann 
32204837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
323d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
324efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
325efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
326efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
32704837f64SMarcel Holtmann 
328d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
329e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
330769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
331e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
332769be974SMarcel Holtmann 
333d5859e22SJohan Hedberg #define LMP_LSTO	0x01
334d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
335971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
336d5859e22SJohan Hedberg 
337eead27daSAndre Guedes /* Extended LMP features */
33853b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
33953b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
34053b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
34153b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
34253b834d2SMarcel Holtmann 
343d5991585SMarcel Holtmann #define LMP_SC		0x01
344d5991585SMarcel Holtmann #define LMP_PING	0x02
345d5991585SMarcel Holtmann 
34653b834d2SMarcel Holtmann /* Host features */
347cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
348eead27daSAndre Guedes #define LMP_HOST_LE		0x02
349cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
350d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
351eead27daSAndre Guedes 
352662bc2e6SAndre Guedes /* LE features */
3530da71f1bSMarcel Holtmann #define HCI_LE_ENCRYPTION		0x01
354662bc2e6SAndre Guedes #define HCI_LE_CONN_PARAM_REQ_PROC	0x02
355cd7ca0ecSMarcel Holtmann #define HCI_LE_PING			0x10
35694a3bd02SMarcel Holtmann #define HCI_LE_DATA_LEN_EXT		0x20
3574b71bba4SMarcel Holtmann #define HCI_LE_EXT_SCAN_POLICY		0x80
358662bc2e6SAndre Guedes 
35904837f64SMarcel Holtmann /* Connection modes */
36004837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
36104837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
36204837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
36304837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
36404837f64SMarcel Holtmann 
3651da177e4SLinus Torvalds /* Link policies */
3661da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3671da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3681da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3691da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3701da177e4SLinus Torvalds 
37104837f64SMarcel Holtmann /* Link modes */
3721da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3731da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3741da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3751da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3761da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3771da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3781da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
3797b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
3801da177e4SLinus Torvalds 
38140be492fSMarcel Holtmann /* Authentication types */
38240be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
38340be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
38440be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
38540be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
38640be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
38740be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
38840be492fSMarcel Holtmann 
389a77b15a6SMikel Astiz /* I/O capabilities */
390a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
391a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
392a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
393a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
394a77b15a6SMikel Astiz 
395b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
396b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
397b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
398b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
399b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
40011015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
40111015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
402b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
40311015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
40411015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
405b6020ba0SWaldemar Rymarkiewicz 
4069f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
4078e75b46aSAndre Guedes #define HCI_ERROR_UNKNOWN_CONN_ID	0x02
4089f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
4092acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
410cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
411d41c15cfSJohan Hedberg #define HCI_ERROR_REJ_LIMITED_RESOURCES	0x0d
4129f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
4139f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
414cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
415cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
4169f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
4179f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
4188e75b46aSAndre Guedes #define HCI_ERROR_INVALID_LL_PARAMS	0x1E
4193c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
4209f5a0d7bSAndrei Emeltchenko 
4212455a3eaSAndrei Emeltchenko /* Flow control modes */
4222455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
4232455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
4242455a3eaSAndrei Emeltchenko 
425bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
426bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
427a89612aaSMarcel Holtmann #define HCI_RSSI_INVALID	127
428bbaf444aSJohan Hedberg 
429ba165a90SJohan Hedberg #define HCI_ROLE_MASTER		0x00
430ba165a90SJohan Hedberg #define HCI_ROLE_SLAVE		0x01
431ba165a90SJohan Hedberg 
43232748db0SJohan Hedberg /* Extended Inquiry Response field types */
43332748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
43432748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
43532748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
43632748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
43732748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
43832748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
43932748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
44032748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
44132748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
44232748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
4439ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
4449ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
4459ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
44632748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
44732748db0SJohan Hedberg 
4483f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
4493f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
4503f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
4513f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
4523f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
4533f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
4543f0f524bSJohan Hedberg 
4551da177e4SLinus Torvalds /* -----  HCI Commands ---- */
4566bd32326SVille Tervo #define HCI_OP_NOP			0x0000
4576bd32326SVille Tervo 
458a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
459a9de9248SMarcel Holtmann struct hci_cp_inquiry {
460a9de9248SMarcel Holtmann 	__u8     lap[3];
461a9de9248SMarcel Holtmann 	__u8     length;
462a9de9248SMarcel Holtmann 	__u8     num_rsp;
46366c853ccSGustavo F. Padovan } __packed;
4641da177e4SLinus Torvalds 
465a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
466a9de9248SMarcel Holtmann 
46779d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
46879d6e068SAndre Guedes 
469a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
470a9de9248SMarcel Holtmann 
471a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
472a9de9248SMarcel Holtmann struct hci_cp_create_conn {
473a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
474a9de9248SMarcel Holtmann 	__le16   pkt_type;
475a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
476a9de9248SMarcel Holtmann 	__u8     pscan_mode;
477a9de9248SMarcel Holtmann 	__le16   clock_offset;
478a9de9248SMarcel Holtmann 	__u8     role_switch;
47966c853ccSGustavo F. Padovan } __packed;
4801da177e4SLinus Torvalds 
481a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
482a9de9248SMarcel Holtmann struct hci_cp_disconnect {
483a9de9248SMarcel Holtmann 	__le16   handle;
484a9de9248SMarcel Holtmann 	__u8     reason;
48566c853ccSGustavo F. Padovan } __packed;
4861da177e4SLinus Torvalds 
487a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
488a9de9248SMarcel Holtmann struct hci_cp_add_sco {
489a9de9248SMarcel Holtmann 	__le16   handle;
490a9de9248SMarcel Holtmann 	__le16   pkt_type;
49166c853ccSGustavo F. Padovan } __packed;
492a9de9248SMarcel Holtmann 
493a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
494a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4951da177e4SLinus Torvalds 	bdaddr_t bdaddr;
49666c853ccSGustavo F. Padovan } __packed;
4971da177e4SLinus Torvalds 
498a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
499a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
500a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
501a9de9248SMarcel Holtmann 	__u8     role;
50266c853ccSGustavo F. Padovan } __packed;
5031da177e4SLinus Torvalds 
504a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
505a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
506a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
507a9de9248SMarcel Holtmann 	__u8     reason;
50866c853ccSGustavo F. Padovan } __packed;
5091da177e4SLinus Torvalds 
510a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
511a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
512a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
5139b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
51466c853ccSGustavo F. Padovan } __packed;
5151da177e4SLinus Torvalds 
516a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
517a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
518a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
51966c853ccSGustavo F. Padovan } __packed;
5201da177e4SLinus Torvalds 
521a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
522a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
523a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
524a9de9248SMarcel Holtmann 	__u8     pin_len;
525a9de9248SMarcel Holtmann 	__u8     pin_code[16];
52666c853ccSGustavo F. Padovan } __packed;
527980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
528980e1a53SJohan Hedberg 	__u8     status;
529980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
530980e1a53SJohan Hedberg } __packed;
531a9de9248SMarcel Holtmann 
532a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
533a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
534a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
53566c853ccSGustavo F. Padovan } __packed;
536980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
537980e1a53SJohan Hedberg 	__u8     status;
538980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
539980e1a53SJohan Hedberg } __packed;
540a9de9248SMarcel Holtmann 
541a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
542a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
543a9de9248SMarcel Holtmann 	__le16   handle;
544a9de9248SMarcel Holtmann 	__le16   pkt_type;
54566c853ccSGustavo F. Padovan } __packed;
546a9de9248SMarcel Holtmann 
547a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
548a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
549a9de9248SMarcel Holtmann 	__le16   handle;
55066c853ccSGustavo F. Padovan } __packed;
551a9de9248SMarcel Holtmann 
552a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
553a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
554a9de9248SMarcel Holtmann 	__le16   handle;
555a9de9248SMarcel Holtmann 	__u8     encrypt;
55666c853ccSGustavo F. Padovan } __packed;
557a9de9248SMarcel Holtmann 
558a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
559a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
560a9de9248SMarcel Holtmann 	__le16   handle;
56166c853ccSGustavo F. Padovan } __packed;
562a9de9248SMarcel Holtmann 
563a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
564a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
565a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
566a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
567a9de9248SMarcel Holtmann 	__u8     pscan_mode;
568a9de9248SMarcel Holtmann 	__le16   clock_offset;
56966c853ccSGustavo F. Padovan } __packed;
570a9de9248SMarcel Holtmann 
571a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
572a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
573a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
57466c853ccSGustavo F. Padovan } __packed;
575a9de9248SMarcel Holtmann 
576a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
577a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
578a9de9248SMarcel Holtmann 	__le16   handle;
57966c853ccSGustavo F. Padovan } __packed;
580a9de9248SMarcel Holtmann 
581a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
582a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
583a9de9248SMarcel Holtmann 	__le16   handle;
584a9de9248SMarcel Holtmann 	__u8     page;
58566c853ccSGustavo F. Padovan } __packed;
586a9de9248SMarcel Holtmann 
587a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
588a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
589a9de9248SMarcel Holtmann 	__le16   handle;
59066c853ccSGustavo F. Padovan } __packed;
591a9de9248SMarcel Holtmann 
592df935429SMarcel Holtmann #define HCI_OP_READ_CLOCK_OFFSET	0x041f
593df935429SMarcel Holtmann struct hci_cp_read_clock_offset {
594df935429SMarcel Holtmann 	__le16   handle;
595df935429SMarcel Holtmann } __packed;
596df935429SMarcel Holtmann 
597a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
598a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
599a9de9248SMarcel Holtmann 	__le16   handle;
600a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
601a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
602a9de9248SMarcel Holtmann 	__le16   max_latency;
603a9de9248SMarcel Holtmann 	__le16   voice_setting;
604a9de9248SMarcel Holtmann 	__u8     retrans_effort;
605a9de9248SMarcel Holtmann 	__le16   pkt_type;
60666c853ccSGustavo F. Padovan } __packed;
607a9de9248SMarcel Holtmann 
608a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
609a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
610a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
611a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
612a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
613a9de9248SMarcel Holtmann 	__le16   max_latency;
614a9de9248SMarcel Holtmann 	__le16   content_format;
615a9de9248SMarcel Holtmann 	__u8     retrans_effort;
616a9de9248SMarcel Holtmann 	__le16   pkt_type;
61766c853ccSGustavo F. Padovan } __packed;
618a9de9248SMarcel Holtmann 
619a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
620a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
621a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
622a9de9248SMarcel Holtmann 	__u8     reason;
62366c853ccSGustavo F. Padovan } __packed;
624a9de9248SMarcel Holtmann 
62517fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
62617fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
62717fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
62817fa4b9dSJohan Hedberg 	__u8     capability;
62917fa4b9dSJohan Hedberg 	__u8     oob_data;
63017fa4b9dSJohan Hedberg 	__u8     authentication;
63117fa4b9dSJohan Hedberg } __packed;
63217fa4b9dSJohan Hedberg 
633a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
634a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
635a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
636a5c29683SJohan Hedberg } __packed;
637a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
638a5c29683SJohan Hedberg 	__u8     status;
639a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
640a5c29683SJohan Hedberg } __packed;
641a5c29683SJohan Hedberg 
642a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
643a5c29683SJohan Hedberg 
6449ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
6459ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
6469ad4019aSBrian Gix 	bdaddr_t bdaddr;
6479ad4019aSBrian Gix 	__le32	passkey;
6489ad4019aSBrian Gix } __packed;
6499ad4019aSBrian Gix 
6509ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
6519ad4019aSBrian Gix 
6522763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
6532763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
6542763eda6SSzymon Janc 	bdaddr_t bdaddr;
6552763eda6SSzymon Janc 	__u8     hash[16];
65638da1703SJohan Hedberg 	__u8     rand[16];
6572763eda6SSzymon Janc } __packed;
6582763eda6SSzymon Janc 
6592763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
6602763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
6612763eda6SSzymon Janc 	bdaddr_t bdaddr;
6622763eda6SSzymon Janc } __packed;
6632763eda6SSzymon Janc 
66403b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
66503b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
66603b555e1SJohan Hedberg 	bdaddr_t bdaddr;
66703b555e1SJohan Hedberg 	__u8     reason;
66803b555e1SJohan Hedberg } __packed;
66903b555e1SJohan Hedberg 
670523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
671523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
672523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
673523e93cdSAndrei Emeltchenko 	__u8     key_len;
674523e93cdSAndrei Emeltchenko 	__u8     key_type;
675523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
676523e93cdSAndrei Emeltchenko } __packed;
677523e93cdSAndrei Emeltchenko 
678523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
679523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
680523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
681523e93cdSAndrei Emeltchenko 	__u8     key_len;
682523e93cdSAndrei Emeltchenko 	__u8     key_type;
683523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
684523e93cdSAndrei Emeltchenko } __packed;
685523e93cdSAndrei Emeltchenko 
686523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
687523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
688523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
689523e93cdSAndrei Emeltchenko 	__u8     reason;
690b078b564SAndrei Emeltchenko } __packed;
691b078b564SAndrei Emeltchenko 
692b078b564SAndrei Emeltchenko struct ext_flow_spec {
693b078b564SAndrei Emeltchenko 	__u8       id;
694b078b564SAndrei Emeltchenko 	__u8       stype;
695b078b564SAndrei Emeltchenko 	__le16     msdu;
696b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
697b078b564SAndrei Emeltchenko 	__le32     acc_lat;
698b078b564SAndrei Emeltchenko 	__le32     flush_to;
699b078b564SAndrei Emeltchenko } __packed;
700b078b564SAndrei Emeltchenko 
701b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
702b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
703b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
704b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
705b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
706b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
707b078b564SAndrei Emeltchenko } __packed;
708b078b564SAndrei Emeltchenko 
709b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
710b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
711b078b564SAndrei Emeltchenko 	__le16   log_handle;
712b078b564SAndrei Emeltchenko } __packed;
713b078b564SAndrei Emeltchenko 
714b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
715b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
716b078b564SAndrei Emeltchenko 	__u8     phy_handle;
717b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
718b078b564SAndrei Emeltchenko } __packed;
719b078b564SAndrei Emeltchenko 
720b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
721b078b564SAndrei Emeltchenko 	__u8     status;
722b078b564SAndrei Emeltchenko 	__u8     phy_handle;
723b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
724523e93cdSAndrei Emeltchenko } __packed;
725523e93cdSAndrei Emeltchenko 
7268c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
7278c9a041bSDoHyun Pyun struct hci_cp_set_csb {
7288c9a041bSDoHyun Pyun 	__u8	enable;
7298c9a041bSDoHyun Pyun 	__u8	lt_addr;
7308c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
7318c9a041bSDoHyun Pyun 	__le16	packet_type;
7328c9a041bSDoHyun Pyun 	__le16	interval_min;
7338c9a041bSDoHyun Pyun 	__le16	interval_max;
7348c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
7358c9a041bSDoHyun Pyun } __packed;
7368c9a041bSDoHyun Pyun struct hci_rp_set_csb {
7378c9a041bSDoHyun Pyun 	__u8	status;
7388c9a041bSDoHyun Pyun 	__u8	lt_addr;
7398c9a041bSDoHyun Pyun 	__le16	interval;
7408c9a041bSDoHyun Pyun } __packed;
7418c9a041bSDoHyun Pyun 
742cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
743cefded98SDoHyun Pyun 
744e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
745e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
746e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
747e2f99131SMarcel Holtmann 	__u8     hash192[16];
74838da1703SJohan Hedberg 	__u8     rand192[16];
749e2f99131SMarcel Holtmann 	__u8     hash256[16];
75038da1703SJohan Hedberg 	__u8     rand256[16];
751e2f99131SMarcel Holtmann } __packed;
752e2f99131SMarcel Holtmann 
753a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
754a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
755a9de9248SMarcel Holtmann 	__le16   handle;
756a9de9248SMarcel Holtmann 	__le16   max_interval;
757a9de9248SMarcel Holtmann 	__le16   min_interval;
758a9de9248SMarcel Holtmann 	__le16   attempt;
759a9de9248SMarcel Holtmann 	__le16   timeout;
76066c853ccSGustavo F. Padovan } __packed;
761a9de9248SMarcel Holtmann 
762a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
763a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
764a9de9248SMarcel Holtmann 	__le16   handle;
76566c853ccSGustavo F. Padovan } __packed;
766a9de9248SMarcel Holtmann 
767a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
768a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
769a9de9248SMarcel Holtmann 	__le16   handle;
77066c853ccSGustavo F. Padovan } __packed;
771a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
772a9de9248SMarcel Holtmann 	__u8     status;
773a9de9248SMarcel Holtmann 	__le16   handle;
774a9de9248SMarcel Holtmann 	__u8     role;
77566c853ccSGustavo F. Padovan } __packed;
776a9de9248SMarcel Holtmann 
777a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
778a9de9248SMarcel Holtmann struct hci_cp_switch_role {
779a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
780a9de9248SMarcel Holtmann 	__u8     role;
78166c853ccSGustavo F. Padovan } __packed;
782a9de9248SMarcel Holtmann 
783a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
784a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
785a9de9248SMarcel Holtmann 	__le16   handle;
78666c853ccSGustavo F. Padovan } __packed;
787a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
788a9de9248SMarcel Holtmann 	__u8     status;
789a9de9248SMarcel Holtmann 	__le16   handle;
790a9de9248SMarcel Holtmann 	__le16   policy;
79166c853ccSGustavo F. Padovan } __packed;
792a9de9248SMarcel Holtmann 
793a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
794a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
795a9de9248SMarcel Holtmann 	__le16   handle;
796a9de9248SMarcel Holtmann 	__le16   policy;
79766c853ccSGustavo F. Padovan } __packed;
798a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
799a9de9248SMarcel Holtmann 	__u8     status;
800a9de9248SMarcel Holtmann 	__le16   handle;
80166c853ccSGustavo F. Padovan } __packed;
802a9de9248SMarcel Holtmann 
803e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
804e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
805e4e8e37cSMarcel Holtmann 	__u8     status;
806e4e8e37cSMarcel Holtmann 	__le16   policy;
80766c853ccSGustavo F. Padovan } __packed;
808e4e8e37cSMarcel Holtmann 
809e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
810e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
811e4e8e37cSMarcel Holtmann 	__le16   policy;
81266c853ccSGustavo F. Padovan } __packed;
813e4e8e37cSMarcel Holtmann 
814a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
815a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
816a9de9248SMarcel Holtmann 	__le16   handle;
817a9de9248SMarcel Holtmann 	__le16   max_latency;
818a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
819a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
82066c853ccSGustavo F. Padovan } __packed;
821a9de9248SMarcel Holtmann 
822a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
823a9de9248SMarcel Holtmann 
824a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
825a9de9248SMarcel Holtmann 
826a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
8271da177e4SLinus Torvalds struct hci_cp_set_event_flt {
8281da177e4SLinus Torvalds 	__u8     flt_type;
8291da177e4SLinus Torvalds 	__u8     cond_type;
8301da177e4SLinus Torvalds 	__u8     condition[0];
83166c853ccSGustavo F. Padovan } __packed;
8321da177e4SLinus Torvalds 
8331da177e4SLinus Torvalds /* Filter types */
8341da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
8351da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
8361da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
8371da177e4SLinus Torvalds 
8381da177e4SLinus Torvalds /* CONN_SETUP Condition types */
8391da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
8401da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
8411da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
8421da177e4SLinus Torvalds 
8431da177e4SLinus Torvalds /* CONN_SETUP Conditions */
8441da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
8451da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
8461da177e4SLinus Torvalds 
847b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
848b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
849b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
850b0916ea0SJohan Hedberg 	__u8     delete_all;
851b0916ea0SJohan Hedberg } __packed;
852b0916ea0SJohan Hedberg 
8531f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
8541f6c6378SJohan Hedberg 
855a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
856a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
8571f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
85866c853ccSGustavo F. Padovan } __packed;
859a9de9248SMarcel Holtmann 
860a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
861a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
862a9de9248SMarcel Holtmann 	__u8     status;
8631f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
86466c853ccSGustavo F. Padovan } __packed;
865a9de9248SMarcel Holtmann 
866a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
867a9de9248SMarcel Holtmann 
868a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
869a9de9248SMarcel Holtmann 
870a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
871a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
872a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
873a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
874a9de9248SMarcel Holtmann 
875a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
876a9de9248SMarcel Holtmann 
877a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
878a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
879a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
880a9de9248SMarcel Holtmann 
881a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
882a9de9248SMarcel Holtmann 
883a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
884a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
885a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
886a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
887a9de9248SMarcel Holtmann 
888a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
889a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
8901da177e4SLinus Torvalds 	__u8     status;
8911da177e4SLinus Torvalds 	__u8     dev_class[3];
89266c853ccSGustavo F. Padovan } __packed;
8931da177e4SLinus Torvalds 
894a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
895a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
8961da177e4SLinus Torvalds 	__u8     dev_class[3];
89766c853ccSGustavo F. Padovan } __packed;
8981da177e4SLinus Torvalds 
899a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
9001da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
9011da177e4SLinus Torvalds 	__u8     status;
9021ebb9252SMarcel Holtmann 	__le16   voice_setting;
90366c853ccSGustavo F. Padovan } __packed;
9041da177e4SLinus Torvalds 
905a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
9061da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
9071ebb9252SMarcel Holtmann 	__le16   voice_setting;
90866c853ccSGustavo F. Padovan } __packed;
9091da177e4SLinus Torvalds 
910a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
9111da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
9121ebb9252SMarcel Holtmann 	__le16   acl_mtu;
9131da177e4SLinus Torvalds 	__u8     sco_mtu;
9141ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
9151ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
91666c853ccSGustavo F. Padovan } __packed;
9171da177e4SLinus Torvalds 
918b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
919b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
920b4cb9fb2SMarcel Holtmann 	__u8	status;
921b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
922b4cb9fb2SMarcel Holtmann } __packed;
923b4cb9fb2SMarcel Holtmann 
9244b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
9254b836f39SMarcel Holtmann 
9263d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
9273d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
9283d505312SMarcel Holtmann 	__u8	num_iac;
9293d505312SMarcel Holtmann 	__u8	iac_lap[6];
9303d505312SMarcel Holtmann } __packed;
9313d505312SMarcel Holtmann 
932d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
933d5859e22SJohan Hedberg 
93480a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
93580a1e1dbSJohan Hedberg 
93680a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
93780a1e1dbSJohan Hedberg struct hci_cp_write_eir {
938816a11d5SJohan Hedberg 	__u8	fec;
939816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
94080a1e1dbSJohan Hedberg } __packed;
94180a1e1dbSJohan Hedberg 
942333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
943333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
944333140b5SMarcel Holtmann 	__u8     status;
945333140b5SMarcel Holtmann 	__u8     mode;
94666c853ccSGustavo F. Padovan } __packed;
947333140b5SMarcel Holtmann 
948333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
949333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
950333140b5SMarcel Holtmann 	__u8     mode;
95166c853ccSGustavo F. Padovan } __packed;
952333140b5SMarcel Holtmann 
953c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
954c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
955c35938b2SSzymon Janc 	__u8     status;
956c35938b2SSzymon Janc 	__u8     hash[16];
95738da1703SJohan Hedberg 	__u8     rand[16];
958c35938b2SSzymon Janc } __packed;
959c35938b2SSzymon Janc 
960d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
96191c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
96291c4e9b1SMarcel Holtmann 	__u8     status;
96391c4e9b1SMarcel Holtmann 	__s8     tx_power;
96491c4e9b1SMarcel Holtmann } __packed;
965d5859e22SJohan Hedberg 
966d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
967d62e6d67SJohan Hedberg 
9687528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
9697528ca1cSMarcel Holtmann 
9701e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
9711e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
9721e89cffbSAndrei Emeltchenko 	__u8     status;
9731e89cffbSAndrei Emeltchenko 	__u8     mode;
9741e89cffbSAndrei Emeltchenko } __packed;
9751e89cffbSAndrei Emeltchenko 
976f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
977f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
978f9b49306SAndre Guedes 	__u8	le;
979f9b49306SAndre Guedes 	__u8	simul;
980f9b49306SAndre Guedes } __packed;
981f9b49306SAndre Guedes 
982d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
983d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
984d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
985d0bf75a5SDoHyun Pyun } __packed;
986d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
987d0bf75a5SDoHyun Pyun 	__u8	status;
988d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
989d0bf75a5SDoHyun Pyun } __packed;
990d0bf75a5SDoHyun Pyun 
9916a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
9926a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
9936a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9946a20eaf4SDoHyun Pyun } __packed;
9956a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
9966a20eaf4SDoHyun Pyun 	__u8	status;
9976a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9986a20eaf4SDoHyun Pyun } __packed;
9996a20eaf4SDoHyun Pyun 
10007d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
10017d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
10027d1dab49SDoHyun Pyun 	__u8	lt_addr;
10037d1dab49SDoHyun Pyun 	__u8	fragment;
10047d1dab49SDoHyun Pyun 	__u8	data_length;
10057d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
10067d1dab49SDoHyun Pyun } __packed;
10077d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
10087d1dab49SDoHyun Pyun 	__u8	status;
10097d1dab49SDoHyun Pyun 	__u8	lt_addr;
10107d1dab49SDoHyun Pyun } __packed;
10117d1dab49SDoHyun Pyun 
10125d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
10135d4e7e8dSJohan Hedberg 
1014a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
1015a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
1016a9b07a64SDoHyun Pyun 	__le16	interval_min;
1017a9b07a64SDoHyun Pyun 	__le16	interval_max;
1018a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
1019a9b07a64SDoHyun Pyun 	__u8	service_data;
1020a9b07a64SDoHyun Pyun } __packed;
1021a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
1022a9b07a64SDoHyun Pyun 	__u8	status;
1023a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
1024a9b07a64SDoHyun Pyun } __packed;
1025a9b07a64SDoHyun Pyun 
1026eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
1027eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
1028eb4b95c6SMarcel Holtmann 	__u8	status;
1029eb4b95c6SMarcel Holtmann 	__u8	support;
1030eb4b95c6SMarcel Holtmann } __packed;
1031eb4b95c6SMarcel Holtmann 
1032eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
1033eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
1034eb4b95c6SMarcel Holtmann 	__u8	support;
1035eb4b95c6SMarcel Holtmann } __packed;
1036eb4b95c6SMarcel Holtmann 
1037e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
1038e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
1039e2f99131SMarcel Holtmann 	__u8     status;
1040e2f99131SMarcel Holtmann 	__u8     hash192[16];
104138da1703SJohan Hedberg 	__u8     rand192[16];
1042e2f99131SMarcel Holtmann 	__u8     hash256[16];
104338da1703SJohan Hedberg 	__u8     rand256[16];
1044e2f99131SMarcel Holtmann } __packed;
1045e2f99131SMarcel Holtmann 
1046a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
1047a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
10481da177e4SLinus Torvalds 	__u8     status;
1049a9de9248SMarcel Holtmann 	__u8     hci_ver;
1050a9de9248SMarcel Holtmann 	__le16   hci_rev;
1051a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1052a9de9248SMarcel Holtmann 	__le16   manufacturer;
1053a9de9248SMarcel Holtmann 	__le16   lmp_subver;
105466c853ccSGustavo F. Padovan } __packed;
10551da177e4SLinus Torvalds 
1056a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
1057a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
10581da177e4SLinus Torvalds 	__u8     status;
1059a9de9248SMarcel Holtmann 	__u8     commands[64];
106066c853ccSGustavo F. Padovan } __packed;
10611da177e4SLinus Torvalds 
1062a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1063a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1064a9de9248SMarcel Holtmann 	__u8     status;
1065a9de9248SMarcel Holtmann 	__u8     features[8];
106666c853ccSGustavo F. Padovan } __packed;
1067a9de9248SMarcel Holtmann 
1068a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1069971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1070971e3a4bSAndre Guedes 	__u8     page;
1071971e3a4bSAndre Guedes } __packed;
1072a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1073a9de9248SMarcel Holtmann 	__u8     status;
1074a9de9248SMarcel Holtmann 	__u8     page;
1075a9de9248SMarcel Holtmann 	__u8     max_page;
1076a9de9248SMarcel Holtmann 	__u8     features[8];
107766c853ccSGustavo F. Padovan } __packed;
1078a9de9248SMarcel Holtmann 
1079a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1080a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1081a9de9248SMarcel Holtmann 	__u8     status;
1082a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1083a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1084a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1085a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
108666c853ccSGustavo F. Padovan } __packed;
1087a9de9248SMarcel Holtmann 
1088a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1089a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1090a9de9248SMarcel Holtmann 	__u8     status;
10911da177e4SLinus Torvalds 	bdaddr_t bdaddr;
109266c853ccSGustavo F. Padovan } __packed;
10931da177e4SLinus Torvalds 
1094350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1095350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1096350ee4cfSAndrei Emeltchenko 	__u8     status;
1097350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1098350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1099350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1100350ee4cfSAndrei Emeltchenko } __packed;
1101350ee4cfSAndrei Emeltchenko 
1102109e3191SMarcel Holtmann #define HCI_OP_READ_LOCAL_CODECS	0x100b
1103109e3191SMarcel Holtmann 
1104f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1105f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1106f332ec66SJohan Hedberg 	__u8     status;
1107f332ec66SJohan Hedberg 	__le16   interval;
1108f332ec66SJohan Hedberg 	__le16   window;
1109f332ec66SJohan Hedberg } __packed;
1110f332ec66SJohan Hedberg 
1111f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1112f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1113f6422ec6SAntti Julku 	__le16   interval;
1114f6422ec6SAntti Julku 	__le16   window;
1115f6422ec6SAntti Julku } __packed;
1116f6422ec6SAntti Julku 
11175a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
11185a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
11195a134faeSAndrzej Kaczmarek 	__le16   handle;
11205a134faeSAndrzej Kaczmarek 	__u8     type;
11215a134faeSAndrzej Kaczmarek } __packed;
11225a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
11235a134faeSAndrzej Kaczmarek 	__u8     status;
11245a134faeSAndrzej Kaczmarek 	__le16   handle;
11255a134faeSAndrzej Kaczmarek 	__s8     tx_power;
11265a134faeSAndrzej Kaczmarek } __packed;
11275a134faeSAndrzej Kaczmarek 
1128f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1129f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1130f332ec66SJohan Hedberg 	__u8     status;
1131f332ec66SJohan Hedberg 	__u8     type;
1132f332ec66SJohan Hedberg } __packed;
1133f332ec66SJohan Hedberg 
1134f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1135f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1136f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1137f6422ec6SAntti Julku 
11385ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
11395ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
11405ae76a94SAndrzej Kaczmarek 	__le16   handle;
11415ae76a94SAndrzej Kaczmarek } __packed;
11425ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
11435ae76a94SAndrzej Kaczmarek 	__u8     status;
11445ae76a94SAndrzej Kaczmarek 	__le16   handle;
11455ae76a94SAndrzej Kaczmarek 	__s8     rssi;
11465ae76a94SAndrzej Kaczmarek } __packed;
11475ae76a94SAndrzej Kaczmarek 
114833f35721SJohan Hedberg #define HCI_OP_READ_CLOCK		0x1407
114933f35721SJohan Hedberg struct hci_cp_read_clock {
115033f35721SJohan Hedberg 	__le16   handle;
115133f35721SJohan Hedberg 	__u8     which;
115233f35721SJohan Hedberg } __packed;
115333f35721SJohan Hedberg struct hci_rp_read_clock {
115433f35721SJohan Hedberg 	__u8     status;
115533f35721SJohan Hedberg 	__le16   handle;
115633f35721SJohan Hedberg 	__le32   clock;
115733f35721SJohan Hedberg 	__le16   accuracy;
115833f35721SJohan Hedberg } __packed;
115933f35721SJohan Hedberg 
1160928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1161928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1162928abaa7SAndrei Emeltchenko 	__u8     status;
1163928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1164928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1165928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1166928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1167928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1168928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1169928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1170928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1171928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1172928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1173928abaa7SAndrei Emeltchenko } __packed;
1174928abaa7SAndrei Emeltchenko 
1175523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1176523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1177523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1178523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1179523e93cdSAndrei Emeltchenko 	__le16   max_len;
1180523e93cdSAndrei Emeltchenko } __packed;
1181523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1182523e93cdSAndrei Emeltchenko 	__u8     status;
1183523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1184523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1185523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1186523e93cdSAndrei Emeltchenko } __packed;
1187523e93cdSAndrei Emeltchenko 
1188523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1189523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1190523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1191523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1192523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1193523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1194523e93cdSAndrei Emeltchenko } __packed;
1195523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1196523e93cdSAndrei Emeltchenko 	__u8     status;
1197523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1198523e93cdSAndrei Emeltchenko } __packed;
1199523e93cdSAndrei Emeltchenko 
1200f4fe73edSMarcel Holtmann #define HCI_OP_GET_MWS_TRANSPORT_CONFIG	0x140c
1201f4fe73edSMarcel Holtmann 
12024b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
12034b4148e9SMarcel Holtmann 
120406f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
120506f5b778SMarcel Holtmann 
120663185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
120763185f64SVille Tervo struct hci_cp_le_set_event_mask {
120863185f64SVille Tervo 	__u8     mask[8];
120963185f64SVille Tervo } __packed;
121063185f64SVille Tervo 
121163185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
121263185f64SVille Tervo struct hci_rp_le_read_buffer_size {
121363185f64SVille Tervo 	__u8     status;
121463185f64SVille Tervo 	__le16   le_mtu;
121563185f64SVille Tervo 	__u8     le_max_pkt;
121663185f64SVille Tervo } __packed;
121763185f64SVille Tervo 
121860e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
121960e77321SJohan Hedberg struct hci_rp_le_read_local_features {
122060e77321SJohan Hedberg 	__u8     status;
122160e77321SJohan Hedberg 	__u8     features[8];
122260e77321SJohan Hedberg } __packed;
122360e77321SJohan Hedberg 
1224d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1225d13eafceSMarcel Holtmann 
12261e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
12271e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
12281e191893SMarcel Holtmann 	__le16   min_interval;
12291e191893SMarcel Holtmann 	__le16   max_interval;
12301e191893SMarcel Holtmann 	__u8     type;
12311e191893SMarcel Holtmann 	__u8     own_address_type;
12321e191893SMarcel Holtmann 	__u8     direct_addr_type;
12331e191893SMarcel Holtmann 	bdaddr_t direct_addr;
12341e191893SMarcel Holtmann 	__u8     channel_map;
12351e191893SMarcel Holtmann 	__u8     filter_policy;
12361e191893SMarcel Holtmann } __packed;
12371e191893SMarcel Holtmann 
12388fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
12398fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
12408fa19098SJohan Hedberg 	__u8	status;
12418fa19098SJohan Hedberg 	__s8	tx_power;
12428fa19098SJohan Hedberg } __packed;
12438fa19098SJohan Hedberg 
12443f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
12453f0f524bSJohan Hedberg 
12463f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
12473f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
12483f0f524bSJohan Hedberg 	__u8	length;
12493f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
12503f0f524bSJohan Hedberg } __packed;
12513f0f524bSJohan Hedberg 
1252f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1253f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1254f14d8f64SMarcel Holtmann 	__u8	length;
1255f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1256f14d8f64SMarcel Holtmann } __packed;
1257f14d8f64SMarcel Holtmann 
1258c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1259c1d5dc4aSJohan Hedberg 
12605df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
12615df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
12625df480b5SAndre Guedes 
126307f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
126407f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
126507f7fa5dSAndre Guedes 	__u8    type;
126607f7fa5dSAndre Guedes 	__le16  interval;
126707f7fa5dSAndre Guedes 	__le16  window;
126807f7fa5dSAndre Guedes 	__u8    own_address_type;
126907f7fa5dSAndre Guedes 	__u8    filter_policy;
127007f7fa5dSAndre Guedes } __packed;
127107f7fa5dSAndre Guedes 
127276a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
127376a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1274525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1275525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
127668a8aea4SAndrei Emeltchenko 
1277eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1278eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1279eb9d91f5SAndre Guedes 	__u8     enable;
1280eb9d91f5SAndre Guedes 	__u8     filter_dup;
1281eb9d91f5SAndre Guedes } __packed;
1282eb9d91f5SAndre Guedes 
1283a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1284a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1285a7139eddSJohan Hedberg 
128663185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
128763185f64SVille Tervo struct hci_cp_le_create_conn {
128863185f64SVille Tervo 	__le16   scan_interval;
128963185f64SVille Tervo 	__le16   scan_window;
129063185f64SVille Tervo 	__u8     filter_policy;
129163185f64SVille Tervo 	__u8     peer_addr_type;
129263185f64SVille Tervo 	bdaddr_t peer_addr;
129363185f64SVille Tervo 	__u8     own_address_type;
129463185f64SVille Tervo 	__le16   conn_interval_min;
129563185f64SVille Tervo 	__le16   conn_interval_max;
129663185f64SVille Tervo 	__le16   conn_latency;
129763185f64SVille Tervo 	__le16   supervision_timeout;
129863185f64SVille Tervo 	__le16   min_ce_len;
129963185f64SVille Tervo 	__le16   max_ce_len;
130063185f64SVille Tervo } __packed;
130163185f64SVille Tervo 
130263185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
130363185f64SVille Tervo 
1304cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1305cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1306cf1d081fSJohan Hedberg 	__u8	status;
1307cf1d081fSJohan Hedberg 	__u8	size;
1308cf1d081fSJohan Hedberg } __packed;
1309cf1d081fSJohan Hedberg 
1310d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1311d9a7b0a5SMarcel Holtmann 
1312d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1313d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1314d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1315d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1316d9a7b0a5SMarcel Holtmann } __packed;
1317d9a7b0a5SMarcel Holtmann 
1318d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1319d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1320d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1321d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1322d9a7b0a5SMarcel Holtmann } __packed;
1323d9a7b0a5SMarcel Holtmann 
13242ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
13252ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
13262ce603ebSClaudio Takahasi 	__le16   handle;
13272ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
13282ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
13292ce603ebSClaudio Takahasi 	__le16   conn_latency;
13302ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
13312ce603ebSClaudio Takahasi 	__le16   min_ce_len;
13322ce603ebSClaudio Takahasi 	__le16   max_ce_len;
13332ce603ebSClaudio Takahasi } __packed;
13342ce603ebSClaudio Takahasi 
1335a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1336a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1337a7a595f6SVinicius Costa Gomes 	__le16	handle;
1338fe39c7b2SMarcel Holtmann 	__le64	rand;
1339a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1340a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1341a7a595f6SVinicius Costa Gomes } __packed;
1342a7a595f6SVinicius Costa Gomes 
1343a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1344a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1345a7a595f6SVinicius Costa Gomes 	__le16	handle;
1346a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1347a7a595f6SVinicius Costa Gomes } __packed;
1348a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1349a7a595f6SVinicius Costa Gomes 	__u8	status;
1350a7a595f6SVinicius Costa Gomes 	__le16	handle;
1351a7a595f6SVinicius Costa Gomes } __packed;
1352a7a595f6SVinicius Costa Gomes 
1353a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1354a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1355a7a595f6SVinicius Costa Gomes 	__le16	handle;
1356a7a595f6SVinicius Costa Gomes } __packed;
1357a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1358a7a595f6SVinicius Costa Gomes 	__u8	status;
1359a7a595f6SVinicius Costa Gomes 	__le16	handle;
1360a7a595f6SVinicius Costa Gomes } __packed;
1361a7a595f6SVinicius Costa Gomes 
13629b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
13639b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
13649b008c04SJohan Hedberg 	__u8	status;
13659b008c04SJohan Hedberg 	__u8	le_states[8];
13669b008c04SJohan Hedberg } __packed;
13679b008c04SJohan Hedberg 
13688e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_REPLY	0x2020
13698e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_reply {
13708e75b46aSAndre Guedes 	__le16	handle;
13718e75b46aSAndre Guedes 	__le16	interval_min;
13728e75b46aSAndre Guedes 	__le16	interval_max;
13738e75b46aSAndre Guedes 	__le16	latency;
13748e75b46aSAndre Guedes 	__le16	timeout;
13758e75b46aSAndre Guedes 	__le16	min_ce_len;
13768e75b46aSAndre Guedes 	__le16	max_ce_len;
13778e75b46aSAndre Guedes } __packed;
13788e75b46aSAndre Guedes 
13798e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY	0x2021
13808e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_neg_reply {
13818e75b46aSAndre Guedes 	__le16	handle;
13828e75b46aSAndre Guedes 	__u8	reason;
13838e75b46aSAndre Guedes } __packed;
13848e75b46aSAndre Guedes 
138594a3bd02SMarcel Holtmann #define HCI_OP_LE_SET_DATA_LEN		0x2022
138694a3bd02SMarcel Holtmann struct hci_cp_le_set_data_len {
138794a3bd02SMarcel Holtmann 	__le16	handle;
138894a3bd02SMarcel Holtmann 	__le16	tx_len;
138994a3bd02SMarcel Holtmann 	__le16	tx_time;
139094a3bd02SMarcel Holtmann } __packed;
139194a3bd02SMarcel Holtmann struct hci_rp_le_set_data_len {
139294a3bd02SMarcel Holtmann 	__u8	status;
139394a3bd02SMarcel Holtmann 	__le16	handle;
139494a3bd02SMarcel Holtmann } __packed;
139594a3bd02SMarcel Holtmann 
139694a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_DEF_DATA_LEN	0x2023
139794a3bd02SMarcel Holtmann struct hci_rp_le_read_def_data_len {
139894a3bd02SMarcel Holtmann 	__u8	status;
139994a3bd02SMarcel Holtmann 	__le16	tx_len;
140094a3bd02SMarcel Holtmann 	__le16	tx_time;
140194a3bd02SMarcel Holtmann } __packed;
140294a3bd02SMarcel Holtmann 
140394a3bd02SMarcel Holtmann #define HCI_OP_LE_WRITE_DEF_DATA_LEN	0x2024
140494a3bd02SMarcel Holtmann struct hci_cp_le_write_def_data_len {
140594a3bd02SMarcel Holtmann 	__le16	tx_len;
140694a3bd02SMarcel Holtmann 	__le16	tx_time;
140794a3bd02SMarcel Holtmann } __packed;
140894a3bd02SMarcel Holtmann 
140994a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_MAX_DATA_LEN	0x202f
141094a3bd02SMarcel Holtmann struct hci_rp_le_read_max_data_len {
141194a3bd02SMarcel Holtmann 	__u8	status;
141294a3bd02SMarcel Holtmann 	__le16	tx_len;
141394a3bd02SMarcel Holtmann 	__le16	tx_time;
141494a3bd02SMarcel Holtmann 	__le16	rx_len;
141594a3bd02SMarcel Holtmann 	__le16	rx_time;
141694a3bd02SMarcel Holtmann } __packed;
141794a3bd02SMarcel Holtmann 
14181da177e4SLinus Torvalds /* ---- HCI Events ---- */
14191da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
14201da177e4SLinus Torvalds 
14211da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
14221da177e4SLinus Torvalds struct inquiry_info {
14231da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14241da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
14251da177e4SLinus Torvalds 	__u8     pscan_period_mode;
14261da177e4SLinus Torvalds 	__u8     pscan_mode;
14271da177e4SLinus Torvalds 	__u8     dev_class[3];
14281ebb9252SMarcel Holtmann 	__le16   clock_offset;
142966c853ccSGustavo F. Padovan } __packed;
14301da177e4SLinus Torvalds 
14311da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
14321da177e4SLinus Torvalds struct hci_ev_conn_complete {
14331da177e4SLinus Torvalds 	__u8     status;
14341ebb9252SMarcel Holtmann 	__le16   handle;
14351da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14361da177e4SLinus Torvalds 	__u8     link_type;
14371da177e4SLinus Torvalds 	__u8     encr_mode;
143866c853ccSGustavo F. Padovan } __packed;
14391da177e4SLinus Torvalds 
14401da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
14411da177e4SLinus Torvalds struct hci_ev_conn_request {
14421da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14431da177e4SLinus Torvalds 	__u8     dev_class[3];
14441da177e4SLinus Torvalds 	__u8     link_type;
144566c853ccSGustavo F. Padovan } __packed;
14461da177e4SLinus Torvalds 
14471da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
14481da177e4SLinus Torvalds struct hci_ev_disconn_complete {
14491da177e4SLinus Torvalds 	__u8     status;
14501ebb9252SMarcel Holtmann 	__le16   handle;
14511da177e4SLinus Torvalds 	__u8     reason;
145266c853ccSGustavo F. Padovan } __packed;
14531da177e4SLinus Torvalds 
14541da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
14551da177e4SLinus Torvalds struct hci_ev_auth_complete {
14561da177e4SLinus Torvalds 	__u8     status;
14571ebb9252SMarcel Holtmann 	__le16   handle;
145866c853ccSGustavo F. Padovan } __packed;
14591da177e4SLinus Torvalds 
1460a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1461a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1462a9de9248SMarcel Holtmann 	__u8     status;
1463a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
14641f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
146566c853ccSGustavo F. Padovan } __packed;
1466a9de9248SMarcel Holtmann 
14671da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
14681da177e4SLinus Torvalds struct hci_ev_encrypt_change {
14691da177e4SLinus Torvalds 	__u8     status;
14701ebb9252SMarcel Holtmann 	__le16   handle;
14711da177e4SLinus Torvalds 	__u8     encrypt;
147266c853ccSGustavo F. Padovan } __packed;
14731da177e4SLinus Torvalds 
1474a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1475a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
14761da177e4SLinus Torvalds 	__u8     status;
14771ebb9252SMarcel Holtmann 	__le16   handle;
147866c853ccSGustavo F. Padovan } __packed;
14791da177e4SLinus Torvalds 
1480a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1481a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1482a9de9248SMarcel Holtmann 	__u8     status;
1483a9de9248SMarcel Holtmann 	__le16   handle;
1484a9de9248SMarcel Holtmann 	__u8     features[8];
148566c853ccSGustavo F. Padovan } __packed;
1486a9de9248SMarcel Holtmann 
1487a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1488a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1489a9de9248SMarcel Holtmann 	__u8     status;
1490a9de9248SMarcel Holtmann 	__le16   handle;
1491a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1492a9de9248SMarcel Holtmann 	__le16   manufacturer;
1493a9de9248SMarcel Holtmann 	__le16   lmp_subver;
149466c853ccSGustavo F. Padovan } __packed;
1495a9de9248SMarcel Holtmann 
1496a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
14971da177e4SLinus Torvalds struct hci_qos {
14981da177e4SLinus Torvalds 	__u8     service_type;
14991da177e4SLinus Torvalds 	__u32    token_rate;
15001da177e4SLinus Torvalds 	__u32    peak_bandwidth;
15011da177e4SLinus Torvalds 	__u32    latency;
15021da177e4SLinus Torvalds 	__u32    delay_variation;
150366c853ccSGustavo F. Padovan } __packed;
15041da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
15051da177e4SLinus Torvalds 	__u8     status;
15061ebb9252SMarcel Holtmann 	__le16   handle;
15071da177e4SLinus Torvalds 	struct   hci_qos qos;
150866c853ccSGustavo F. Padovan } __packed;
15091da177e4SLinus Torvalds 
1510a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
15111da177e4SLinus Torvalds struct hci_ev_cmd_complete {
15121da177e4SLinus Torvalds 	__u8     ncmd;
15131ebb9252SMarcel Holtmann 	__le16   opcode;
151466c853ccSGustavo F. Padovan } __packed;
15151da177e4SLinus Torvalds 
1516a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
15171da177e4SLinus Torvalds struct hci_ev_cmd_status {
15181da177e4SLinus Torvalds 	__u8     status;
15191da177e4SLinus Torvalds 	__u8     ncmd;
15201ebb9252SMarcel Holtmann 	__le16   opcode;
152166c853ccSGustavo F. Padovan } __packed;
15221da177e4SLinus Torvalds 
152324dfa343SMarcel Holtmann #define HCI_EV_HARDWARE_ERROR		0x10
152424dfa343SMarcel Holtmann struct hci_ev_hardware_error {
152524dfa343SMarcel Holtmann 	__u8     code;
152624dfa343SMarcel Holtmann } __packed;
152724dfa343SMarcel Holtmann 
15281da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
15291da177e4SLinus Torvalds struct hci_ev_role_change {
15301da177e4SLinus Torvalds 	__u8     status;
15311da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15321da177e4SLinus Torvalds 	__u8     role;
153366c853ccSGustavo F. Padovan } __packed;
15341da177e4SLinus Torvalds 
1535a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1536613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1537613a1c0cSAndrei Emeltchenko 	__le16   handle;
1538613a1c0cSAndrei Emeltchenko 	__le16   count;
1539613a1c0cSAndrei Emeltchenko } __packed;
1540613a1c0cSAndrei Emeltchenko 
1541a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1542a9de9248SMarcel Holtmann 	__u8     num_hndl;
1543613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
154466c853ccSGustavo F. Padovan } __packed;
1545a9de9248SMarcel Holtmann 
15461da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
15471da177e4SLinus Torvalds struct hci_ev_mode_change {
15481da177e4SLinus Torvalds 	__u8     status;
15491ebb9252SMarcel Holtmann 	__le16   handle;
15501da177e4SLinus Torvalds 	__u8     mode;
15511ebb9252SMarcel Holtmann 	__le16   interval;
155266c853ccSGustavo F. Padovan } __packed;
15531da177e4SLinus Torvalds 
15541da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
15551da177e4SLinus Torvalds struct hci_ev_pin_code_req {
15561da177e4SLinus Torvalds 	bdaddr_t bdaddr;
155766c853ccSGustavo F. Padovan } __packed;
15581da177e4SLinus Torvalds 
15591da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
15601da177e4SLinus Torvalds struct hci_ev_link_key_req {
15611da177e4SLinus Torvalds 	bdaddr_t bdaddr;
156266c853ccSGustavo F. Padovan } __packed;
15631da177e4SLinus Torvalds 
15641da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
15651da177e4SLinus Torvalds struct hci_ev_link_key_notify {
15661da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15679b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
15681da177e4SLinus Torvalds 	__u8     key_type;
156966c853ccSGustavo F. Padovan } __packed;
15701da177e4SLinus Torvalds 
1571a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
15721da177e4SLinus Torvalds struct hci_ev_clock_offset {
15731da177e4SLinus Torvalds 	__u8     status;
15741ebb9252SMarcel Holtmann 	__le16   handle;
15751ebb9252SMarcel Holtmann 	__le16   clock_offset;
157666c853ccSGustavo F. Padovan } __packed;
15771da177e4SLinus Torvalds 
1578a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1579a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1580a8746417SMarcel Holtmann 	__u8     status;
1581a8746417SMarcel Holtmann 	__le16   handle;
1582a8746417SMarcel Holtmann 	__le16   pkt_type;
158366c853ccSGustavo F. Padovan } __packed;
1584a8746417SMarcel Holtmann 
158585a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
158685a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
158785a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
158885a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
158966c853ccSGustavo F. Padovan } __packed;
159085a1e930SMarcel Holtmann 
1591a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1592a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1593a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1594a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1595a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1596a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1597a9de9248SMarcel Holtmann 	__le16   clock_offset;
1598a9de9248SMarcel Holtmann 	__s8     rssi;
159966c853ccSGustavo F. Padovan } __packed;
1600a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1601a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1602a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1603a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1604a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1605a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1606a9de9248SMarcel Holtmann 	__le16   clock_offset;
1607a9de9248SMarcel Holtmann 	__s8     rssi;
160866c853ccSGustavo F. Padovan } __packed;
1609a9de9248SMarcel Holtmann 
1610a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1611a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1612a9de9248SMarcel Holtmann 	__u8     status;
1613a9de9248SMarcel Holtmann 	__le16   handle;
1614a9de9248SMarcel Holtmann 	__u8     page;
1615a9de9248SMarcel Holtmann 	__u8     max_page;
1616a9de9248SMarcel Holtmann 	__u8     features[8];
161766c853ccSGustavo F. Padovan } __packed;
1618a9de9248SMarcel Holtmann 
1619a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1620a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1621a9de9248SMarcel Holtmann 	__u8     status;
1622a9de9248SMarcel Holtmann 	__le16   handle;
1623a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1624a9de9248SMarcel Holtmann 	__u8     link_type;
1625a9de9248SMarcel Holtmann 	__u8     tx_interval;
1626a9de9248SMarcel Holtmann 	__u8     retrans_window;
1627a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1628a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1629a9de9248SMarcel Holtmann 	__u8     air_mode;
163066c853ccSGustavo F. Padovan } __packed;
1631a9de9248SMarcel Holtmann 
1632a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1633a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1634a9de9248SMarcel Holtmann 	__u8     status;
1635a9de9248SMarcel Holtmann 	__le16   handle;
1636a9de9248SMarcel Holtmann 	__u8     tx_interval;
1637a9de9248SMarcel Holtmann 	__u8     retrans_window;
1638a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1639a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
164066c853ccSGustavo F. Padovan } __packed;
1641a9de9248SMarcel Holtmann 
1642a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
164304837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
164404837f64SMarcel Holtmann 	__u8     status;
164504837f64SMarcel Holtmann 	__le16   handle;
164604837f64SMarcel Holtmann 	__le16   max_tx_latency;
164704837f64SMarcel Holtmann 	__le16   max_rx_latency;
164804837f64SMarcel Holtmann 	__le16   max_remote_timeout;
164904837f64SMarcel Holtmann 	__le16   max_local_timeout;
165066c853ccSGustavo F. Padovan } __packed;
165104837f64SMarcel Holtmann 
1652a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1653a9de9248SMarcel Holtmann struct extended_inquiry_info {
1654a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1655a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1656a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1657a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1658a9de9248SMarcel Holtmann 	__le16   clock_offset;
1659a9de9248SMarcel Holtmann 	__s8     rssi;
1660a9de9248SMarcel Holtmann 	__u8     data[240];
166166c853ccSGustavo F. Padovan } __packed;
1662a9de9248SMarcel Holtmann 
16631c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
16641c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
16651c2e0041SJohan Hedberg 	__u8	status;
16661c2e0041SJohan Hedberg 	__le16	handle;
16671c2e0041SJohan Hedberg } __packed;
16681c2e0041SJohan Hedberg 
16690493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
16700493684eSMarcel Holtmann struct hci_ev_io_capa_request {
16710493684eSMarcel Holtmann 	bdaddr_t bdaddr;
167266c853ccSGustavo F. Padovan } __packed;
16730493684eSMarcel Holtmann 
167403b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
167503b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
167603b555e1SJohan Hedberg 	bdaddr_t bdaddr;
167703b555e1SJohan Hedberg 	__u8     capability;
167803b555e1SJohan Hedberg 	__u8     oob_data;
167903b555e1SJohan Hedberg 	__u8     authentication;
168003b555e1SJohan Hedberg } __packed;
168103b555e1SJohan Hedberg 
1682a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1683a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1684a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1685a5c29683SJohan Hedberg 	__le32		passkey;
1686a5c29683SJohan Hedberg } __packed;
1687a5c29683SJohan Hedberg 
16889ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
16899ad4019aSBrian Gix struct hci_ev_user_passkey_req {
16909ad4019aSBrian Gix 	bdaddr_t	bdaddr;
16919ad4019aSBrian Gix } __packed;
16929ad4019aSBrian Gix 
16932763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
16942763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
16952763eda6SSzymon Janc 	bdaddr_t bdaddr;
16962763eda6SSzymon Janc } __packed;
16972763eda6SSzymon Janc 
16980493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
16990493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
17000493684eSMarcel Holtmann 	__u8     status;
17010493684eSMarcel Holtmann 	bdaddr_t bdaddr;
170266c853ccSGustavo F. Padovan } __packed;
17030493684eSMarcel Holtmann 
170492a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
170592a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
170692a25256SJohan Hedberg 	bdaddr_t	bdaddr;
170792a25256SJohan Hedberg 	__le32		passkey;
170892a25256SJohan Hedberg } __packed;
170992a25256SJohan Hedberg 
171092a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
171192a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
171292a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
171392a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
171492a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
171592a25256SJohan Hedberg 
171692a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
171792a25256SJohan Hedberg struct hci_ev_keypress_notify {
171892a25256SJohan Hedberg 	bdaddr_t	bdaddr;
171992a25256SJohan Hedberg 	__u8		type;
172092a25256SJohan Hedberg } __packed;
172192a25256SJohan Hedberg 
172241a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
172341a96212SMarcel Holtmann struct hci_ev_remote_host_features {
172441a96212SMarcel Holtmann 	bdaddr_t bdaddr;
172541a96212SMarcel Holtmann 	__u8     features[8];
172666c853ccSGustavo F. Padovan } __packed;
172741a96212SMarcel Holtmann 
172863185f64SVille Tervo #define HCI_EV_LE_META			0x3e
172963185f64SVille Tervo struct hci_ev_le_meta {
173063185f64SVille Tervo 	__u8     subevent;
173163185f64SVille Tervo } __packed;
173263185f64SVille Tervo 
1733523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1734523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1735523e93cdSAndrei Emeltchenko 	__u8     status;
1736523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1737523e93cdSAndrei Emeltchenko } __packed;
1738523e93cdSAndrei Emeltchenko 
1739523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1740523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1741523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1742523e93cdSAndrei Emeltchenko } __packed;
1743523e93cdSAndrei Emeltchenko 
1744523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1745523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1746523e93cdSAndrei Emeltchenko 	__u8     status;
1747523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1748523e93cdSAndrei Emeltchenko 	__u8     reason;
1749523e93cdSAndrei Emeltchenko } __packed;
1750523e93cdSAndrei Emeltchenko 
1751523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1752523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1753523e93cdSAndrei Emeltchenko 	__u8     status;
1754523e93cdSAndrei Emeltchenko 	__le16   handle;
1755523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1756523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1757523e93cdSAndrei Emeltchenko } __packed;
1758523e93cdSAndrei Emeltchenko 
1759523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1760523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1761523e93cdSAndrei Emeltchenko 	__u8     status;
1762523e93cdSAndrei Emeltchenko 	__le16   handle;
1763523e93cdSAndrei Emeltchenko 	__u8     reason;
1764523e93cdSAndrei Emeltchenko } __packed;
1765523e93cdSAndrei Emeltchenko 
176625e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
176725e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
176825e89e99SAndrei Emeltchenko 	__le16   handle;
176925e89e99SAndrei Emeltchenko 	__le16   pkts;
177025e89e99SAndrei Emeltchenko 	__le16   blocks;
177125e89e99SAndrei Emeltchenko } __packed;
177225e89e99SAndrei Emeltchenko 
177325e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
177425e89e99SAndrei Emeltchenko 	__le16   num_blocks;
177525e89e99SAndrei Emeltchenko 	__u8     num_hndl;
177625e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
177725e89e99SAndrei Emeltchenko } __packed;
177825e89e99SAndrei Emeltchenko 
17792b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
17802b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
17812b359445SDoHyun Pyun 	__u8	status;
17822b359445SDoHyun Pyun } __packed;
17832b359445SDoHyun Pyun 
17842ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
17852ed01805SDoHyun Pyun 
178663185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
178763185f64SVille Tervo struct hci_ev_le_conn_complete {
178863185f64SVille Tervo 	__u8     status;
178963185f64SVille Tervo 	__le16   handle;
179063185f64SVille Tervo 	__u8     role;
179163185f64SVille Tervo 	__u8     bdaddr_type;
179263185f64SVille Tervo 	bdaddr_t bdaddr;
179363185f64SVille Tervo 	__le16   interval;
179463185f64SVille Tervo 	__le16   latency;
179563185f64SVille Tervo 	__le16   supervision_timeout;
179663185f64SVille Tervo 	__u8     clk_accurancy;
179763185f64SVille Tervo } __packed;
179863185f64SVille Tervo 
17992331fd46SMarcel Holtmann /* Advertising report event types */
18002331fd46SMarcel Holtmann #define LE_ADV_IND		0x00
18012331fd46SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
18022331fd46SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
18032331fd46SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
18042331fd46SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
18052331fd46SMarcel Holtmann 
18062331fd46SMarcel Holtmann #define ADDR_LE_DEV_PUBLIC	0x00
18072331fd46SMarcel Holtmann #define ADDR_LE_DEV_RANDOM	0x01
18082331fd46SMarcel Holtmann 
18092331fd46SMarcel Holtmann #define HCI_EV_LE_ADVERTISING_REPORT	0x02
18102331fd46SMarcel Holtmann struct hci_ev_le_advertising_info {
18112331fd46SMarcel Holtmann 	__u8	 evt_type;
18122331fd46SMarcel Holtmann 	__u8	 bdaddr_type;
18132331fd46SMarcel Holtmann 	bdaddr_t bdaddr;
18142331fd46SMarcel Holtmann 	__u8	 length;
18152331fd46SMarcel Holtmann 	__u8	 data[0];
18162331fd46SMarcel Holtmann } __packed;
18172331fd46SMarcel Holtmann 
18181855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
18191855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
18201855d92dSMarcel Holtmann 	__u8     status;
18211855d92dSMarcel Holtmann 	__le16   handle;
18221855d92dSMarcel Holtmann 	__le16   interval;
18231855d92dSMarcel Holtmann 	__le16   latency;
18241855d92dSMarcel Holtmann 	__le16   supervision_timeout;
18251855d92dSMarcel Holtmann } __packed;
18261855d92dSMarcel Holtmann 
1827a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1828a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1829a7a595f6SVinicius Costa Gomes 	__le16	handle;
1830fe39c7b2SMarcel Holtmann 	__le64	rand;
1831a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1832a7a595f6SVinicius Costa Gomes } __packed;
1833a7a595f6SVinicius Costa Gomes 
18348e75b46aSAndre Guedes #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ	0x06
18358e75b46aSAndre Guedes struct hci_ev_le_remote_conn_param_req {
18368e75b46aSAndre Guedes 	__le16 handle;
18378e75b46aSAndre Guedes 	__le16 interval_min;
18388e75b46aSAndre Guedes 	__le16 interval_max;
18398e75b46aSAndre Guedes 	__le16 latency;
18408e75b46aSAndre Guedes 	__le16 timeout;
18418e75b46aSAndre Guedes } __packed;
18428e75b46aSAndre Guedes 
184394a3bd02SMarcel Holtmann #define HCI_EV_LE_DATA_LEN_CHANGE	0x07
184494a3bd02SMarcel Holtmann struct hci_ev_le_data_len_change {
184594a3bd02SMarcel Holtmann 	__le16	handle;
184694a3bd02SMarcel Holtmann 	__le16	tx_len;
184794a3bd02SMarcel Holtmann 	__le16	tx_time;
184894a3bd02SMarcel Holtmann 	__le16	rx_len;
184994a3bd02SMarcel Holtmann 	__le16	rx_time;
185094a3bd02SMarcel Holtmann } __packed;
185194a3bd02SMarcel Holtmann 
185232c9d43fSMarcel Holtmann #define HCI_EV_LE_DIRECT_ADV_REPORT	0x0B
185332c9d43fSMarcel Holtmann struct hci_ev_le_direct_adv_info {
185432c9d43fSMarcel Holtmann 	__u8	 evt_type;
185532c9d43fSMarcel Holtmann 	__u8	 bdaddr_type;
185632c9d43fSMarcel Holtmann 	bdaddr_t bdaddr;
185732c9d43fSMarcel Holtmann 	__u8	 direct_addr_type;
185832c9d43fSMarcel Holtmann 	bdaddr_t direct_addr;
185932c9d43fSMarcel Holtmann 	__s8	 rssi;
186032c9d43fSMarcel Holtmann } __packed;
186132c9d43fSMarcel Holtmann 
18621da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1863a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
18641da177e4SLinus Torvalds struct hci_ev_stack_internal {
18651da177e4SLinus Torvalds 	__u16    type;
18661da177e4SLinus Torvalds 	__u8     data[0];
186766c853ccSGustavo F. Padovan } __packed;
18681da177e4SLinus Torvalds 
18691da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
18701da177e4SLinus Torvalds struct hci_ev_si_device {
18711da177e4SLinus Torvalds 	__u16    event;
18721da177e4SLinus Torvalds 	__u16    dev_id;
187366c853ccSGustavo F. Padovan } __packed;
18741da177e4SLinus Torvalds 
18751da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
18761da177e4SLinus Torvalds struct hci_ev_si_security {
18771da177e4SLinus Torvalds 	__u16    event;
18781da177e4SLinus Torvalds 	__u16    proto;
18791da177e4SLinus Torvalds 	__u16    subproto;
18801da177e4SLinus Torvalds 	__u8     incoming;
188166c853ccSGustavo F. Padovan } __packed;
18821da177e4SLinus Torvalds 
18831da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
18841da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
18851da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
18861da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
18871da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
18881da177e4SLinus Torvalds 
18891da177e4SLinus Torvalds struct hci_command_hdr {
18901ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
18911da177e4SLinus Torvalds 	__u8	plen;
189266c853ccSGustavo F. Padovan } __packed;
18931da177e4SLinus Torvalds 
18941da177e4SLinus Torvalds struct hci_event_hdr {
18951da177e4SLinus Torvalds 	__u8	evt;
18961da177e4SLinus Torvalds 	__u8	plen;
189766c853ccSGustavo F. Padovan } __packed;
18981da177e4SLinus Torvalds 
18991da177e4SLinus Torvalds struct hci_acl_hdr {
19001ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
19011ebb9252SMarcel Holtmann 	__le16	dlen;
190266c853ccSGustavo F. Padovan } __packed;
19031da177e4SLinus Torvalds 
19041da177e4SLinus Torvalds struct hci_sco_hdr {
19051ebb9252SMarcel Holtmann 	__le16	handle;
19061da177e4SLinus Torvalds 	__u8	dlen;
190766c853ccSGustavo F. Padovan } __packed;
19081da177e4SLinus Torvalds 
19092a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
19102a123b86SArnaldo Carvalho de Melo {
19112a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
19122a123b86SArnaldo Carvalho de Melo }
19132a123b86SArnaldo Carvalho de Melo 
19142a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
19152a123b86SArnaldo Carvalho de Melo {
19162a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
19172a123b86SArnaldo Carvalho de Melo }
19182a123b86SArnaldo Carvalho de Melo 
19192a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
19202a123b86SArnaldo Carvalho de Melo {
19212a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
19222a123b86SArnaldo Carvalho de Melo }
19232a123b86SArnaldo Carvalho de Melo 
19241da177e4SLinus Torvalds /* Command opcode pack/unpack */
1925c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
19261da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
19271da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
19281da177e4SLinus Torvalds 
19291da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1930c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
19311da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
19321da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
19331da177e4SLinus Torvalds 
19341da177e4SLinus Torvalds #endif /* __HCI_H */
1935