xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 1471aae0d04d4e0df2bf1e5a5af861e28371b8b4)
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 
105043ec9bfSMarcel Holtmann 	/* When this quirk is set, then a controller that does not
106043ec9bfSMarcel Holtmann 	 * indicate support for Inquiry Result with RSSI is assumed to
107043ec9bfSMarcel Holtmann 	 * support it anyway. Some early Bluetooth 1.2 controllers had
108043ec9bfSMarcel Holtmann 	 * wrongly configured local features that will require forcing
109043ec9bfSMarcel Holtmann 	 * them to enable this mode. Getting RSSI information with the
110043ec9bfSMarcel Holtmann 	 * inquiry responses is preferred since it allows for a better
111043ec9bfSMarcel Holtmann 	 * user expierence.
112043ec9bfSMarcel Holtmann 	 *
113043ec9bfSMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
114043ec9bfSMarcel Holtmann 	 */
115043ec9bfSMarcel Holtmann 	HCI_QUIRK_FIXUP_INQUIRY_MODE,
116043ec9bfSMarcel Holtmann 
117711ffa78SMarcel Holtmann 	/* When this quirk is set, then the HCI Read Local Supported
118711ffa78SMarcel Holtmann 	 * Commands command is not supported. In general Bluetooth 1.2
119711ffa78SMarcel Holtmann 	 * and later controllers should support this command. However
120711ffa78SMarcel Holtmann 	 * some controllers indicate Bluetooth 1.2 support, but do
121711ffa78SMarcel Holtmann 	 * not support this command.
122711ffa78SMarcel Holtmann 	 *
123711ffa78SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
124711ffa78SMarcel Holtmann 	 */
125711ffa78SMarcel Holtmann 	HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
126711ffa78SMarcel Holtmann 
127118305b5SMarcel Holtmann 	/* When this quirk is set, then no stored link key handling
128118305b5SMarcel Holtmann 	 * is performed. This is mainly due to the fact that the
129118305b5SMarcel Holtmann 	 * HCI Delete Stored Link Key command is advertised, but
130118305b5SMarcel Holtmann 	 * not supported.
131118305b5SMarcel Holtmann 	 *
132118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
133118305b5SMarcel Holtmann 	 */
134f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
13589bc22d2SMarcel Holtmann 
136eb1904f4SMarcel Holtmann 	/* When this quirk is set, an external configuration step
137eb1904f4SMarcel Holtmann 	 * is required and will be indicated with the controller
138eb1904f4SMarcel Holtmann 	 * configuation.
139eb1904f4SMarcel Holtmann 	 *
140eb1904f4SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
141eb1904f4SMarcel Holtmann 	 * during the hdev->setup vendor callback.
142eb1904f4SMarcel Holtmann 	 */
143eb1904f4SMarcel Holtmann 	HCI_QUIRK_EXTERNAL_CONFIG,
144eb1904f4SMarcel Holtmann 
14589bc22d2SMarcel Holtmann 	/* When this quirk is set, the public Bluetooth address
14689bc22d2SMarcel Holtmann 	 * initially reported by HCI Read BD Address command
14789bc22d2SMarcel Holtmann 	 * is considered invalid. Controller configuration is
14889bc22d2SMarcel Holtmann 	 * required before this device can be used.
14989bc22d2SMarcel Holtmann 	 *
15089bc22d2SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
15189bc22d2SMarcel Holtmann 	 * during the hdev->setup vendor callback.
15289bc22d2SMarcel Holtmann 	 */
15389bc22d2SMarcel Holtmann 	HCI_QUIRK_INVALID_BDADDR,
15443d6bc46SMarcel Holtmann 
15543d6bc46SMarcel Holtmann 	/* When this quirk is set, the duplicate filtering during
15643d6bc46SMarcel Holtmann 	 * scanning is based on Bluetooth devices addresses. To allow
15743d6bc46SMarcel Holtmann 	 * RSSI based updates, restart scanning if needed.
15843d6bc46SMarcel Holtmann 	 *
15943d6bc46SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
16043d6bc46SMarcel Holtmann 	 * during the hdev->setup vendor callback.
16143d6bc46SMarcel Holtmann 	 */
16243d6bc46SMarcel Holtmann 	HCI_QUIRK_STRICT_DUPLICATE_FILTER,
1631da177e4SLinus Torvalds };
1641da177e4SLinus Torvalds 
1651da177e4SLinus Torvalds /* HCI device flags */
1661da177e4SLinus Torvalds enum {
1671da177e4SLinus Torvalds 	HCI_UP,
1681da177e4SLinus Torvalds 	HCI_INIT,
1691da177e4SLinus Torvalds 	HCI_RUNNING,
1701da177e4SLinus Torvalds 
1711da177e4SLinus Torvalds 	HCI_PSCAN,
1721da177e4SLinus Torvalds 	HCI_ISCAN,
1731da177e4SLinus Torvalds 	HCI_AUTH,
1741da177e4SLinus Torvalds 	HCI_ENCRYPT,
1751da177e4SLinus Torvalds 	HCI_INQUIRY,
1761da177e4SLinus Torvalds 
1771da177e4SLinus Torvalds 	HCI_RAW,
178ab81cbf9SJohan Hedberg 
17910572132SGustavo F. Padovan 	HCI_RESET,
1801da177e4SLinus Torvalds };
1811da177e4SLinus Torvalds 
182f9207338SMarcel Holtmann /* HCI socket flags */
183f9207338SMarcel Holtmann enum {
18450ebc055SMarcel Holtmann 	HCI_SOCK_TRUSTED,
185f9207338SMarcel Holtmann 	HCI_MGMT_INDEX_EVENTS,
186f9207338SMarcel Holtmann 	HCI_MGMT_UNCONF_INDEX_EVENTS,
187ced85549SMarcel Holtmann 	HCI_MGMT_EXT_INDEX_EVENTS,
188f6b7712eSMarcel Holtmann 	HCI_MGMT_GENERIC_EVENTS,
189f9207338SMarcel Holtmann };
190f9207338SMarcel Holtmann 
191d23264a8SAndre Guedes /*
192d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
193d23264a8SAndre Guedes  * states from the controller.
194d23264a8SAndre Guedes  */
195d23264a8SAndre Guedes enum {
196a8b2d5c2SJohan Hedberg 	HCI_SETUP,
197d603b76bSMarcel Holtmann 	HCI_CONFIG,
198a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1995e130367SJohan Hedberg 	HCI_RFKILLED,
200a8b2d5c2SJohan Hedberg 	HCI_MGMT,
201b6ae8457SJohan Hedberg 	HCI_BONDABLE,
202a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
2030663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
2043769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
20594324962SJohan Hovold 	HCI_UNREGISTER,
2064a964404SMarcel Holtmann 	HCI_UNCONFIGURED,
2070736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
208dbece37aSMarcel Holtmann 	HCI_EXT_CONFIGURED,
20966c417c1SJohan Hedberg 	HCI_LE_ADV,
210d23264a8SAndre Guedes 	HCI_LE_SCAN,
21184bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
212e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
213134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
214863efaf2SJohan Hedberg 	HCI_PRIVACY,
215d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
21641edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
2176d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
21806199cf8SJohan Hedberg 	HCI_LE_ENABLED,
219f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
220cc91cb04SMarcel Holtmann 	HCI_ADVERTISING_CONNECTABLE,
2215e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
2225e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
2236acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
22447990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
22521693c15SAndre Guedes 	HCI_PERIODIC_INQ,
2261a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
22756f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
22881ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
229b7cb93e5SMarcel Holtmann 
230b7cb93e5SMarcel Holtmann 	HCI_DUT_MODE,
231b7cb93e5SMarcel Holtmann 	HCI_FORCE_BREDR_SMP,
232b7cb93e5SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
233b7cb93e5SMarcel Holtmann 
234eacb44dfSMarcel Holtmann 	__HCI_NUM_FLAGS,
235d23264a8SAndre Guedes };
236d23264a8SAndre Guedes 
2371da177e4SLinus Torvalds /* HCI timeouts */
2385f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2395f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
2405f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
241d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
2425f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
2439345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
244a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
2459489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
24609ae260bSJohan Hedberg #define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2471da177e4SLinus Torvalds 
2485b7f9909SMarcel Holtmann /* HCI data types */
2491da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
2501da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
2511da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
2521da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
2531da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2541da177e4SLinus Torvalds 
2555b7f9909SMarcel Holtmann /* HCI packet types */
2561da177e4SLinus Torvalds #define HCI_DM1		0x0008
2571da177e4SLinus Torvalds #define HCI_DM3		0x0400
2581da177e4SLinus Torvalds #define HCI_DM5		0x4000
2591da177e4SLinus Torvalds #define HCI_DH1		0x0010
2601da177e4SLinus Torvalds #define HCI_DH3		0x0800
2611da177e4SLinus Torvalds #define HCI_DH5		0x8000
2621da177e4SLinus Torvalds 
2631da177e4SLinus Torvalds #define HCI_HV1		0x0020
2641da177e4SLinus Torvalds #define HCI_HV2		0x0040
2651da177e4SLinus Torvalds #define HCI_HV3		0x0080
2661da177e4SLinus Torvalds 
2671da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2681da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2691da177e4SLinus Torvalds 
2705b7f9909SMarcel Holtmann /* eSCO packet types */
2715b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2725b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2735b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2745b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2755b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2765b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
277efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
278efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
279efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
280efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2815b7f9909SMarcel Holtmann 
282a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
283efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
284a8746417SMarcel Holtmann 
2851da177e4SLinus Torvalds /* ACL flags */
286e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2871da177e4SLinus Torvalds #define ACL_CONT		0x01
2881da177e4SLinus Torvalds #define ACL_START		0x02
289d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2901da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2911da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2921da177e4SLinus Torvalds 
2931da177e4SLinus Torvalds /* Baseband links */
2941da177e4SLinus Torvalds #define SCO_LINK	0x00
2951da177e4SLinus Torvalds #define ACL_LINK	0x01
2965b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
297fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
298fcd89c09SVille Tervo #define LE_LINK		0x80
2993161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
300845472e8SMarcel Holtmann #define INVALID_LINK	0xff
3011da177e4SLinus Torvalds 
3021da177e4SLinus Torvalds /* LMP features */
3031da177e4SLinus Torvalds #define LMP_3SLOT	0x01
3041da177e4SLinus Torvalds #define LMP_5SLOT	0x02
3051da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
3061da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
3071da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
3081da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
3091da177e4SLinus Torvalds #define LMP_HOLD	0x40
31004837f64SMarcel Holtmann #define LMP_SNIFF	0x80
3111da177e4SLinus Torvalds 
3121da177e4SLinus Torvalds #define LMP_PARK	0x01
3131da177e4SLinus Torvalds #define LMP_RSSI	0x02
3141da177e4SLinus Torvalds #define LMP_QUALITY	0x04
3151da177e4SLinus Torvalds #define LMP_SCO		0x08
3161da177e4SLinus Torvalds #define LMP_HV2		0x10
3171da177e4SLinus Torvalds #define LMP_HV3		0x20
3181da177e4SLinus Torvalds #define LMP_ULAW	0x40
3191da177e4SLinus Torvalds #define LMP_ALAW	0x80
3201da177e4SLinus Torvalds 
3211da177e4SLinus Torvalds #define LMP_CVSD	0x01
3221da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
3231da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
32407a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
3251da177e4SLinus Torvalds 
326d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
3275b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
3285b7f9909SMarcel Holtmann 
3295b7f9909SMarcel Holtmann #define LMP_EV4		0x01
3305b7f9909SMarcel Holtmann #define LMP_EV5		0x02
33169ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
332d5859e22SJohan Hedberg #define LMP_LE		0x40
3335b7f9909SMarcel Holtmann 
33404837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
335d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
336efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
337efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
338efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
33904837f64SMarcel Holtmann 
340d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
341e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
342769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
343e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
344769be974SMarcel Holtmann 
345d5859e22SJohan Hedberg #define LMP_LSTO	0x01
346d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
347971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
348d5859e22SJohan Hedberg 
349eead27daSAndre Guedes /* Extended LMP features */
35053b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
35153b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
35253b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
35353b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
35453b834d2SMarcel Holtmann 
355d5991585SMarcel Holtmann #define LMP_SC		0x01
356d5991585SMarcel Holtmann #define LMP_PING	0x02
357d5991585SMarcel Holtmann 
35853b834d2SMarcel Holtmann /* Host features */
359cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
360eead27daSAndre Guedes #define LMP_HOST_LE		0x02
361cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
362d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
363eead27daSAndre Guedes 
364662bc2e6SAndre Guedes /* LE features */
3650da71f1bSMarcel Holtmann #define HCI_LE_ENCRYPTION		0x01
366662bc2e6SAndre Guedes #define HCI_LE_CONN_PARAM_REQ_PROC	0x02
367cd7ca0ecSMarcel Holtmann #define HCI_LE_PING			0x10
36894a3bd02SMarcel Holtmann #define HCI_LE_DATA_LEN_EXT		0x20
3694b71bba4SMarcel Holtmann #define HCI_LE_EXT_SCAN_POLICY		0x80
370662bc2e6SAndre Guedes 
37104837f64SMarcel Holtmann /* Connection modes */
37204837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
37304837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
37404837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
37504837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
37604837f64SMarcel Holtmann 
3771da177e4SLinus Torvalds /* Link policies */
3781da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3791da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3801da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3811da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3821da177e4SLinus Torvalds 
38304837f64SMarcel Holtmann /* Link modes */
3841da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3851da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3861da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3871da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3881da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3891da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3901da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
3917b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
3921da177e4SLinus Torvalds 
39340be492fSMarcel Holtmann /* Authentication types */
39440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
39540be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
39640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
39740be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
39840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
39940be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
40040be492fSMarcel Holtmann 
401a77b15a6SMikel Astiz /* I/O capabilities */
402a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
403a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
404a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
405a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
406a77b15a6SMikel Astiz 
407b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
408b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
409b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
410b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
411b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
41211015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
41311015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
414b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
41511015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
41611015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
417b6020ba0SWaldemar Rymarkiewicz 
4189f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
4198e75b46aSAndre Guedes #define HCI_ERROR_UNKNOWN_CONN_ID	0x02
4209f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
4212acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
422cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
423d41c15cfSJohan Hedberg #define HCI_ERROR_REJ_LIMITED_RESOURCES	0x0d
4249f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
4259f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
426cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
427cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
4289f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
4299f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
4308e75b46aSAndre Guedes #define HCI_ERROR_INVALID_LL_PARAMS	0x1E
4313c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
4329f5a0d7bSAndrei Emeltchenko 
4332455a3eaSAndrei Emeltchenko /* Flow control modes */
4342455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
4352455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
4362455a3eaSAndrei Emeltchenko 
437bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
438bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
439a89612aaSMarcel Holtmann #define HCI_RSSI_INVALID	127
440bbaf444aSJohan Hedberg 
441ba165a90SJohan Hedberg #define HCI_ROLE_MASTER		0x00
442ba165a90SJohan Hedberg #define HCI_ROLE_SLAVE		0x01
443ba165a90SJohan Hedberg 
44432748db0SJohan Hedberg /* Extended Inquiry Response field types */
44532748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
44632748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
44732748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
44832748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
44932748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
45032748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
45132748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
45232748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
45332748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
45432748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
4559ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
4569ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
4579ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
45832748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
459*1471aae0SMarcel Holtmann #define EIR_LE_BDADDR		0x1B /* LE Bluetooth device address */
460*1471aae0SMarcel Holtmann #define EIR_LE_ROLE		0x1C /* LE role */
46132748db0SJohan Hedberg 
4623f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
4633f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
4643f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
4653f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
4663f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
4673f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
4683f0f524bSJohan Hedberg 
4691da177e4SLinus Torvalds /* -----  HCI Commands ---- */
4706bd32326SVille Tervo #define HCI_OP_NOP			0x0000
4716bd32326SVille Tervo 
472a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
473a9de9248SMarcel Holtmann struct hci_cp_inquiry {
474a9de9248SMarcel Holtmann 	__u8     lap[3];
475a9de9248SMarcel Holtmann 	__u8     length;
476a9de9248SMarcel Holtmann 	__u8     num_rsp;
47766c853ccSGustavo F. Padovan } __packed;
4781da177e4SLinus Torvalds 
479a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
480a9de9248SMarcel Holtmann 
48179d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
48279d6e068SAndre Guedes 
483a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
484a9de9248SMarcel Holtmann 
485a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
486a9de9248SMarcel Holtmann struct hci_cp_create_conn {
487a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
488a9de9248SMarcel Holtmann 	__le16   pkt_type;
489a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
490a9de9248SMarcel Holtmann 	__u8     pscan_mode;
491a9de9248SMarcel Holtmann 	__le16   clock_offset;
492a9de9248SMarcel Holtmann 	__u8     role_switch;
49366c853ccSGustavo F. Padovan } __packed;
4941da177e4SLinus Torvalds 
495a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
496a9de9248SMarcel Holtmann struct hci_cp_disconnect {
497a9de9248SMarcel Holtmann 	__le16   handle;
498a9de9248SMarcel Holtmann 	__u8     reason;
49966c853ccSGustavo F. Padovan } __packed;
5001da177e4SLinus Torvalds 
501a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
502a9de9248SMarcel Holtmann struct hci_cp_add_sco {
503a9de9248SMarcel Holtmann 	__le16   handle;
504a9de9248SMarcel Holtmann 	__le16   pkt_type;
50566c853ccSGustavo F. Padovan } __packed;
506a9de9248SMarcel Holtmann 
507a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
508a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
5091da177e4SLinus Torvalds 	bdaddr_t bdaddr;
51066c853ccSGustavo F. Padovan } __packed;
5111da177e4SLinus Torvalds 
512a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
513a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
514a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
515a9de9248SMarcel Holtmann 	__u8     role;
51666c853ccSGustavo F. Padovan } __packed;
5171da177e4SLinus Torvalds 
518a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
519a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
520a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
521a9de9248SMarcel Holtmann 	__u8     reason;
52266c853ccSGustavo F. Padovan } __packed;
5231da177e4SLinus Torvalds 
524a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
525a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
526a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
5279b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
52866c853ccSGustavo F. Padovan } __packed;
5291da177e4SLinus Torvalds 
530a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
531a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
532a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
53366c853ccSGustavo F. Padovan } __packed;
5341da177e4SLinus Torvalds 
535a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
536a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
537a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
538a9de9248SMarcel Holtmann 	__u8     pin_len;
539a9de9248SMarcel Holtmann 	__u8     pin_code[16];
54066c853ccSGustavo F. Padovan } __packed;
541980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
542980e1a53SJohan Hedberg 	__u8     status;
543980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
544980e1a53SJohan Hedberg } __packed;
545a9de9248SMarcel Holtmann 
546a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
547a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
548a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
54966c853ccSGustavo F. Padovan } __packed;
550980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
551980e1a53SJohan Hedberg 	__u8     status;
552980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
553980e1a53SJohan Hedberg } __packed;
554a9de9248SMarcel Holtmann 
555a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
556a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
557a9de9248SMarcel Holtmann 	__le16   handle;
558a9de9248SMarcel Holtmann 	__le16   pkt_type;
55966c853ccSGustavo F. Padovan } __packed;
560a9de9248SMarcel Holtmann 
561a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
562a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
563a9de9248SMarcel Holtmann 	__le16   handle;
56466c853ccSGustavo F. Padovan } __packed;
565a9de9248SMarcel Holtmann 
566a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
567a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
568a9de9248SMarcel Holtmann 	__le16   handle;
569a9de9248SMarcel Holtmann 	__u8     encrypt;
57066c853ccSGustavo F. Padovan } __packed;
571a9de9248SMarcel Holtmann 
572a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
573a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
574a9de9248SMarcel Holtmann 	__le16   handle;
57566c853ccSGustavo F. Padovan } __packed;
576a9de9248SMarcel Holtmann 
577a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
578a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
579a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
580a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
581a9de9248SMarcel Holtmann 	__u8     pscan_mode;
582a9de9248SMarcel Holtmann 	__le16   clock_offset;
58366c853ccSGustavo F. Padovan } __packed;
584a9de9248SMarcel Holtmann 
585a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
586a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
587a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
58866c853ccSGustavo F. Padovan } __packed;
589a9de9248SMarcel Holtmann 
590a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
591a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
592a9de9248SMarcel Holtmann 	__le16   handle;
59366c853ccSGustavo F. Padovan } __packed;
594a9de9248SMarcel Holtmann 
595a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
596a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
597a9de9248SMarcel Holtmann 	__le16   handle;
598a9de9248SMarcel Holtmann 	__u8     page;
59966c853ccSGustavo F. Padovan } __packed;
600a9de9248SMarcel Holtmann 
601a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
602a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
603a9de9248SMarcel Holtmann 	__le16   handle;
60466c853ccSGustavo F. Padovan } __packed;
605a9de9248SMarcel Holtmann 
606df935429SMarcel Holtmann #define HCI_OP_READ_CLOCK_OFFSET	0x041f
607df935429SMarcel Holtmann struct hci_cp_read_clock_offset {
608df935429SMarcel Holtmann 	__le16   handle;
609df935429SMarcel Holtmann } __packed;
610df935429SMarcel Holtmann 
611a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
612a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
613a9de9248SMarcel Holtmann 	__le16   handle;
614a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
615a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
616a9de9248SMarcel Holtmann 	__le16   max_latency;
617a9de9248SMarcel Holtmann 	__le16   voice_setting;
618a9de9248SMarcel Holtmann 	__u8     retrans_effort;
619a9de9248SMarcel Holtmann 	__le16   pkt_type;
62066c853ccSGustavo F. Padovan } __packed;
621a9de9248SMarcel Holtmann 
622a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
623a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
624a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
625a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
626a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
627a9de9248SMarcel Holtmann 	__le16   max_latency;
628a9de9248SMarcel Holtmann 	__le16   content_format;
629a9de9248SMarcel Holtmann 	__u8     retrans_effort;
630a9de9248SMarcel Holtmann 	__le16   pkt_type;
63166c853ccSGustavo F. Padovan } __packed;
632a9de9248SMarcel Holtmann 
633a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
634a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
635a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
636a9de9248SMarcel Holtmann 	__u8     reason;
63766c853ccSGustavo F. Padovan } __packed;
638a9de9248SMarcel Holtmann 
63917fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
64017fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
64117fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
64217fa4b9dSJohan Hedberg 	__u8     capability;
64317fa4b9dSJohan Hedberg 	__u8     oob_data;
64417fa4b9dSJohan Hedberg 	__u8     authentication;
64517fa4b9dSJohan Hedberg } __packed;
64617fa4b9dSJohan Hedberg 
647a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
648a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
649a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
650a5c29683SJohan Hedberg } __packed;
651a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
652a5c29683SJohan Hedberg 	__u8     status;
653a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
654a5c29683SJohan Hedberg } __packed;
655a5c29683SJohan Hedberg 
656a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
657a5c29683SJohan Hedberg 
6589ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
6599ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
6609ad4019aSBrian Gix 	bdaddr_t bdaddr;
6619ad4019aSBrian Gix 	__le32	passkey;
6629ad4019aSBrian Gix } __packed;
6639ad4019aSBrian Gix 
6649ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
6659ad4019aSBrian Gix 
6662763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
6672763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
6682763eda6SSzymon Janc 	bdaddr_t bdaddr;
6692763eda6SSzymon Janc 	__u8     hash[16];
67038da1703SJohan Hedberg 	__u8     rand[16];
6712763eda6SSzymon Janc } __packed;
6722763eda6SSzymon Janc 
6732763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
6742763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
6752763eda6SSzymon Janc 	bdaddr_t bdaddr;
6762763eda6SSzymon Janc } __packed;
6772763eda6SSzymon Janc 
67803b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
67903b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
68003b555e1SJohan Hedberg 	bdaddr_t bdaddr;
68103b555e1SJohan Hedberg 	__u8     reason;
68203b555e1SJohan Hedberg } __packed;
68303b555e1SJohan Hedberg 
684523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
685523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
686523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
687523e93cdSAndrei Emeltchenko 	__u8     key_len;
688523e93cdSAndrei Emeltchenko 	__u8     key_type;
689523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
690523e93cdSAndrei Emeltchenko } __packed;
691523e93cdSAndrei Emeltchenko 
692523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
693523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
694523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
695523e93cdSAndrei Emeltchenko 	__u8     key_len;
696523e93cdSAndrei Emeltchenko 	__u8     key_type;
697523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
698523e93cdSAndrei Emeltchenko } __packed;
699523e93cdSAndrei Emeltchenko 
700523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
701523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
702523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
703523e93cdSAndrei Emeltchenko 	__u8     reason;
704b078b564SAndrei Emeltchenko } __packed;
705b078b564SAndrei Emeltchenko 
706b078b564SAndrei Emeltchenko struct ext_flow_spec {
707b078b564SAndrei Emeltchenko 	__u8       id;
708b078b564SAndrei Emeltchenko 	__u8       stype;
709b078b564SAndrei Emeltchenko 	__le16     msdu;
710b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
711b078b564SAndrei Emeltchenko 	__le32     acc_lat;
712b078b564SAndrei Emeltchenko 	__le32     flush_to;
713b078b564SAndrei Emeltchenko } __packed;
714b078b564SAndrei Emeltchenko 
715b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
716b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
717b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
718b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
719b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
720b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
721b078b564SAndrei Emeltchenko } __packed;
722b078b564SAndrei Emeltchenko 
723b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
724b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
725b078b564SAndrei Emeltchenko 	__le16   log_handle;
726b078b564SAndrei Emeltchenko } __packed;
727b078b564SAndrei Emeltchenko 
728b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
729b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
730b078b564SAndrei Emeltchenko 	__u8     phy_handle;
731b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
732b078b564SAndrei Emeltchenko } __packed;
733b078b564SAndrei Emeltchenko 
734b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
735b078b564SAndrei Emeltchenko 	__u8     status;
736b078b564SAndrei Emeltchenko 	__u8     phy_handle;
737b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
738523e93cdSAndrei Emeltchenko } __packed;
739523e93cdSAndrei Emeltchenko 
7408c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
7418c9a041bSDoHyun Pyun struct hci_cp_set_csb {
7428c9a041bSDoHyun Pyun 	__u8	enable;
7438c9a041bSDoHyun Pyun 	__u8	lt_addr;
7448c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
7458c9a041bSDoHyun Pyun 	__le16	packet_type;
7468c9a041bSDoHyun Pyun 	__le16	interval_min;
7478c9a041bSDoHyun Pyun 	__le16	interval_max;
7488c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
7498c9a041bSDoHyun Pyun } __packed;
7508c9a041bSDoHyun Pyun struct hci_rp_set_csb {
7518c9a041bSDoHyun Pyun 	__u8	status;
7528c9a041bSDoHyun Pyun 	__u8	lt_addr;
7538c9a041bSDoHyun Pyun 	__le16	interval;
7548c9a041bSDoHyun Pyun } __packed;
7558c9a041bSDoHyun Pyun 
756cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
757cefded98SDoHyun Pyun 
758e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
759e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
760e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
761e2f99131SMarcel Holtmann 	__u8     hash192[16];
76238da1703SJohan Hedberg 	__u8     rand192[16];
763e2f99131SMarcel Holtmann 	__u8     hash256[16];
76438da1703SJohan Hedberg 	__u8     rand256[16];
765e2f99131SMarcel Holtmann } __packed;
766e2f99131SMarcel Holtmann 
767a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
768a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
769a9de9248SMarcel Holtmann 	__le16   handle;
770a9de9248SMarcel Holtmann 	__le16   max_interval;
771a9de9248SMarcel Holtmann 	__le16   min_interval;
772a9de9248SMarcel Holtmann 	__le16   attempt;
773a9de9248SMarcel Holtmann 	__le16   timeout;
77466c853ccSGustavo F. Padovan } __packed;
775a9de9248SMarcel Holtmann 
776a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
777a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
778a9de9248SMarcel Holtmann 	__le16   handle;
77966c853ccSGustavo F. Padovan } __packed;
780a9de9248SMarcel Holtmann 
781a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
782a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
783a9de9248SMarcel Holtmann 	__le16   handle;
78466c853ccSGustavo F. Padovan } __packed;
785a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
786a9de9248SMarcel Holtmann 	__u8     status;
787a9de9248SMarcel Holtmann 	__le16   handle;
788a9de9248SMarcel Holtmann 	__u8     role;
78966c853ccSGustavo F. Padovan } __packed;
790a9de9248SMarcel Holtmann 
791a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
792a9de9248SMarcel Holtmann struct hci_cp_switch_role {
793a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
794a9de9248SMarcel Holtmann 	__u8     role;
79566c853ccSGustavo F. Padovan } __packed;
796a9de9248SMarcel Holtmann 
797a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
798a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
799a9de9248SMarcel Holtmann 	__le16   handle;
80066c853ccSGustavo F. Padovan } __packed;
801a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
802a9de9248SMarcel Holtmann 	__u8     status;
803a9de9248SMarcel Holtmann 	__le16   handle;
804a9de9248SMarcel Holtmann 	__le16   policy;
80566c853ccSGustavo F. Padovan } __packed;
806a9de9248SMarcel Holtmann 
807a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
808a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
809a9de9248SMarcel Holtmann 	__le16   handle;
810a9de9248SMarcel Holtmann 	__le16   policy;
81166c853ccSGustavo F. Padovan } __packed;
812a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
813a9de9248SMarcel Holtmann 	__u8     status;
814a9de9248SMarcel Holtmann 	__le16   handle;
81566c853ccSGustavo F. Padovan } __packed;
816a9de9248SMarcel Holtmann 
817e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
818e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
819e4e8e37cSMarcel Holtmann 	__u8     status;
820e4e8e37cSMarcel Holtmann 	__le16   policy;
82166c853ccSGustavo F. Padovan } __packed;
822e4e8e37cSMarcel Holtmann 
823e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
824e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
825e4e8e37cSMarcel Holtmann 	__le16   policy;
82666c853ccSGustavo F. Padovan } __packed;
827e4e8e37cSMarcel Holtmann 
828a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
829a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
830a9de9248SMarcel Holtmann 	__le16   handle;
831a9de9248SMarcel Holtmann 	__le16   max_latency;
832a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
833a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
83466c853ccSGustavo F. Padovan } __packed;
835a9de9248SMarcel Holtmann 
836a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
837a9de9248SMarcel Holtmann 
838a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
839a9de9248SMarcel Holtmann 
840a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
8411da177e4SLinus Torvalds struct hci_cp_set_event_flt {
8421da177e4SLinus Torvalds 	__u8     flt_type;
8431da177e4SLinus Torvalds 	__u8     cond_type;
8441da177e4SLinus Torvalds 	__u8     condition[0];
84566c853ccSGustavo F. Padovan } __packed;
8461da177e4SLinus Torvalds 
8471da177e4SLinus Torvalds /* Filter types */
8481da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
8491da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
8501da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
8511da177e4SLinus Torvalds 
8521da177e4SLinus Torvalds /* CONN_SETUP Condition types */
8531da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
8541da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
8551da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
8561da177e4SLinus Torvalds 
8571da177e4SLinus Torvalds /* CONN_SETUP Conditions */
8581da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
8591da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
8601da177e4SLinus Torvalds 
861cb962780SMarcel Holtmann #define HCI_OP_READ_STORED_LINK_KEY	0x0c0d
862cb962780SMarcel Holtmann struct hci_cp_read_stored_link_key {
863cb962780SMarcel Holtmann 	bdaddr_t bdaddr;
864cb962780SMarcel Holtmann 	__u8     read_all;
865cb962780SMarcel Holtmann } __packed;
866cb962780SMarcel Holtmann struct hci_rp_read_stored_link_key {
867cb962780SMarcel Holtmann 	__u8     status;
868cb962780SMarcel Holtmann 	__u8     max_keys;
869cb962780SMarcel Holtmann 	__u8     num_keys;
870cb962780SMarcel Holtmann } __packed;
871cb962780SMarcel Holtmann 
872b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
873b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
874b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
875b0916ea0SJohan Hedberg 	__u8     delete_all;
876b0916ea0SJohan Hedberg } __packed;
877039d4e41SMarcel Holtmann struct hci_rp_delete_stored_link_key {
878039d4e41SMarcel Holtmann 	__u8     status;
879039d4e41SMarcel Holtmann 	__u8     num_keys;
880039d4e41SMarcel Holtmann } __packed;
881b0916ea0SJohan Hedberg 
8821f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
8831f6c6378SJohan Hedberg 
884a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
885a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
8861f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
88766c853ccSGustavo F. Padovan } __packed;
888a9de9248SMarcel Holtmann 
889a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
890a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
891a9de9248SMarcel Holtmann 	__u8     status;
8921f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
89366c853ccSGustavo F. Padovan } __packed;
894a9de9248SMarcel Holtmann 
895a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
896a9de9248SMarcel Holtmann 
897a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
898a9de9248SMarcel Holtmann 
899a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
900a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
901a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
902a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
903a9de9248SMarcel Holtmann 
904a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
905a9de9248SMarcel Holtmann 
906a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
907a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
908a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
909a9de9248SMarcel Holtmann 
910a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
911a9de9248SMarcel Holtmann 
912a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
913a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
914a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
915a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
916a9de9248SMarcel Holtmann 
917a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
918a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
9191da177e4SLinus Torvalds 	__u8     status;
9201da177e4SLinus Torvalds 	__u8     dev_class[3];
92166c853ccSGustavo F. Padovan } __packed;
9221da177e4SLinus Torvalds 
923a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
924a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
9251da177e4SLinus Torvalds 	__u8     dev_class[3];
92666c853ccSGustavo F. Padovan } __packed;
9271da177e4SLinus Torvalds 
928a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
9291da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
9301da177e4SLinus Torvalds 	__u8     status;
9311ebb9252SMarcel Holtmann 	__le16   voice_setting;
93266c853ccSGustavo F. Padovan } __packed;
9331da177e4SLinus Torvalds 
934a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
9351da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
9361ebb9252SMarcel Holtmann 	__le16   voice_setting;
93766c853ccSGustavo F. Padovan } __packed;
9381da177e4SLinus Torvalds 
939a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
9401da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
9411ebb9252SMarcel Holtmann 	__le16   acl_mtu;
9421da177e4SLinus Torvalds 	__u8     sco_mtu;
9431ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
9441ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
94566c853ccSGustavo F. Padovan } __packed;
9461da177e4SLinus Torvalds 
947b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
948b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
949b4cb9fb2SMarcel Holtmann 	__u8	status;
950b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
951b4cb9fb2SMarcel Holtmann } __packed;
952b4cb9fb2SMarcel Holtmann 
9534b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
9544b836f39SMarcel Holtmann 
9553d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
9563d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
9573d505312SMarcel Holtmann 	__u8	num_iac;
9583d505312SMarcel Holtmann 	__u8	iac_lap[6];
9593d505312SMarcel Holtmann } __packed;
9603d505312SMarcel Holtmann 
961d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
962d5859e22SJohan Hedberg 
96380a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
96480a1e1dbSJohan Hedberg 
96580a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
96680a1e1dbSJohan Hedberg struct hci_cp_write_eir {
967816a11d5SJohan Hedberg 	__u8	fec;
968816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
96980a1e1dbSJohan Hedberg } __packed;
97080a1e1dbSJohan Hedberg 
971333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
972333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
973333140b5SMarcel Holtmann 	__u8     status;
974333140b5SMarcel Holtmann 	__u8     mode;
97566c853ccSGustavo F. Padovan } __packed;
976333140b5SMarcel Holtmann 
977333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
978333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
979333140b5SMarcel Holtmann 	__u8     mode;
98066c853ccSGustavo F. Padovan } __packed;
981333140b5SMarcel Holtmann 
982c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
983c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
984c35938b2SSzymon Janc 	__u8     status;
985c35938b2SSzymon Janc 	__u8     hash[16];
98638da1703SJohan Hedberg 	__u8     rand[16];
987c35938b2SSzymon Janc } __packed;
988c35938b2SSzymon Janc 
989d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
99091c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
99191c4e9b1SMarcel Holtmann 	__u8     status;
99291c4e9b1SMarcel Holtmann 	__s8     tx_power;
99391c4e9b1SMarcel Holtmann } __packed;
994d5859e22SJohan Hedberg 
995d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
996d62e6d67SJohan Hedberg 
9977528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
9987528ca1cSMarcel Holtmann 
9991e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
10001e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
10011e89cffbSAndrei Emeltchenko 	__u8     status;
10021e89cffbSAndrei Emeltchenko 	__u8     mode;
10031e89cffbSAndrei Emeltchenko } __packed;
10041e89cffbSAndrei Emeltchenko 
1005f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
1006f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
1007f9b49306SAndre Guedes 	__u8	le;
1008f9b49306SAndre Guedes 	__u8	simul;
1009f9b49306SAndre Guedes } __packed;
1010f9b49306SAndre Guedes 
1011d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
1012d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
1013d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1014d0bf75a5SDoHyun Pyun } __packed;
1015d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
1016d0bf75a5SDoHyun Pyun 	__u8	status;
1017d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1018d0bf75a5SDoHyun Pyun } __packed;
1019d0bf75a5SDoHyun Pyun 
10206a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
10216a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
10226a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10236a20eaf4SDoHyun Pyun } __packed;
10246a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
10256a20eaf4SDoHyun Pyun 	__u8	status;
10266a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10276a20eaf4SDoHyun Pyun } __packed;
10286a20eaf4SDoHyun Pyun 
10297d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
10307d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
10317d1dab49SDoHyun Pyun 	__u8	lt_addr;
10327d1dab49SDoHyun Pyun 	__u8	fragment;
10337d1dab49SDoHyun Pyun 	__u8	data_length;
10347d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
10357d1dab49SDoHyun Pyun } __packed;
10367d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
10377d1dab49SDoHyun Pyun 	__u8	status;
10387d1dab49SDoHyun Pyun 	__u8	lt_addr;
10397d1dab49SDoHyun Pyun } __packed;
10407d1dab49SDoHyun Pyun 
10415d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
10425d4e7e8dSJohan Hedberg 
1043a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
1044a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
1045a9b07a64SDoHyun Pyun 	__le16	interval_min;
1046a9b07a64SDoHyun Pyun 	__le16	interval_max;
1047a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
1048a9b07a64SDoHyun Pyun 	__u8	service_data;
1049a9b07a64SDoHyun Pyun } __packed;
1050a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
1051a9b07a64SDoHyun Pyun 	__u8	status;
1052a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
1053a9b07a64SDoHyun Pyun } __packed;
1054a9b07a64SDoHyun Pyun 
1055eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
1056eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
1057eb4b95c6SMarcel Holtmann 	__u8	status;
1058eb4b95c6SMarcel Holtmann 	__u8	support;
1059eb4b95c6SMarcel Holtmann } __packed;
1060eb4b95c6SMarcel Holtmann 
1061eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
1062eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
1063eb4b95c6SMarcel Holtmann 	__u8	support;
1064eb4b95c6SMarcel Holtmann } __packed;
1065eb4b95c6SMarcel Holtmann 
1066e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
1067e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
1068e2f99131SMarcel Holtmann 	__u8     status;
1069e2f99131SMarcel Holtmann 	__u8     hash192[16];
107038da1703SJohan Hedberg 	__u8     rand192[16];
1071e2f99131SMarcel Holtmann 	__u8     hash256[16];
107238da1703SJohan Hedberg 	__u8     rand256[16];
1073e2f99131SMarcel Holtmann } __packed;
1074e2f99131SMarcel Holtmann 
1075a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
1076a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
10771da177e4SLinus Torvalds 	__u8     status;
1078a9de9248SMarcel Holtmann 	__u8     hci_ver;
1079a9de9248SMarcel Holtmann 	__le16   hci_rev;
1080a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1081a9de9248SMarcel Holtmann 	__le16   manufacturer;
1082a9de9248SMarcel Holtmann 	__le16   lmp_subver;
108366c853ccSGustavo F. Padovan } __packed;
10841da177e4SLinus Torvalds 
1085a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
1086a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
10871da177e4SLinus Torvalds 	__u8     status;
1088a9de9248SMarcel Holtmann 	__u8     commands[64];
108966c853ccSGustavo F. Padovan } __packed;
10901da177e4SLinus Torvalds 
1091a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1092a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1093a9de9248SMarcel Holtmann 	__u8     status;
1094a9de9248SMarcel Holtmann 	__u8     features[8];
109566c853ccSGustavo F. Padovan } __packed;
1096a9de9248SMarcel Holtmann 
1097a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1098971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1099971e3a4bSAndre Guedes 	__u8     page;
1100971e3a4bSAndre Guedes } __packed;
1101a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1102a9de9248SMarcel Holtmann 	__u8     status;
1103a9de9248SMarcel Holtmann 	__u8     page;
1104a9de9248SMarcel Holtmann 	__u8     max_page;
1105a9de9248SMarcel Holtmann 	__u8     features[8];
110666c853ccSGustavo F. Padovan } __packed;
1107a9de9248SMarcel Holtmann 
1108a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1109a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1110a9de9248SMarcel Holtmann 	__u8     status;
1111a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1112a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1113a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1114a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
111566c853ccSGustavo F. Padovan } __packed;
1116a9de9248SMarcel Holtmann 
1117a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1118a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1119a9de9248SMarcel Holtmann 	__u8     status;
11201da177e4SLinus Torvalds 	bdaddr_t bdaddr;
112166c853ccSGustavo F. Padovan } __packed;
11221da177e4SLinus Torvalds 
1123350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1124350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1125350ee4cfSAndrei Emeltchenko 	__u8     status;
1126350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1127350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1128350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1129350ee4cfSAndrei Emeltchenko } __packed;
1130350ee4cfSAndrei Emeltchenko 
1131109e3191SMarcel Holtmann #define HCI_OP_READ_LOCAL_CODECS	0x100b
1132109e3191SMarcel Holtmann 
1133f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1134f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1135f332ec66SJohan Hedberg 	__u8     status;
1136f332ec66SJohan Hedberg 	__le16   interval;
1137f332ec66SJohan Hedberg 	__le16   window;
1138f332ec66SJohan Hedberg } __packed;
1139f332ec66SJohan Hedberg 
1140f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1141f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1142f6422ec6SAntti Julku 	__le16   interval;
1143f6422ec6SAntti Julku 	__le16   window;
1144f6422ec6SAntti Julku } __packed;
1145f6422ec6SAntti Julku 
11465a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
11475a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
11485a134faeSAndrzej Kaczmarek 	__le16   handle;
11495a134faeSAndrzej Kaczmarek 	__u8     type;
11505a134faeSAndrzej Kaczmarek } __packed;
11515a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
11525a134faeSAndrzej Kaczmarek 	__u8     status;
11535a134faeSAndrzej Kaczmarek 	__le16   handle;
11545a134faeSAndrzej Kaczmarek 	__s8     tx_power;
11555a134faeSAndrzej Kaczmarek } __packed;
11565a134faeSAndrzej Kaczmarek 
1157f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1158f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1159f332ec66SJohan Hedberg 	__u8     status;
1160f332ec66SJohan Hedberg 	__u8     type;
1161f332ec66SJohan Hedberg } __packed;
1162f332ec66SJohan Hedberg 
1163f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1164f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1165f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1166f6422ec6SAntti Julku 
11675ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
11685ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
11695ae76a94SAndrzej Kaczmarek 	__le16   handle;
11705ae76a94SAndrzej Kaczmarek } __packed;
11715ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
11725ae76a94SAndrzej Kaczmarek 	__u8     status;
11735ae76a94SAndrzej Kaczmarek 	__le16   handle;
11745ae76a94SAndrzej Kaczmarek 	__s8     rssi;
11755ae76a94SAndrzej Kaczmarek } __packed;
11765ae76a94SAndrzej Kaczmarek 
117733f35721SJohan Hedberg #define HCI_OP_READ_CLOCK		0x1407
117833f35721SJohan Hedberg struct hci_cp_read_clock {
117933f35721SJohan Hedberg 	__le16   handle;
118033f35721SJohan Hedberg 	__u8     which;
118133f35721SJohan Hedberg } __packed;
118233f35721SJohan Hedberg struct hci_rp_read_clock {
118333f35721SJohan Hedberg 	__u8     status;
118433f35721SJohan Hedberg 	__le16   handle;
118533f35721SJohan Hedberg 	__le32   clock;
118633f35721SJohan Hedberg 	__le16   accuracy;
118733f35721SJohan Hedberg } __packed;
118833f35721SJohan Hedberg 
1189928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1190928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1191928abaa7SAndrei Emeltchenko 	__u8     status;
1192928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1193928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1194928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1195928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1196928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1197928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1198928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1199928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1200928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1201928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1202928abaa7SAndrei Emeltchenko } __packed;
1203928abaa7SAndrei Emeltchenko 
1204523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1205523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1206523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1207523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1208523e93cdSAndrei Emeltchenko 	__le16   max_len;
1209523e93cdSAndrei Emeltchenko } __packed;
1210523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1211523e93cdSAndrei Emeltchenko 	__u8     status;
1212523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1213523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1214523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1215523e93cdSAndrei Emeltchenko } __packed;
1216523e93cdSAndrei Emeltchenko 
1217523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1218523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1219523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1220523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1221523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1222523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1223523e93cdSAndrei Emeltchenko } __packed;
1224523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1225523e93cdSAndrei Emeltchenko 	__u8     status;
1226523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1227523e93cdSAndrei Emeltchenko } __packed;
1228523e93cdSAndrei Emeltchenko 
1229f4fe73edSMarcel Holtmann #define HCI_OP_GET_MWS_TRANSPORT_CONFIG	0x140c
1230f4fe73edSMarcel Holtmann 
12314b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
12324b4148e9SMarcel Holtmann 
123306f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
123406f5b778SMarcel Holtmann 
123563185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
123663185f64SVille Tervo struct hci_cp_le_set_event_mask {
123763185f64SVille Tervo 	__u8     mask[8];
123863185f64SVille Tervo } __packed;
123963185f64SVille Tervo 
124063185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
124163185f64SVille Tervo struct hci_rp_le_read_buffer_size {
124263185f64SVille Tervo 	__u8     status;
124363185f64SVille Tervo 	__le16   le_mtu;
124463185f64SVille Tervo 	__u8     le_max_pkt;
124563185f64SVille Tervo } __packed;
124663185f64SVille Tervo 
124760e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
124860e77321SJohan Hedberg struct hci_rp_le_read_local_features {
124960e77321SJohan Hedberg 	__u8     status;
125060e77321SJohan Hedberg 	__u8     features[8];
125160e77321SJohan Hedberg } __packed;
125260e77321SJohan Hedberg 
1253d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1254d13eafceSMarcel Holtmann 
12551e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
12561e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
12571e191893SMarcel Holtmann 	__le16   min_interval;
12581e191893SMarcel Holtmann 	__le16   max_interval;
12591e191893SMarcel Holtmann 	__u8     type;
12601e191893SMarcel Holtmann 	__u8     own_address_type;
12611e191893SMarcel Holtmann 	__u8     direct_addr_type;
12621e191893SMarcel Holtmann 	bdaddr_t direct_addr;
12631e191893SMarcel Holtmann 	__u8     channel_map;
12641e191893SMarcel Holtmann 	__u8     filter_policy;
12651e191893SMarcel Holtmann } __packed;
12661e191893SMarcel Holtmann 
12678fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
12688fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
12698fa19098SJohan Hedberg 	__u8	status;
12708fa19098SJohan Hedberg 	__s8	tx_power;
12718fa19098SJohan Hedberg } __packed;
12728fa19098SJohan Hedberg 
12733f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
12743f0f524bSJohan Hedberg 
12753f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
12763f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
12773f0f524bSJohan Hedberg 	__u8	length;
12783f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
12793f0f524bSJohan Hedberg } __packed;
12803f0f524bSJohan Hedberg 
1281f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1282f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1283f14d8f64SMarcel Holtmann 	__u8	length;
1284f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1285f14d8f64SMarcel Holtmann } __packed;
1286f14d8f64SMarcel Holtmann 
1287c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1288c1d5dc4aSJohan Hedberg 
12895df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
12905df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
12915df480b5SAndre Guedes 
129207f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
129307f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
129407f7fa5dSAndre Guedes 	__u8    type;
129507f7fa5dSAndre Guedes 	__le16  interval;
129607f7fa5dSAndre Guedes 	__le16  window;
129707f7fa5dSAndre Guedes 	__u8    own_address_type;
129807f7fa5dSAndre Guedes 	__u8    filter_policy;
129907f7fa5dSAndre Guedes } __packed;
130007f7fa5dSAndre Guedes 
130176a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
130276a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1303525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1304525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
130568a8aea4SAndrei Emeltchenko 
1306eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1307eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1308eb9d91f5SAndre Guedes 	__u8     enable;
1309eb9d91f5SAndre Guedes 	__u8     filter_dup;
1310eb9d91f5SAndre Guedes } __packed;
1311eb9d91f5SAndre Guedes 
1312a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1313a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1314a7139eddSJohan Hedberg 
131563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
131663185f64SVille Tervo struct hci_cp_le_create_conn {
131763185f64SVille Tervo 	__le16   scan_interval;
131863185f64SVille Tervo 	__le16   scan_window;
131963185f64SVille Tervo 	__u8     filter_policy;
132063185f64SVille Tervo 	__u8     peer_addr_type;
132163185f64SVille Tervo 	bdaddr_t peer_addr;
132263185f64SVille Tervo 	__u8     own_address_type;
132363185f64SVille Tervo 	__le16   conn_interval_min;
132463185f64SVille Tervo 	__le16   conn_interval_max;
132563185f64SVille Tervo 	__le16   conn_latency;
132663185f64SVille Tervo 	__le16   supervision_timeout;
132763185f64SVille Tervo 	__le16   min_ce_len;
132863185f64SVille Tervo 	__le16   max_ce_len;
132963185f64SVille Tervo } __packed;
133063185f64SVille Tervo 
133163185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
133263185f64SVille Tervo 
1333cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1334cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1335cf1d081fSJohan Hedberg 	__u8	status;
1336cf1d081fSJohan Hedberg 	__u8	size;
1337cf1d081fSJohan Hedberg } __packed;
1338cf1d081fSJohan Hedberg 
1339d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1340d9a7b0a5SMarcel Holtmann 
1341d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1342d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1343d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1344d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1345d9a7b0a5SMarcel Holtmann } __packed;
1346d9a7b0a5SMarcel Holtmann 
1347d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1348d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1349d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1350d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1351d9a7b0a5SMarcel Holtmann } __packed;
1352d9a7b0a5SMarcel Holtmann 
13532ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
13542ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
13552ce603ebSClaudio Takahasi 	__le16   handle;
13562ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
13572ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
13582ce603ebSClaudio Takahasi 	__le16   conn_latency;
13592ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
13602ce603ebSClaudio Takahasi 	__le16   min_ce_len;
13612ce603ebSClaudio Takahasi 	__le16   max_ce_len;
13622ce603ebSClaudio Takahasi } __packed;
13632ce603ebSClaudio Takahasi 
1364a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1365a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1366a7a595f6SVinicius Costa Gomes 	__le16	handle;
1367fe39c7b2SMarcel Holtmann 	__le64	rand;
1368a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1369a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1370a7a595f6SVinicius Costa Gomes } __packed;
1371a7a595f6SVinicius Costa Gomes 
1372a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1373a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1374a7a595f6SVinicius Costa Gomes 	__le16	handle;
1375a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1376a7a595f6SVinicius Costa Gomes } __packed;
1377a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1378a7a595f6SVinicius Costa Gomes 	__u8	status;
1379a7a595f6SVinicius Costa Gomes 	__le16	handle;
1380a7a595f6SVinicius Costa Gomes } __packed;
1381a7a595f6SVinicius Costa Gomes 
1382a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1383a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1384a7a595f6SVinicius Costa Gomes 	__le16	handle;
1385a7a595f6SVinicius Costa Gomes } __packed;
1386a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1387a7a595f6SVinicius Costa Gomes 	__u8	status;
1388a7a595f6SVinicius Costa Gomes 	__le16	handle;
1389a7a595f6SVinicius Costa Gomes } __packed;
1390a7a595f6SVinicius Costa Gomes 
13919b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
13929b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
13939b008c04SJohan Hedberg 	__u8	status;
13949b008c04SJohan Hedberg 	__u8	le_states[8];
13959b008c04SJohan Hedberg } __packed;
13969b008c04SJohan Hedberg 
13978e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_REPLY	0x2020
13988e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_reply {
13998e75b46aSAndre Guedes 	__le16	handle;
14008e75b46aSAndre Guedes 	__le16	interval_min;
14018e75b46aSAndre Guedes 	__le16	interval_max;
14028e75b46aSAndre Guedes 	__le16	latency;
14038e75b46aSAndre Guedes 	__le16	timeout;
14048e75b46aSAndre Guedes 	__le16	min_ce_len;
14058e75b46aSAndre Guedes 	__le16	max_ce_len;
14068e75b46aSAndre Guedes } __packed;
14078e75b46aSAndre Guedes 
14088e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY	0x2021
14098e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_neg_reply {
14108e75b46aSAndre Guedes 	__le16	handle;
14118e75b46aSAndre Guedes 	__u8	reason;
14128e75b46aSAndre Guedes } __packed;
14138e75b46aSAndre Guedes 
141494a3bd02SMarcel Holtmann #define HCI_OP_LE_SET_DATA_LEN		0x2022
141594a3bd02SMarcel Holtmann struct hci_cp_le_set_data_len {
141694a3bd02SMarcel Holtmann 	__le16	handle;
141794a3bd02SMarcel Holtmann 	__le16	tx_len;
141894a3bd02SMarcel Holtmann 	__le16	tx_time;
141994a3bd02SMarcel Holtmann } __packed;
142094a3bd02SMarcel Holtmann struct hci_rp_le_set_data_len {
142194a3bd02SMarcel Holtmann 	__u8	status;
142294a3bd02SMarcel Holtmann 	__le16	handle;
142394a3bd02SMarcel Holtmann } __packed;
142494a3bd02SMarcel Holtmann 
142594a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_DEF_DATA_LEN	0x2023
142694a3bd02SMarcel Holtmann struct hci_rp_le_read_def_data_len {
142794a3bd02SMarcel Holtmann 	__u8	status;
142894a3bd02SMarcel Holtmann 	__le16	tx_len;
142994a3bd02SMarcel Holtmann 	__le16	tx_time;
143094a3bd02SMarcel Holtmann } __packed;
143194a3bd02SMarcel Holtmann 
143294a3bd02SMarcel Holtmann #define HCI_OP_LE_WRITE_DEF_DATA_LEN	0x2024
143394a3bd02SMarcel Holtmann struct hci_cp_le_write_def_data_len {
143494a3bd02SMarcel Holtmann 	__le16	tx_len;
143594a3bd02SMarcel Holtmann 	__le16	tx_time;
143694a3bd02SMarcel Holtmann } __packed;
143794a3bd02SMarcel Holtmann 
143894a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_MAX_DATA_LEN	0x202f
143994a3bd02SMarcel Holtmann struct hci_rp_le_read_max_data_len {
144094a3bd02SMarcel Holtmann 	__u8	status;
144194a3bd02SMarcel Holtmann 	__le16	tx_len;
144294a3bd02SMarcel Holtmann 	__le16	tx_time;
144394a3bd02SMarcel Holtmann 	__le16	rx_len;
144494a3bd02SMarcel Holtmann 	__le16	rx_time;
144594a3bd02SMarcel Holtmann } __packed;
144694a3bd02SMarcel Holtmann 
14471da177e4SLinus Torvalds /* ---- HCI Events ---- */
14481da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
14491da177e4SLinus Torvalds 
14501da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
14511da177e4SLinus Torvalds struct inquiry_info {
14521da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14531da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
14541da177e4SLinus Torvalds 	__u8     pscan_period_mode;
14551da177e4SLinus Torvalds 	__u8     pscan_mode;
14561da177e4SLinus Torvalds 	__u8     dev_class[3];
14571ebb9252SMarcel Holtmann 	__le16   clock_offset;
145866c853ccSGustavo F. Padovan } __packed;
14591da177e4SLinus Torvalds 
14601da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
14611da177e4SLinus Torvalds struct hci_ev_conn_complete {
14621da177e4SLinus Torvalds 	__u8     status;
14631ebb9252SMarcel Holtmann 	__le16   handle;
14641da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14651da177e4SLinus Torvalds 	__u8     link_type;
14661da177e4SLinus Torvalds 	__u8     encr_mode;
146766c853ccSGustavo F. Padovan } __packed;
14681da177e4SLinus Torvalds 
14691da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
14701da177e4SLinus Torvalds struct hci_ev_conn_request {
14711da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14721da177e4SLinus Torvalds 	__u8     dev_class[3];
14731da177e4SLinus Torvalds 	__u8     link_type;
147466c853ccSGustavo F. Padovan } __packed;
14751da177e4SLinus Torvalds 
14761da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
14771da177e4SLinus Torvalds struct hci_ev_disconn_complete {
14781da177e4SLinus Torvalds 	__u8     status;
14791ebb9252SMarcel Holtmann 	__le16   handle;
14801da177e4SLinus Torvalds 	__u8     reason;
148166c853ccSGustavo F. Padovan } __packed;
14821da177e4SLinus Torvalds 
14831da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
14841da177e4SLinus Torvalds struct hci_ev_auth_complete {
14851da177e4SLinus Torvalds 	__u8     status;
14861ebb9252SMarcel Holtmann 	__le16   handle;
148766c853ccSGustavo F. Padovan } __packed;
14881da177e4SLinus Torvalds 
1489a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1490a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1491a9de9248SMarcel Holtmann 	__u8     status;
1492a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
14931f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
149466c853ccSGustavo F. Padovan } __packed;
1495a9de9248SMarcel Holtmann 
14961da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
14971da177e4SLinus Torvalds struct hci_ev_encrypt_change {
14981da177e4SLinus Torvalds 	__u8     status;
14991ebb9252SMarcel Holtmann 	__le16   handle;
15001da177e4SLinus Torvalds 	__u8     encrypt;
150166c853ccSGustavo F. Padovan } __packed;
15021da177e4SLinus Torvalds 
1503a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1504a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
15051da177e4SLinus Torvalds 	__u8     status;
15061ebb9252SMarcel Holtmann 	__le16   handle;
150766c853ccSGustavo F. Padovan } __packed;
15081da177e4SLinus Torvalds 
1509a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1510a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1511a9de9248SMarcel Holtmann 	__u8     status;
1512a9de9248SMarcel Holtmann 	__le16   handle;
1513a9de9248SMarcel Holtmann 	__u8     features[8];
151466c853ccSGustavo F. Padovan } __packed;
1515a9de9248SMarcel Holtmann 
1516a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1517a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1518a9de9248SMarcel Holtmann 	__u8     status;
1519a9de9248SMarcel Holtmann 	__le16   handle;
1520a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1521a9de9248SMarcel Holtmann 	__le16   manufacturer;
1522a9de9248SMarcel Holtmann 	__le16   lmp_subver;
152366c853ccSGustavo F. Padovan } __packed;
1524a9de9248SMarcel Holtmann 
1525a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
15261da177e4SLinus Torvalds struct hci_qos {
15271da177e4SLinus Torvalds 	__u8     service_type;
15281da177e4SLinus Torvalds 	__u32    token_rate;
15291da177e4SLinus Torvalds 	__u32    peak_bandwidth;
15301da177e4SLinus Torvalds 	__u32    latency;
15311da177e4SLinus Torvalds 	__u32    delay_variation;
153266c853ccSGustavo F. Padovan } __packed;
15331da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
15341da177e4SLinus Torvalds 	__u8     status;
15351ebb9252SMarcel Holtmann 	__le16   handle;
15361da177e4SLinus Torvalds 	struct   hci_qos qos;
153766c853ccSGustavo F. Padovan } __packed;
15381da177e4SLinus Torvalds 
1539a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
15401da177e4SLinus Torvalds struct hci_ev_cmd_complete {
15411da177e4SLinus Torvalds 	__u8     ncmd;
15421ebb9252SMarcel Holtmann 	__le16   opcode;
154366c853ccSGustavo F. Padovan } __packed;
15441da177e4SLinus Torvalds 
1545a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
15461da177e4SLinus Torvalds struct hci_ev_cmd_status {
15471da177e4SLinus Torvalds 	__u8     status;
15481da177e4SLinus Torvalds 	__u8     ncmd;
15491ebb9252SMarcel Holtmann 	__le16   opcode;
155066c853ccSGustavo F. Padovan } __packed;
15511da177e4SLinus Torvalds 
155224dfa343SMarcel Holtmann #define HCI_EV_HARDWARE_ERROR		0x10
155324dfa343SMarcel Holtmann struct hci_ev_hardware_error {
155424dfa343SMarcel Holtmann 	__u8     code;
155524dfa343SMarcel Holtmann } __packed;
155624dfa343SMarcel Holtmann 
15571da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
15581da177e4SLinus Torvalds struct hci_ev_role_change {
15591da177e4SLinus Torvalds 	__u8     status;
15601da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15611da177e4SLinus Torvalds 	__u8     role;
156266c853ccSGustavo F. Padovan } __packed;
15631da177e4SLinus Torvalds 
1564a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1565613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1566613a1c0cSAndrei Emeltchenko 	__le16   handle;
1567613a1c0cSAndrei Emeltchenko 	__le16   count;
1568613a1c0cSAndrei Emeltchenko } __packed;
1569613a1c0cSAndrei Emeltchenko 
1570a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1571a9de9248SMarcel Holtmann 	__u8     num_hndl;
1572613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
157366c853ccSGustavo F. Padovan } __packed;
1574a9de9248SMarcel Holtmann 
15751da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
15761da177e4SLinus Torvalds struct hci_ev_mode_change {
15771da177e4SLinus Torvalds 	__u8     status;
15781ebb9252SMarcel Holtmann 	__le16   handle;
15791da177e4SLinus Torvalds 	__u8     mode;
15801ebb9252SMarcel Holtmann 	__le16   interval;
158166c853ccSGustavo F. Padovan } __packed;
15821da177e4SLinus Torvalds 
15831da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
15841da177e4SLinus Torvalds struct hci_ev_pin_code_req {
15851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
158666c853ccSGustavo F. Padovan } __packed;
15871da177e4SLinus Torvalds 
15881da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
15891da177e4SLinus Torvalds struct hci_ev_link_key_req {
15901da177e4SLinus Torvalds 	bdaddr_t bdaddr;
159166c853ccSGustavo F. Padovan } __packed;
15921da177e4SLinus Torvalds 
15931da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
15941da177e4SLinus Torvalds struct hci_ev_link_key_notify {
15951da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15969b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
15971da177e4SLinus Torvalds 	__u8     key_type;
159866c853ccSGustavo F. Padovan } __packed;
15991da177e4SLinus Torvalds 
1600a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
16011da177e4SLinus Torvalds struct hci_ev_clock_offset {
16021da177e4SLinus Torvalds 	__u8     status;
16031ebb9252SMarcel Holtmann 	__le16   handle;
16041ebb9252SMarcel Holtmann 	__le16   clock_offset;
160566c853ccSGustavo F. Padovan } __packed;
16061da177e4SLinus Torvalds 
1607a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1608a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1609a8746417SMarcel Holtmann 	__u8     status;
1610a8746417SMarcel Holtmann 	__le16   handle;
1611a8746417SMarcel Holtmann 	__le16   pkt_type;
161266c853ccSGustavo F. Padovan } __packed;
1613a8746417SMarcel Holtmann 
161485a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
161585a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
161685a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
161785a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
161866c853ccSGustavo F. Padovan } __packed;
161985a1e930SMarcel Holtmann 
1620a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1621a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1622a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1623a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1624a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1625a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1626a9de9248SMarcel Holtmann 	__le16   clock_offset;
1627a9de9248SMarcel Holtmann 	__s8     rssi;
162866c853ccSGustavo F. Padovan } __packed;
1629a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1630a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1631a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1632a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1633a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1634a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1635a9de9248SMarcel Holtmann 	__le16   clock_offset;
1636a9de9248SMarcel Holtmann 	__s8     rssi;
163766c853ccSGustavo F. Padovan } __packed;
1638a9de9248SMarcel Holtmann 
1639a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1640a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1641a9de9248SMarcel Holtmann 	__u8     status;
1642a9de9248SMarcel Holtmann 	__le16   handle;
1643a9de9248SMarcel Holtmann 	__u8     page;
1644a9de9248SMarcel Holtmann 	__u8     max_page;
1645a9de9248SMarcel Holtmann 	__u8     features[8];
164666c853ccSGustavo F. Padovan } __packed;
1647a9de9248SMarcel Holtmann 
1648a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1649a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1650a9de9248SMarcel Holtmann 	__u8     status;
1651a9de9248SMarcel Holtmann 	__le16   handle;
1652a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1653a9de9248SMarcel Holtmann 	__u8     link_type;
1654a9de9248SMarcel Holtmann 	__u8     tx_interval;
1655a9de9248SMarcel Holtmann 	__u8     retrans_window;
1656a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1657a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1658a9de9248SMarcel Holtmann 	__u8     air_mode;
165966c853ccSGustavo F. Padovan } __packed;
1660a9de9248SMarcel Holtmann 
1661a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1662a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1663a9de9248SMarcel Holtmann 	__u8     status;
1664a9de9248SMarcel Holtmann 	__le16   handle;
1665a9de9248SMarcel Holtmann 	__u8     tx_interval;
1666a9de9248SMarcel Holtmann 	__u8     retrans_window;
1667a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1668a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
166966c853ccSGustavo F. Padovan } __packed;
1670a9de9248SMarcel Holtmann 
1671a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
167204837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
167304837f64SMarcel Holtmann 	__u8     status;
167404837f64SMarcel Holtmann 	__le16   handle;
167504837f64SMarcel Holtmann 	__le16   max_tx_latency;
167604837f64SMarcel Holtmann 	__le16   max_rx_latency;
167704837f64SMarcel Holtmann 	__le16   max_remote_timeout;
167804837f64SMarcel Holtmann 	__le16   max_local_timeout;
167966c853ccSGustavo F. Padovan } __packed;
168004837f64SMarcel Holtmann 
1681a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1682a9de9248SMarcel Holtmann struct extended_inquiry_info {
1683a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1684a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1685a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1686a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1687a9de9248SMarcel Holtmann 	__le16   clock_offset;
1688a9de9248SMarcel Holtmann 	__s8     rssi;
1689a9de9248SMarcel Holtmann 	__u8     data[240];
169066c853ccSGustavo F. Padovan } __packed;
1691a9de9248SMarcel Holtmann 
16921c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
16931c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
16941c2e0041SJohan Hedberg 	__u8	status;
16951c2e0041SJohan Hedberg 	__le16	handle;
16961c2e0041SJohan Hedberg } __packed;
16971c2e0041SJohan Hedberg 
16980493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
16990493684eSMarcel Holtmann struct hci_ev_io_capa_request {
17000493684eSMarcel Holtmann 	bdaddr_t bdaddr;
170166c853ccSGustavo F. Padovan } __packed;
17020493684eSMarcel Holtmann 
170303b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
170403b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
170503b555e1SJohan Hedberg 	bdaddr_t bdaddr;
170603b555e1SJohan Hedberg 	__u8     capability;
170703b555e1SJohan Hedberg 	__u8     oob_data;
170803b555e1SJohan Hedberg 	__u8     authentication;
170903b555e1SJohan Hedberg } __packed;
171003b555e1SJohan Hedberg 
1711a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1712a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1713a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1714a5c29683SJohan Hedberg 	__le32		passkey;
1715a5c29683SJohan Hedberg } __packed;
1716a5c29683SJohan Hedberg 
17179ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
17189ad4019aSBrian Gix struct hci_ev_user_passkey_req {
17199ad4019aSBrian Gix 	bdaddr_t	bdaddr;
17209ad4019aSBrian Gix } __packed;
17219ad4019aSBrian Gix 
17222763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
17232763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
17242763eda6SSzymon Janc 	bdaddr_t bdaddr;
17252763eda6SSzymon Janc } __packed;
17262763eda6SSzymon Janc 
17270493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
17280493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
17290493684eSMarcel Holtmann 	__u8     status;
17300493684eSMarcel Holtmann 	bdaddr_t bdaddr;
173166c853ccSGustavo F. Padovan } __packed;
17320493684eSMarcel Holtmann 
173392a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
173492a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
173592a25256SJohan Hedberg 	bdaddr_t	bdaddr;
173692a25256SJohan Hedberg 	__le32		passkey;
173792a25256SJohan Hedberg } __packed;
173892a25256SJohan Hedberg 
173992a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
174092a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
174192a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
174292a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
174392a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
174492a25256SJohan Hedberg 
174592a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
174692a25256SJohan Hedberg struct hci_ev_keypress_notify {
174792a25256SJohan Hedberg 	bdaddr_t	bdaddr;
174892a25256SJohan Hedberg 	__u8		type;
174992a25256SJohan Hedberg } __packed;
175092a25256SJohan Hedberg 
175141a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
175241a96212SMarcel Holtmann struct hci_ev_remote_host_features {
175341a96212SMarcel Holtmann 	bdaddr_t bdaddr;
175441a96212SMarcel Holtmann 	__u8     features[8];
175566c853ccSGustavo F. Padovan } __packed;
175641a96212SMarcel Holtmann 
175763185f64SVille Tervo #define HCI_EV_LE_META			0x3e
175863185f64SVille Tervo struct hci_ev_le_meta {
175963185f64SVille Tervo 	__u8     subevent;
176063185f64SVille Tervo } __packed;
176163185f64SVille Tervo 
1762523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1763523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1764523e93cdSAndrei Emeltchenko 	__u8     status;
1765523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1766523e93cdSAndrei Emeltchenko } __packed;
1767523e93cdSAndrei Emeltchenko 
1768523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1769523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1770523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1771523e93cdSAndrei Emeltchenko } __packed;
1772523e93cdSAndrei Emeltchenko 
1773523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1774523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1775523e93cdSAndrei Emeltchenko 	__u8     status;
1776523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1777523e93cdSAndrei Emeltchenko 	__u8     reason;
1778523e93cdSAndrei Emeltchenko } __packed;
1779523e93cdSAndrei Emeltchenko 
1780523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1781523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1782523e93cdSAndrei Emeltchenko 	__u8     status;
1783523e93cdSAndrei Emeltchenko 	__le16   handle;
1784523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1785523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1786523e93cdSAndrei Emeltchenko } __packed;
1787523e93cdSAndrei Emeltchenko 
1788523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1789523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1790523e93cdSAndrei Emeltchenko 	__u8     status;
1791523e93cdSAndrei Emeltchenko 	__le16   handle;
1792523e93cdSAndrei Emeltchenko 	__u8     reason;
1793523e93cdSAndrei Emeltchenko } __packed;
1794523e93cdSAndrei Emeltchenko 
179525e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
179625e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
179725e89e99SAndrei Emeltchenko 	__le16   handle;
179825e89e99SAndrei Emeltchenko 	__le16   pkts;
179925e89e99SAndrei Emeltchenko 	__le16   blocks;
180025e89e99SAndrei Emeltchenko } __packed;
180125e89e99SAndrei Emeltchenko 
180225e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
180325e89e99SAndrei Emeltchenko 	__le16   num_blocks;
180425e89e99SAndrei Emeltchenko 	__u8     num_hndl;
180525e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
180625e89e99SAndrei Emeltchenko } __packed;
180725e89e99SAndrei Emeltchenko 
18082b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
18092b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
18102b359445SDoHyun Pyun 	__u8	status;
18112b359445SDoHyun Pyun } __packed;
18122b359445SDoHyun Pyun 
18132ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
18142ed01805SDoHyun Pyun 
181563185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
181663185f64SVille Tervo struct hci_ev_le_conn_complete {
181763185f64SVille Tervo 	__u8     status;
181863185f64SVille Tervo 	__le16   handle;
181963185f64SVille Tervo 	__u8     role;
182063185f64SVille Tervo 	__u8     bdaddr_type;
182163185f64SVille Tervo 	bdaddr_t bdaddr;
182263185f64SVille Tervo 	__le16   interval;
182363185f64SVille Tervo 	__le16   latency;
182463185f64SVille Tervo 	__le16   supervision_timeout;
182563185f64SVille Tervo 	__u8     clk_accurancy;
182663185f64SVille Tervo } __packed;
182763185f64SVille Tervo 
18282331fd46SMarcel Holtmann /* Advertising report event types */
18292331fd46SMarcel Holtmann #define LE_ADV_IND		0x00
18302331fd46SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
18312331fd46SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
18322331fd46SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
18332331fd46SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
18342331fd46SMarcel Holtmann 
18352331fd46SMarcel Holtmann #define ADDR_LE_DEV_PUBLIC	0x00
18362331fd46SMarcel Holtmann #define ADDR_LE_DEV_RANDOM	0x01
18372331fd46SMarcel Holtmann 
18382331fd46SMarcel Holtmann #define HCI_EV_LE_ADVERTISING_REPORT	0x02
18392331fd46SMarcel Holtmann struct hci_ev_le_advertising_info {
18402331fd46SMarcel Holtmann 	__u8	 evt_type;
18412331fd46SMarcel Holtmann 	__u8	 bdaddr_type;
18422331fd46SMarcel Holtmann 	bdaddr_t bdaddr;
18432331fd46SMarcel Holtmann 	__u8	 length;
18442331fd46SMarcel Holtmann 	__u8	 data[0];
18452331fd46SMarcel Holtmann } __packed;
18462331fd46SMarcel Holtmann 
18471855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
18481855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
18491855d92dSMarcel Holtmann 	__u8     status;
18501855d92dSMarcel Holtmann 	__le16   handle;
18511855d92dSMarcel Holtmann 	__le16   interval;
18521855d92dSMarcel Holtmann 	__le16   latency;
18531855d92dSMarcel Holtmann 	__le16   supervision_timeout;
18541855d92dSMarcel Holtmann } __packed;
18551855d92dSMarcel Holtmann 
1856a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1857a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1858a7a595f6SVinicius Costa Gomes 	__le16	handle;
1859fe39c7b2SMarcel Holtmann 	__le64	rand;
1860a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1861a7a595f6SVinicius Costa Gomes } __packed;
1862a7a595f6SVinicius Costa Gomes 
18638e75b46aSAndre Guedes #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ	0x06
18648e75b46aSAndre Guedes struct hci_ev_le_remote_conn_param_req {
18658e75b46aSAndre Guedes 	__le16 handle;
18668e75b46aSAndre Guedes 	__le16 interval_min;
18678e75b46aSAndre Guedes 	__le16 interval_max;
18688e75b46aSAndre Guedes 	__le16 latency;
18698e75b46aSAndre Guedes 	__le16 timeout;
18708e75b46aSAndre Guedes } __packed;
18718e75b46aSAndre Guedes 
187294a3bd02SMarcel Holtmann #define HCI_EV_LE_DATA_LEN_CHANGE	0x07
187394a3bd02SMarcel Holtmann struct hci_ev_le_data_len_change {
187494a3bd02SMarcel Holtmann 	__le16	handle;
187594a3bd02SMarcel Holtmann 	__le16	tx_len;
187694a3bd02SMarcel Holtmann 	__le16	tx_time;
187794a3bd02SMarcel Holtmann 	__le16	rx_len;
187894a3bd02SMarcel Holtmann 	__le16	rx_time;
187994a3bd02SMarcel Holtmann } __packed;
188094a3bd02SMarcel Holtmann 
188132c9d43fSMarcel Holtmann #define HCI_EV_LE_DIRECT_ADV_REPORT	0x0B
188232c9d43fSMarcel Holtmann struct hci_ev_le_direct_adv_info {
188332c9d43fSMarcel Holtmann 	__u8	 evt_type;
188432c9d43fSMarcel Holtmann 	__u8	 bdaddr_type;
188532c9d43fSMarcel Holtmann 	bdaddr_t bdaddr;
188632c9d43fSMarcel Holtmann 	__u8	 direct_addr_type;
188732c9d43fSMarcel Holtmann 	bdaddr_t direct_addr;
188832c9d43fSMarcel Holtmann 	__s8	 rssi;
188932c9d43fSMarcel Holtmann } __packed;
189032c9d43fSMarcel Holtmann 
18911da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1892a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
18931da177e4SLinus Torvalds struct hci_ev_stack_internal {
18941da177e4SLinus Torvalds 	__u16    type;
18951da177e4SLinus Torvalds 	__u8     data[0];
189666c853ccSGustavo F. Padovan } __packed;
18971da177e4SLinus Torvalds 
18981da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
18991da177e4SLinus Torvalds struct hci_ev_si_device {
19001da177e4SLinus Torvalds 	__u16    event;
19011da177e4SLinus Torvalds 	__u16    dev_id;
190266c853ccSGustavo F. Padovan } __packed;
19031da177e4SLinus Torvalds 
19041da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
19051da177e4SLinus Torvalds struct hci_ev_si_security {
19061da177e4SLinus Torvalds 	__u16    event;
19071da177e4SLinus Torvalds 	__u16    proto;
19081da177e4SLinus Torvalds 	__u16    subproto;
19091da177e4SLinus Torvalds 	__u8     incoming;
191066c853ccSGustavo F. Padovan } __packed;
19111da177e4SLinus Torvalds 
19121da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
19131da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
19141da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
19151da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
19161da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
19171da177e4SLinus Torvalds 
19181da177e4SLinus Torvalds struct hci_command_hdr {
19191ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
19201da177e4SLinus Torvalds 	__u8	plen;
192166c853ccSGustavo F. Padovan } __packed;
19221da177e4SLinus Torvalds 
19231da177e4SLinus Torvalds struct hci_event_hdr {
19241da177e4SLinus Torvalds 	__u8	evt;
19251da177e4SLinus Torvalds 	__u8	plen;
192666c853ccSGustavo F. Padovan } __packed;
19271da177e4SLinus Torvalds 
19281da177e4SLinus Torvalds struct hci_acl_hdr {
19291ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
19301ebb9252SMarcel Holtmann 	__le16	dlen;
193166c853ccSGustavo F. Padovan } __packed;
19321da177e4SLinus Torvalds 
19331da177e4SLinus Torvalds struct hci_sco_hdr {
19341ebb9252SMarcel Holtmann 	__le16	handle;
19351da177e4SLinus Torvalds 	__u8	dlen;
193666c853ccSGustavo F. Padovan } __packed;
19371da177e4SLinus Torvalds 
19382a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
19392a123b86SArnaldo Carvalho de Melo {
19402a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
19412a123b86SArnaldo Carvalho de Melo }
19422a123b86SArnaldo Carvalho de Melo 
19432a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
19442a123b86SArnaldo Carvalho de Melo {
19452a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
19462a123b86SArnaldo Carvalho de Melo }
19472a123b86SArnaldo Carvalho de Melo 
19482a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
19492a123b86SArnaldo Carvalho de Melo {
19502a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
19512a123b86SArnaldo Carvalho de Melo }
19522a123b86SArnaldo Carvalho de Melo 
19531da177e4SLinus Torvalds /* Command opcode pack/unpack */
1954c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
19551da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
19561da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
19571da177e4SLinus Torvalds 
19581da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1959c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
19601da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
19611da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
19621da177e4SLinus Torvalds 
19631da177e4SLinus Torvalds #endif /* __HCI_H */
1964