xref: /openbmc/linux/include/net/bluetooth/hci.h (revision d41c15cf95bd91b9c333f6f749670e22c8a47ad9)
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 
105118305b5SMarcel Holtmann 	/* When this quirk is set, then no stored link key handling
106118305b5SMarcel Holtmann 	 * is performed. This is mainly due to the fact that the
107118305b5SMarcel Holtmann 	 * HCI Delete Stored Link Key command is advertised, but
108118305b5SMarcel Holtmann 	 * not supported.
109118305b5SMarcel Holtmann 	 *
110118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
111118305b5SMarcel Holtmann 	 */
112f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
11389bc22d2SMarcel Holtmann 
114eb1904f4SMarcel Holtmann 	/* When this quirk is set, an external configuration step
115eb1904f4SMarcel Holtmann 	 * is required and will be indicated with the controller
116eb1904f4SMarcel Holtmann 	 * configuation.
117eb1904f4SMarcel Holtmann 	 *
118eb1904f4SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
119eb1904f4SMarcel Holtmann 	 * during the hdev->setup vendor callback.
120eb1904f4SMarcel Holtmann 	 */
121eb1904f4SMarcel Holtmann 	HCI_QUIRK_EXTERNAL_CONFIG,
122eb1904f4SMarcel Holtmann 
12389bc22d2SMarcel Holtmann 	/* When this quirk is set, the public Bluetooth address
12489bc22d2SMarcel Holtmann 	 * initially reported by HCI Read BD Address command
12589bc22d2SMarcel Holtmann 	 * is considered invalid. Controller configuration is
12689bc22d2SMarcel Holtmann 	 * required before this device can be used.
12789bc22d2SMarcel Holtmann 	 *
12889bc22d2SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
12989bc22d2SMarcel Holtmann 	 * during the hdev->setup vendor callback.
13089bc22d2SMarcel Holtmann 	 */
13189bc22d2SMarcel Holtmann 	HCI_QUIRK_INVALID_BDADDR,
1321da177e4SLinus Torvalds };
1331da177e4SLinus Torvalds 
1341da177e4SLinus Torvalds /* HCI device flags */
1351da177e4SLinus Torvalds enum {
1361da177e4SLinus Torvalds 	HCI_UP,
1371da177e4SLinus Torvalds 	HCI_INIT,
1381da177e4SLinus Torvalds 	HCI_RUNNING,
1391da177e4SLinus Torvalds 
1401da177e4SLinus Torvalds 	HCI_PSCAN,
1411da177e4SLinus Torvalds 	HCI_ISCAN,
1421da177e4SLinus Torvalds 	HCI_AUTH,
1431da177e4SLinus Torvalds 	HCI_ENCRYPT,
1441da177e4SLinus Torvalds 	HCI_INQUIRY,
1451da177e4SLinus Torvalds 
1461da177e4SLinus Torvalds 	HCI_RAW,
147ab81cbf9SJohan Hedberg 
14810572132SGustavo F. Padovan 	HCI_RESET,
1491da177e4SLinus Torvalds };
1501da177e4SLinus Torvalds 
151111902f7SMarcel Holtmann /* BR/EDR and/or LE controller flags: the flags defined here should represent
152111902f7SMarcel Holtmann  * states configured via debugfs for debugging and testing purposes only.
153111902f7SMarcel Holtmann  */
154111902f7SMarcel Holtmann enum {
155111902f7SMarcel Holtmann 	HCI_DUT_MODE,
156111902f7SMarcel Holtmann 	HCI_FORCE_SC,
157111902f7SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
158111902f7SMarcel Holtmann };
159111902f7SMarcel Holtmann 
160d23264a8SAndre Guedes /*
161d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
162d23264a8SAndre Guedes  * states from the controller.
163d23264a8SAndre Guedes  */
164d23264a8SAndre Guedes enum {
165a8b2d5c2SJohan Hedberg 	HCI_SETUP,
166d603b76bSMarcel Holtmann 	HCI_CONFIG,
167a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
1685e130367SJohan Hedberg 	HCI_RFKILLED,
169a8b2d5c2SJohan Hedberg 	HCI_MGMT,
170b6ae8457SJohan Hedberg 	HCI_BONDABLE,
171a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
1720663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
1733769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
17494324962SJohan Hovold 	HCI_UNREGISTER,
1754a964404SMarcel Holtmann 	HCI_UNCONFIGURED,
1760736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
177dbece37aSMarcel Holtmann 	HCI_EXT_CONFIGURED,
17866c417c1SJohan Hedberg 	HCI_LE_ADV,
179d23264a8SAndre Guedes 	HCI_LE_SCAN,
18084bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
181e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
182134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
183863efaf2SJohan Hedberg 	HCI_PRIVACY,
184d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
18541edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
1866d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
18706199cf8SJohan Hedberg 	HCI_LE_ENABLED,
188f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
1895e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
1905e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
1916acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
19247990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
19321693c15SAndre Guedes 	HCI_PERIODIC_INQ,
1941a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
19556f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
19681ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
197d23264a8SAndre Guedes };
198d23264a8SAndre Guedes 
1992cc6fb00SJohan Hedberg /* A mask for the flags that are supposed to remain when a reset happens
2002cc6fb00SJohan Hedberg  * or the HCI device is closed.
2012cc6fb00SJohan Hedberg  */
2021a4d3c4bSJohan Hedberg #define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \
20366c417c1SJohan Hedberg 			      BIT(HCI_FAST_CONNECTABLE) | BIT(HCI_LE_ADV))
2042cc6fb00SJohan Hedberg 
2051da177e4SLinus Torvalds /* HCI timeouts */
2065f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2075f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
2085f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
209d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
2105f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
2119345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
212a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
2139489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
21409ae260bSJohan Hedberg #define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2151da177e4SLinus Torvalds 
2165b7f9909SMarcel Holtmann /* HCI data types */
2171da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
2181da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
2191da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
2201da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
2211da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2221da177e4SLinus Torvalds 
2235b7f9909SMarcel Holtmann /* HCI packet types */
2241da177e4SLinus Torvalds #define HCI_DM1		0x0008
2251da177e4SLinus Torvalds #define HCI_DM3		0x0400
2261da177e4SLinus Torvalds #define HCI_DM5		0x4000
2271da177e4SLinus Torvalds #define HCI_DH1		0x0010
2281da177e4SLinus Torvalds #define HCI_DH3		0x0800
2291da177e4SLinus Torvalds #define HCI_DH5		0x8000
2301da177e4SLinus Torvalds 
2311da177e4SLinus Torvalds #define HCI_HV1		0x0020
2321da177e4SLinus Torvalds #define HCI_HV2		0x0040
2331da177e4SLinus Torvalds #define HCI_HV3		0x0080
2341da177e4SLinus Torvalds 
2351da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2361da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2371da177e4SLinus Torvalds 
2385b7f9909SMarcel Holtmann /* eSCO packet types */
2395b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2405b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2415b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2425b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2435b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2445b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
245efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
246efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
247efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
248efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2495b7f9909SMarcel Holtmann 
250a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
251efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
252a8746417SMarcel Holtmann 
2531da177e4SLinus Torvalds /* ACL flags */
254e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2551da177e4SLinus Torvalds #define ACL_CONT		0x01
2561da177e4SLinus Torvalds #define ACL_START		0x02
257d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
2581da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
2591da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
2601da177e4SLinus Torvalds 
2611da177e4SLinus Torvalds /* Baseband links */
2621da177e4SLinus Torvalds #define SCO_LINK	0x00
2631da177e4SLinus Torvalds #define ACL_LINK	0x01
2645b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
265fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
266fcd89c09SVille Tervo #define LE_LINK		0x80
2673161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
2681da177e4SLinus Torvalds 
2691da177e4SLinus Torvalds /* LMP features */
2701da177e4SLinus Torvalds #define LMP_3SLOT	0x01
2711da177e4SLinus Torvalds #define LMP_5SLOT	0x02
2721da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
2731da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
2741da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
2751da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
2761da177e4SLinus Torvalds #define LMP_HOLD	0x40
27704837f64SMarcel Holtmann #define LMP_SNIFF	0x80
2781da177e4SLinus Torvalds 
2791da177e4SLinus Torvalds #define LMP_PARK	0x01
2801da177e4SLinus Torvalds #define LMP_RSSI	0x02
2811da177e4SLinus Torvalds #define LMP_QUALITY	0x04
2821da177e4SLinus Torvalds #define LMP_SCO		0x08
2831da177e4SLinus Torvalds #define LMP_HV2		0x10
2841da177e4SLinus Torvalds #define LMP_HV3		0x20
2851da177e4SLinus Torvalds #define LMP_ULAW	0x40
2861da177e4SLinus Torvalds #define LMP_ALAW	0x80
2871da177e4SLinus Torvalds 
2881da177e4SLinus Torvalds #define LMP_CVSD	0x01
2891da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
2901da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
29107a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
2921da177e4SLinus Torvalds 
293d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2945b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2955b7f9909SMarcel Holtmann 
2965b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2975b7f9909SMarcel Holtmann #define LMP_EV5		0x02
29869ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
299d5859e22SJohan Hedberg #define LMP_LE		0x40
3005b7f9909SMarcel Holtmann 
30104837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
302d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
303efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
304efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
305efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
30604837f64SMarcel Holtmann 
307d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
308e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
309769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
310e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
311769be974SMarcel Holtmann 
312d5859e22SJohan Hedberg #define LMP_LSTO	0x01
313d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
314971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
315d5859e22SJohan Hedberg 
316eead27daSAndre Guedes /* Extended LMP features */
31753b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
31853b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
31953b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
32053b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
32153b834d2SMarcel Holtmann 
322d5991585SMarcel Holtmann #define LMP_SC		0x01
323d5991585SMarcel Holtmann #define LMP_PING	0x02
324d5991585SMarcel Holtmann 
32553b834d2SMarcel Holtmann /* Host features */
326cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
327eead27daSAndre Guedes #define LMP_HOST_LE		0x02
328cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
329d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
330eead27daSAndre Guedes 
331662bc2e6SAndre Guedes /* LE features */
3320da71f1bSMarcel Holtmann #define HCI_LE_ENCRYPTION		0x01
333662bc2e6SAndre Guedes #define HCI_LE_CONN_PARAM_REQ_PROC	0x02
334cd7ca0ecSMarcel Holtmann #define HCI_LE_PING			0x10
335662bc2e6SAndre Guedes 
33604837f64SMarcel Holtmann /* Connection modes */
33704837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
33804837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
33904837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
34004837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
34104837f64SMarcel Holtmann 
3421da177e4SLinus Torvalds /* Link policies */
3431da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3441da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3451da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3461da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3471da177e4SLinus Torvalds 
34804837f64SMarcel Holtmann /* Link modes */
3491da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3501da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3511da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3521da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3531da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3541da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
3551da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
3567b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
3571da177e4SLinus Torvalds 
35840be492fSMarcel Holtmann /* Authentication types */
35940be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
36040be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
36140be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
36240be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
36340be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
36440be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
36540be492fSMarcel Holtmann 
366a77b15a6SMikel Astiz /* I/O capabilities */
367a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
368a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
369a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
370a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
371a77b15a6SMikel Astiz 
372b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
373b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
374b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
375b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
376b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
37711015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
37811015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
379b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
38011015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
38111015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
382b6020ba0SWaldemar Rymarkiewicz 
3839f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
3848e75b46aSAndre Guedes #define HCI_ERROR_UNKNOWN_CONN_ID	0x02
3859f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
3862acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
387cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
388*d41c15cfSJohan Hedberg #define HCI_ERROR_REJ_LIMITED_RESOURCES	0x0d
3899f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
3909f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
391cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
392cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
3939f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
3949f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
3958e75b46aSAndre Guedes #define HCI_ERROR_INVALID_LL_PARAMS	0x1E
3963c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
3979f5a0d7bSAndrei Emeltchenko 
3982455a3eaSAndrei Emeltchenko /* Flow control modes */
3992455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
4002455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
4012455a3eaSAndrei Emeltchenko 
402bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
403bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
404bbaf444aSJohan Hedberg 
405ba165a90SJohan Hedberg #define HCI_ROLE_MASTER		0x00
406ba165a90SJohan Hedberg #define HCI_ROLE_SLAVE		0x01
407ba165a90SJohan Hedberg 
40832748db0SJohan Hedberg /* Extended Inquiry Response field types */
40932748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
41032748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
41132748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
41232748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
41332748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
41432748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
41532748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
41632748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
41732748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
41832748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
4199ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
4209ec9fc8aSJohan Hedberg #define EIR_SSP_HASH_C		0x0E /* Simple Pairing Hash C */
4219ec9fc8aSJohan Hedberg #define EIR_SSP_RAND_R		0x0F /* Simple Pairing Randomizer R */
42232748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
42332748db0SJohan Hedberg 
4243f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
4253f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
4263f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
4273f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
4283f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
4293f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
4303f0f524bSJohan Hedberg 
4311da177e4SLinus Torvalds /* -----  HCI Commands ---- */
4326bd32326SVille Tervo #define HCI_OP_NOP			0x0000
4336bd32326SVille Tervo 
434a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
435a9de9248SMarcel Holtmann struct hci_cp_inquiry {
436a9de9248SMarcel Holtmann 	__u8     lap[3];
437a9de9248SMarcel Holtmann 	__u8     length;
438a9de9248SMarcel Holtmann 	__u8     num_rsp;
43966c853ccSGustavo F. Padovan } __packed;
4401da177e4SLinus Torvalds 
441a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
442a9de9248SMarcel Holtmann 
44379d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
44479d6e068SAndre Guedes 
445a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
446a9de9248SMarcel Holtmann 
447a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
448a9de9248SMarcel Holtmann struct hci_cp_create_conn {
449a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
450a9de9248SMarcel Holtmann 	__le16   pkt_type;
451a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
452a9de9248SMarcel Holtmann 	__u8     pscan_mode;
453a9de9248SMarcel Holtmann 	__le16   clock_offset;
454a9de9248SMarcel Holtmann 	__u8     role_switch;
45566c853ccSGustavo F. Padovan } __packed;
4561da177e4SLinus Torvalds 
457a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
458a9de9248SMarcel Holtmann struct hci_cp_disconnect {
459a9de9248SMarcel Holtmann 	__le16   handle;
460a9de9248SMarcel Holtmann 	__u8     reason;
46166c853ccSGustavo F. Padovan } __packed;
4621da177e4SLinus Torvalds 
463a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
464a9de9248SMarcel Holtmann struct hci_cp_add_sco {
465a9de9248SMarcel Holtmann 	__le16   handle;
466a9de9248SMarcel Holtmann 	__le16   pkt_type;
46766c853ccSGustavo F. Padovan } __packed;
468a9de9248SMarcel Holtmann 
469a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
470a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
4711da177e4SLinus Torvalds 	bdaddr_t bdaddr;
47266c853ccSGustavo F. Padovan } __packed;
4731da177e4SLinus Torvalds 
474a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
475a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
476a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
477a9de9248SMarcel Holtmann 	__u8     role;
47866c853ccSGustavo F. Padovan } __packed;
4791da177e4SLinus Torvalds 
480a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
481a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
482a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
483a9de9248SMarcel Holtmann 	__u8     reason;
48466c853ccSGustavo F. Padovan } __packed;
4851da177e4SLinus Torvalds 
486a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
487a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
488a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
4899b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
49066c853ccSGustavo F. Padovan } __packed;
4911da177e4SLinus Torvalds 
492a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
493a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
494a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
49566c853ccSGustavo F. Padovan } __packed;
4961da177e4SLinus Torvalds 
497a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
498a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
499a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
500a9de9248SMarcel Holtmann 	__u8     pin_len;
501a9de9248SMarcel Holtmann 	__u8     pin_code[16];
50266c853ccSGustavo F. Padovan } __packed;
503980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
504980e1a53SJohan Hedberg 	__u8     status;
505980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
506980e1a53SJohan Hedberg } __packed;
507a9de9248SMarcel Holtmann 
508a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
509a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
510a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
51166c853ccSGustavo F. Padovan } __packed;
512980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
513980e1a53SJohan Hedberg 	__u8     status;
514980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
515980e1a53SJohan Hedberg } __packed;
516a9de9248SMarcel Holtmann 
517a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
518a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
519a9de9248SMarcel Holtmann 	__le16   handle;
520a9de9248SMarcel Holtmann 	__le16   pkt_type;
52166c853ccSGustavo F. Padovan } __packed;
522a9de9248SMarcel Holtmann 
523a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
524a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
525a9de9248SMarcel Holtmann 	__le16   handle;
52666c853ccSGustavo F. Padovan } __packed;
527a9de9248SMarcel Holtmann 
528a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
529a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
530a9de9248SMarcel Holtmann 	__le16   handle;
531a9de9248SMarcel Holtmann 	__u8     encrypt;
53266c853ccSGustavo F. Padovan } __packed;
533a9de9248SMarcel Holtmann 
534a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
535a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
536a9de9248SMarcel Holtmann 	__le16   handle;
53766c853ccSGustavo F. Padovan } __packed;
538a9de9248SMarcel Holtmann 
539a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
540a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
541a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
542a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
543a9de9248SMarcel Holtmann 	__u8     pscan_mode;
544a9de9248SMarcel Holtmann 	__le16   clock_offset;
54566c853ccSGustavo F. Padovan } __packed;
546a9de9248SMarcel Holtmann 
547a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
548a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
549a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
55066c853ccSGustavo F. Padovan } __packed;
551a9de9248SMarcel Holtmann 
552a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
553a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
554a9de9248SMarcel Holtmann 	__le16   handle;
55566c853ccSGustavo F. Padovan } __packed;
556a9de9248SMarcel Holtmann 
557a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
558a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
559a9de9248SMarcel Holtmann 	__le16   handle;
560a9de9248SMarcel Holtmann 	__u8     page;
56166c853ccSGustavo F. Padovan } __packed;
562a9de9248SMarcel Holtmann 
563a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
564a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
565a9de9248SMarcel Holtmann 	__le16   handle;
56666c853ccSGustavo F. Padovan } __packed;
567a9de9248SMarcel Holtmann 
568df935429SMarcel Holtmann #define HCI_OP_READ_CLOCK_OFFSET	0x041f
569df935429SMarcel Holtmann struct hci_cp_read_clock_offset {
570df935429SMarcel Holtmann 	__le16   handle;
571df935429SMarcel Holtmann } __packed;
572df935429SMarcel Holtmann 
573a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
574a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
575a9de9248SMarcel Holtmann 	__le16   handle;
576a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
577a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
578a9de9248SMarcel Holtmann 	__le16   max_latency;
579a9de9248SMarcel Holtmann 	__le16   voice_setting;
580a9de9248SMarcel Holtmann 	__u8     retrans_effort;
581a9de9248SMarcel Holtmann 	__le16   pkt_type;
58266c853ccSGustavo F. Padovan } __packed;
583a9de9248SMarcel Holtmann 
584a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
585a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
586a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
587a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
588a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
589a9de9248SMarcel Holtmann 	__le16   max_latency;
590a9de9248SMarcel Holtmann 	__le16   content_format;
591a9de9248SMarcel Holtmann 	__u8     retrans_effort;
592a9de9248SMarcel Holtmann 	__le16   pkt_type;
59366c853ccSGustavo F. Padovan } __packed;
594a9de9248SMarcel Holtmann 
595a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
596a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
597a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
598a9de9248SMarcel Holtmann 	__u8     reason;
59966c853ccSGustavo F. Padovan } __packed;
600a9de9248SMarcel Holtmann 
60117fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
60217fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
60317fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
60417fa4b9dSJohan Hedberg 	__u8     capability;
60517fa4b9dSJohan Hedberg 	__u8     oob_data;
60617fa4b9dSJohan Hedberg 	__u8     authentication;
60717fa4b9dSJohan Hedberg } __packed;
60817fa4b9dSJohan Hedberg 
609a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
610a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
611a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
612a5c29683SJohan Hedberg } __packed;
613a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
614a5c29683SJohan Hedberg 	__u8     status;
615a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
616a5c29683SJohan Hedberg } __packed;
617a5c29683SJohan Hedberg 
618a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
619a5c29683SJohan Hedberg 
6209ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
6219ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
6229ad4019aSBrian Gix 	bdaddr_t bdaddr;
6239ad4019aSBrian Gix 	__le32	passkey;
6249ad4019aSBrian Gix } __packed;
6259ad4019aSBrian Gix 
6269ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
6279ad4019aSBrian Gix 
6282763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
6292763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
6302763eda6SSzymon Janc 	bdaddr_t bdaddr;
6312763eda6SSzymon Janc 	__u8     hash[16];
6322763eda6SSzymon Janc 	__u8     randomizer[16];
6332763eda6SSzymon Janc } __packed;
6342763eda6SSzymon Janc 
6352763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
6362763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
6372763eda6SSzymon Janc 	bdaddr_t bdaddr;
6382763eda6SSzymon Janc } __packed;
6392763eda6SSzymon Janc 
64003b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
64103b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
64203b555e1SJohan Hedberg 	bdaddr_t bdaddr;
64303b555e1SJohan Hedberg 	__u8     reason;
64403b555e1SJohan Hedberg } __packed;
64503b555e1SJohan Hedberg 
646523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
647523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
648523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
649523e93cdSAndrei Emeltchenko 	__u8     key_len;
650523e93cdSAndrei Emeltchenko 	__u8     key_type;
651523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
652523e93cdSAndrei Emeltchenko } __packed;
653523e93cdSAndrei Emeltchenko 
654523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
655523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
656523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
657523e93cdSAndrei Emeltchenko 	__u8     key_len;
658523e93cdSAndrei Emeltchenko 	__u8     key_type;
659523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
660523e93cdSAndrei Emeltchenko } __packed;
661523e93cdSAndrei Emeltchenko 
662523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
663523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
664523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
665523e93cdSAndrei Emeltchenko 	__u8     reason;
666b078b564SAndrei Emeltchenko } __packed;
667b078b564SAndrei Emeltchenko 
668b078b564SAndrei Emeltchenko struct ext_flow_spec {
669b078b564SAndrei Emeltchenko 	__u8       id;
670b078b564SAndrei Emeltchenko 	__u8       stype;
671b078b564SAndrei Emeltchenko 	__le16     msdu;
672b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
673b078b564SAndrei Emeltchenko 	__le32     acc_lat;
674b078b564SAndrei Emeltchenko 	__le32     flush_to;
675b078b564SAndrei Emeltchenko } __packed;
676b078b564SAndrei Emeltchenko 
677b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
678b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
679b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
680b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
681b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
682b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
683b078b564SAndrei Emeltchenko } __packed;
684b078b564SAndrei Emeltchenko 
685b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
686b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
687b078b564SAndrei Emeltchenko 	__le16   log_handle;
688b078b564SAndrei Emeltchenko } __packed;
689b078b564SAndrei Emeltchenko 
690b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
691b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
692b078b564SAndrei Emeltchenko 	__u8     phy_handle;
693b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
694b078b564SAndrei Emeltchenko } __packed;
695b078b564SAndrei Emeltchenko 
696b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
697b078b564SAndrei Emeltchenko 	__u8     status;
698b078b564SAndrei Emeltchenko 	__u8     phy_handle;
699b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
700523e93cdSAndrei Emeltchenko } __packed;
701523e93cdSAndrei Emeltchenko 
7028c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
7038c9a041bSDoHyun Pyun struct hci_cp_set_csb {
7048c9a041bSDoHyun Pyun 	__u8	enable;
7058c9a041bSDoHyun Pyun 	__u8	lt_addr;
7068c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
7078c9a041bSDoHyun Pyun 	__le16	packet_type;
7088c9a041bSDoHyun Pyun 	__le16	interval_min;
7098c9a041bSDoHyun Pyun 	__le16	interval_max;
7108c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
7118c9a041bSDoHyun Pyun } __packed;
7128c9a041bSDoHyun Pyun struct hci_rp_set_csb {
7138c9a041bSDoHyun Pyun 	__u8	status;
7148c9a041bSDoHyun Pyun 	__u8	lt_addr;
7158c9a041bSDoHyun Pyun 	__le16	interval;
7168c9a041bSDoHyun Pyun } __packed;
7178c9a041bSDoHyun Pyun 
718cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
719cefded98SDoHyun Pyun 
720e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
721e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
722e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
723e2f99131SMarcel Holtmann 	__u8     hash192[16];
724e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
725e2f99131SMarcel Holtmann 	__u8     hash256[16];
726e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
727e2f99131SMarcel Holtmann } __packed;
728e2f99131SMarcel Holtmann 
729a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
730a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
731a9de9248SMarcel Holtmann 	__le16   handle;
732a9de9248SMarcel Holtmann 	__le16   max_interval;
733a9de9248SMarcel Holtmann 	__le16   min_interval;
734a9de9248SMarcel Holtmann 	__le16   attempt;
735a9de9248SMarcel Holtmann 	__le16   timeout;
73666c853ccSGustavo F. Padovan } __packed;
737a9de9248SMarcel Holtmann 
738a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
739a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
740a9de9248SMarcel Holtmann 	__le16   handle;
74166c853ccSGustavo F. Padovan } __packed;
742a9de9248SMarcel Holtmann 
743a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
744a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
745a9de9248SMarcel Holtmann 	__le16   handle;
74666c853ccSGustavo F. Padovan } __packed;
747a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
748a9de9248SMarcel Holtmann 	__u8     status;
749a9de9248SMarcel Holtmann 	__le16   handle;
750a9de9248SMarcel Holtmann 	__u8     role;
75166c853ccSGustavo F. Padovan } __packed;
752a9de9248SMarcel Holtmann 
753a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
754a9de9248SMarcel Holtmann struct hci_cp_switch_role {
755a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
756a9de9248SMarcel Holtmann 	__u8     role;
75766c853ccSGustavo F. Padovan } __packed;
758a9de9248SMarcel Holtmann 
759a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
760a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
761a9de9248SMarcel Holtmann 	__le16   handle;
76266c853ccSGustavo F. Padovan } __packed;
763a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
764a9de9248SMarcel Holtmann 	__u8     status;
765a9de9248SMarcel Holtmann 	__le16   handle;
766a9de9248SMarcel Holtmann 	__le16   policy;
76766c853ccSGustavo F. Padovan } __packed;
768a9de9248SMarcel Holtmann 
769a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
770a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
771a9de9248SMarcel Holtmann 	__le16   handle;
772a9de9248SMarcel Holtmann 	__le16   policy;
77366c853ccSGustavo F. Padovan } __packed;
774a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
775a9de9248SMarcel Holtmann 	__u8     status;
776a9de9248SMarcel Holtmann 	__le16   handle;
77766c853ccSGustavo F. Padovan } __packed;
778a9de9248SMarcel Holtmann 
779e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
780e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
781e4e8e37cSMarcel Holtmann 	__u8     status;
782e4e8e37cSMarcel Holtmann 	__le16   policy;
78366c853ccSGustavo F. Padovan } __packed;
784e4e8e37cSMarcel Holtmann 
785e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
786e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
787e4e8e37cSMarcel Holtmann 	__le16   policy;
78866c853ccSGustavo F. Padovan } __packed;
789e4e8e37cSMarcel Holtmann 
790a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
791a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
792a9de9248SMarcel Holtmann 	__le16   handle;
793a9de9248SMarcel Holtmann 	__le16   max_latency;
794a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
795a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
79666c853ccSGustavo F. Padovan } __packed;
797a9de9248SMarcel Holtmann 
798a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
799a9de9248SMarcel Holtmann 
800a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
801a9de9248SMarcel Holtmann 
802a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
8031da177e4SLinus Torvalds struct hci_cp_set_event_flt {
8041da177e4SLinus Torvalds 	__u8     flt_type;
8051da177e4SLinus Torvalds 	__u8     cond_type;
8061da177e4SLinus Torvalds 	__u8     condition[0];
80766c853ccSGustavo F. Padovan } __packed;
8081da177e4SLinus Torvalds 
8091da177e4SLinus Torvalds /* Filter types */
8101da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
8111da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
8121da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
8131da177e4SLinus Torvalds 
8141da177e4SLinus Torvalds /* CONN_SETUP Condition types */
8151da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
8161da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
8171da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
8181da177e4SLinus Torvalds 
8191da177e4SLinus Torvalds /* CONN_SETUP Conditions */
8201da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
8211da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
8221da177e4SLinus Torvalds 
823b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
824b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
825b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
826b0916ea0SJohan Hedberg 	__u8     delete_all;
827b0916ea0SJohan Hedberg } __packed;
828b0916ea0SJohan Hedberg 
8291f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
8301f6c6378SJohan Hedberg 
831a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
832a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
8331f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
83466c853ccSGustavo F. Padovan } __packed;
835a9de9248SMarcel Holtmann 
836a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
837a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
838a9de9248SMarcel Holtmann 	__u8     status;
8391f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
84066c853ccSGustavo F. Padovan } __packed;
841a9de9248SMarcel Holtmann 
842a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
843a9de9248SMarcel Holtmann 
844a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
845a9de9248SMarcel Holtmann 
846a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
847a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
848a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
849a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
850a9de9248SMarcel Holtmann 
851a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
852a9de9248SMarcel Holtmann 
853a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
854a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
855a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
856a9de9248SMarcel Holtmann 
857a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
858a9de9248SMarcel Holtmann 
859a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
860a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
861a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
862a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
863a9de9248SMarcel Holtmann 
864a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
865a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
8661da177e4SLinus Torvalds 	__u8     status;
8671da177e4SLinus Torvalds 	__u8     dev_class[3];
86866c853ccSGustavo F. Padovan } __packed;
8691da177e4SLinus Torvalds 
870a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
871a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
8721da177e4SLinus Torvalds 	__u8     dev_class[3];
87366c853ccSGustavo F. Padovan } __packed;
8741da177e4SLinus Torvalds 
875a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
8761da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
8771da177e4SLinus Torvalds 	__u8     status;
8781ebb9252SMarcel Holtmann 	__le16   voice_setting;
87966c853ccSGustavo F. Padovan } __packed;
8801da177e4SLinus Torvalds 
881a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
8821da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
8831ebb9252SMarcel Holtmann 	__le16   voice_setting;
88466c853ccSGustavo F. Padovan } __packed;
8851da177e4SLinus Torvalds 
886a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
8871da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
8881ebb9252SMarcel Holtmann 	__le16   acl_mtu;
8891da177e4SLinus Torvalds 	__u8     sco_mtu;
8901ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
8911ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
89266c853ccSGustavo F. Padovan } __packed;
8931da177e4SLinus Torvalds 
894b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
895b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
896b4cb9fb2SMarcel Holtmann 	__u8	status;
897b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
898b4cb9fb2SMarcel Holtmann } __packed;
899b4cb9fb2SMarcel Holtmann 
9004b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
9014b836f39SMarcel Holtmann 
9023d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
9033d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
9043d505312SMarcel Holtmann 	__u8	num_iac;
9053d505312SMarcel Holtmann 	__u8	iac_lap[6];
9063d505312SMarcel Holtmann } __packed;
9073d505312SMarcel Holtmann 
908d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
909d5859e22SJohan Hedberg 
91080a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
91180a1e1dbSJohan Hedberg 
91280a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
91380a1e1dbSJohan Hedberg struct hci_cp_write_eir {
914816a11d5SJohan Hedberg 	__u8	fec;
915816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
91680a1e1dbSJohan Hedberg } __packed;
91780a1e1dbSJohan Hedberg 
918333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
919333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
920333140b5SMarcel Holtmann 	__u8     status;
921333140b5SMarcel Holtmann 	__u8     mode;
92266c853ccSGustavo F. Padovan } __packed;
923333140b5SMarcel Holtmann 
924333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
925333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
926333140b5SMarcel Holtmann 	__u8     mode;
92766c853ccSGustavo F. Padovan } __packed;
928333140b5SMarcel Holtmann 
929c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
930c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
931c35938b2SSzymon Janc 	__u8     status;
932c35938b2SSzymon Janc 	__u8     hash[16];
933c35938b2SSzymon Janc 	__u8     randomizer[16];
934c35938b2SSzymon Janc } __packed;
935c35938b2SSzymon Janc 
936d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
93791c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
93891c4e9b1SMarcel Holtmann 	__u8     status;
93991c4e9b1SMarcel Holtmann 	__s8     tx_power;
94091c4e9b1SMarcel Holtmann } __packed;
941d5859e22SJohan Hedberg 
942d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
943d62e6d67SJohan Hedberg 
9447528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
9457528ca1cSMarcel Holtmann 
9461e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
9471e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
9481e89cffbSAndrei Emeltchenko 	__u8     status;
9491e89cffbSAndrei Emeltchenko 	__u8     mode;
9501e89cffbSAndrei Emeltchenko } __packed;
9511e89cffbSAndrei Emeltchenko 
952f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
953f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
954f9b49306SAndre Guedes 	__u8	le;
955f9b49306SAndre Guedes 	__u8	simul;
956f9b49306SAndre Guedes } __packed;
957f9b49306SAndre Guedes 
958d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
959d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
960d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
961d0bf75a5SDoHyun Pyun } __packed;
962d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
963d0bf75a5SDoHyun Pyun 	__u8	status;
964d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
965d0bf75a5SDoHyun Pyun } __packed;
966d0bf75a5SDoHyun Pyun 
9676a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
9686a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
9696a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9706a20eaf4SDoHyun Pyun } __packed;
9716a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
9726a20eaf4SDoHyun Pyun 	__u8	status;
9736a20eaf4SDoHyun Pyun 	__u8	lt_addr;
9746a20eaf4SDoHyun Pyun } __packed;
9756a20eaf4SDoHyun Pyun 
9767d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
9777d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
9787d1dab49SDoHyun Pyun 	__u8	lt_addr;
9797d1dab49SDoHyun Pyun 	__u8	fragment;
9807d1dab49SDoHyun Pyun 	__u8	data_length;
9817d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
9827d1dab49SDoHyun Pyun } __packed;
9837d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
9847d1dab49SDoHyun Pyun 	__u8	status;
9857d1dab49SDoHyun Pyun 	__u8	lt_addr;
9867d1dab49SDoHyun Pyun } __packed;
9877d1dab49SDoHyun Pyun 
9885d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
9895d4e7e8dSJohan Hedberg 
990a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
991a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
992a9b07a64SDoHyun Pyun 	__le16	interval_min;
993a9b07a64SDoHyun Pyun 	__le16	interval_max;
994a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
995a9b07a64SDoHyun Pyun 	__u8	service_data;
996a9b07a64SDoHyun Pyun } __packed;
997a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
998a9b07a64SDoHyun Pyun 	__u8	status;
999a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
1000a9b07a64SDoHyun Pyun } __packed;
1001a9b07a64SDoHyun Pyun 
1002eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
1003eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
1004eb4b95c6SMarcel Holtmann 	__u8	status;
1005eb4b95c6SMarcel Holtmann 	__u8	support;
1006eb4b95c6SMarcel Holtmann } __packed;
1007eb4b95c6SMarcel Holtmann 
1008eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
1009eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
1010eb4b95c6SMarcel Holtmann 	__u8	support;
1011eb4b95c6SMarcel Holtmann } __packed;
1012eb4b95c6SMarcel Holtmann 
1013e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
1014e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
1015e2f99131SMarcel Holtmann 	__u8     status;
1016e2f99131SMarcel Holtmann 	__u8     hash192[16];
1017e2f99131SMarcel Holtmann 	__u8     randomizer192[16];
1018e2f99131SMarcel Holtmann 	__u8     hash256[16];
1019e2f99131SMarcel Holtmann 	__u8     randomizer256[16];
1020e2f99131SMarcel Holtmann } __packed;
1021e2f99131SMarcel Holtmann 
1022a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
1023a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
10241da177e4SLinus Torvalds 	__u8     status;
1025a9de9248SMarcel Holtmann 	__u8     hci_ver;
1026a9de9248SMarcel Holtmann 	__le16   hci_rev;
1027a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1028a9de9248SMarcel Holtmann 	__le16   manufacturer;
1029a9de9248SMarcel Holtmann 	__le16   lmp_subver;
103066c853ccSGustavo F. Padovan } __packed;
10311da177e4SLinus Torvalds 
1032a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
1033a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
10341da177e4SLinus Torvalds 	__u8     status;
1035a9de9248SMarcel Holtmann 	__u8     commands[64];
103666c853ccSGustavo F. Padovan } __packed;
10371da177e4SLinus Torvalds 
1038a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1039a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1040a9de9248SMarcel Holtmann 	__u8     status;
1041a9de9248SMarcel Holtmann 	__u8     features[8];
104266c853ccSGustavo F. Padovan } __packed;
1043a9de9248SMarcel Holtmann 
1044a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1045971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1046971e3a4bSAndre Guedes 	__u8     page;
1047971e3a4bSAndre Guedes } __packed;
1048a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1049a9de9248SMarcel Holtmann 	__u8     status;
1050a9de9248SMarcel Holtmann 	__u8     page;
1051a9de9248SMarcel Holtmann 	__u8     max_page;
1052a9de9248SMarcel Holtmann 	__u8     features[8];
105366c853ccSGustavo F. Padovan } __packed;
1054a9de9248SMarcel Holtmann 
1055a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1056a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1057a9de9248SMarcel Holtmann 	__u8     status;
1058a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1059a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1060a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1061a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
106266c853ccSGustavo F. Padovan } __packed;
1063a9de9248SMarcel Holtmann 
1064a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1065a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1066a9de9248SMarcel Holtmann 	__u8     status;
10671da177e4SLinus Torvalds 	bdaddr_t bdaddr;
106866c853ccSGustavo F. Padovan } __packed;
10691da177e4SLinus Torvalds 
1070350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1071350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1072350ee4cfSAndrei Emeltchenko 	__u8     status;
1073350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1074350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1075350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1076350ee4cfSAndrei Emeltchenko } __packed;
1077350ee4cfSAndrei Emeltchenko 
1078109e3191SMarcel Holtmann #define HCI_OP_READ_LOCAL_CODECS	0x100b
1079109e3191SMarcel Holtmann 
1080f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1081f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1082f332ec66SJohan Hedberg 	__u8     status;
1083f332ec66SJohan Hedberg 	__le16   interval;
1084f332ec66SJohan Hedberg 	__le16   window;
1085f332ec66SJohan Hedberg } __packed;
1086f332ec66SJohan Hedberg 
1087f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1088f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1089f6422ec6SAntti Julku 	__le16   interval;
1090f6422ec6SAntti Julku 	__le16   window;
1091f6422ec6SAntti Julku } __packed;
1092f6422ec6SAntti Julku 
10935a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
10945a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
10955a134faeSAndrzej Kaczmarek 	__le16   handle;
10965a134faeSAndrzej Kaczmarek 	__u8     type;
10975a134faeSAndrzej Kaczmarek } __packed;
10985a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
10995a134faeSAndrzej Kaczmarek 	__u8     status;
11005a134faeSAndrzej Kaczmarek 	__le16   handle;
11015a134faeSAndrzej Kaczmarek 	__s8     tx_power;
11025a134faeSAndrzej Kaczmarek } __packed;
11035a134faeSAndrzej Kaczmarek 
1104f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1105f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1106f332ec66SJohan Hedberg 	__u8     status;
1107f332ec66SJohan Hedberg 	__u8     type;
1108f332ec66SJohan Hedberg } __packed;
1109f332ec66SJohan Hedberg 
1110f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1111f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1112f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1113f6422ec6SAntti Julku 
11145ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
11155ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
11165ae76a94SAndrzej Kaczmarek 	__le16   handle;
11175ae76a94SAndrzej Kaczmarek } __packed;
11185ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
11195ae76a94SAndrzej Kaczmarek 	__u8     status;
11205ae76a94SAndrzej Kaczmarek 	__le16   handle;
11215ae76a94SAndrzej Kaczmarek 	__s8     rssi;
11225ae76a94SAndrzej Kaczmarek } __packed;
11235ae76a94SAndrzej Kaczmarek 
112433f35721SJohan Hedberg #define HCI_OP_READ_CLOCK		0x1407
112533f35721SJohan Hedberg struct hci_cp_read_clock {
112633f35721SJohan Hedberg 	__le16   handle;
112733f35721SJohan Hedberg 	__u8     which;
112833f35721SJohan Hedberg } __packed;
112933f35721SJohan Hedberg struct hci_rp_read_clock {
113033f35721SJohan Hedberg 	__u8     status;
113133f35721SJohan Hedberg 	__le16   handle;
113233f35721SJohan Hedberg 	__le32   clock;
113333f35721SJohan Hedberg 	__le16   accuracy;
113433f35721SJohan Hedberg } __packed;
113533f35721SJohan Hedberg 
1136928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1137928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1138928abaa7SAndrei Emeltchenko 	__u8     status;
1139928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1140928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1141928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1142928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1143928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1144928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1145928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1146928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1147928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1148928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1149928abaa7SAndrei Emeltchenko } __packed;
1150928abaa7SAndrei Emeltchenko 
1151523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1152523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1153523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1154523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1155523e93cdSAndrei Emeltchenko 	__le16   max_len;
1156523e93cdSAndrei Emeltchenko } __packed;
1157523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1158523e93cdSAndrei Emeltchenko 	__u8     status;
1159523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1160523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1161523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1162523e93cdSAndrei Emeltchenko } __packed;
1163523e93cdSAndrei Emeltchenko 
1164523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1165523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1166523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1167523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1168523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1169523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1170523e93cdSAndrei Emeltchenko } __packed;
1171523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1172523e93cdSAndrei Emeltchenko 	__u8     status;
1173523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1174523e93cdSAndrei Emeltchenko } __packed;
1175523e93cdSAndrei Emeltchenko 
1176f4fe73edSMarcel Holtmann #define HCI_OP_GET_MWS_TRANSPORT_CONFIG	0x140c
1177f4fe73edSMarcel Holtmann 
11784b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
11794b4148e9SMarcel Holtmann 
118006f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
118106f5b778SMarcel Holtmann 
118263185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
118363185f64SVille Tervo struct hci_cp_le_set_event_mask {
118463185f64SVille Tervo 	__u8     mask[8];
118563185f64SVille Tervo } __packed;
118663185f64SVille Tervo 
118763185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
118863185f64SVille Tervo struct hci_rp_le_read_buffer_size {
118963185f64SVille Tervo 	__u8     status;
119063185f64SVille Tervo 	__le16   le_mtu;
119163185f64SVille Tervo 	__u8     le_max_pkt;
119263185f64SVille Tervo } __packed;
119363185f64SVille Tervo 
119460e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
119560e77321SJohan Hedberg struct hci_rp_le_read_local_features {
119660e77321SJohan Hedberg 	__u8     status;
119760e77321SJohan Hedberg 	__u8     features[8];
119860e77321SJohan Hedberg } __packed;
119960e77321SJohan Hedberg 
1200d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1201d13eafceSMarcel Holtmann 
12021e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
12031e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
12041e191893SMarcel Holtmann 	__le16   min_interval;
12051e191893SMarcel Holtmann 	__le16   max_interval;
12061e191893SMarcel Holtmann 	__u8     type;
12071e191893SMarcel Holtmann 	__u8     own_address_type;
12081e191893SMarcel Holtmann 	__u8     direct_addr_type;
12091e191893SMarcel Holtmann 	bdaddr_t direct_addr;
12101e191893SMarcel Holtmann 	__u8     channel_map;
12111e191893SMarcel Holtmann 	__u8     filter_policy;
12121e191893SMarcel Holtmann } __packed;
12131e191893SMarcel Holtmann 
12148fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
12158fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
12168fa19098SJohan Hedberg 	__u8	status;
12178fa19098SJohan Hedberg 	__s8	tx_power;
12188fa19098SJohan Hedberg } __packed;
12198fa19098SJohan Hedberg 
12203f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
12213f0f524bSJohan Hedberg 
12223f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
12233f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
12243f0f524bSJohan Hedberg 	__u8	length;
12253f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
12263f0f524bSJohan Hedberg } __packed;
12273f0f524bSJohan Hedberg 
1228f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1229f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1230f14d8f64SMarcel Holtmann 	__u8	length;
1231f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1232f14d8f64SMarcel Holtmann } __packed;
1233f14d8f64SMarcel Holtmann 
1234c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1235c1d5dc4aSJohan Hedberg 
12365df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
12375df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
12385df480b5SAndre Guedes 
123907f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
124007f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
124107f7fa5dSAndre Guedes 	__u8    type;
124207f7fa5dSAndre Guedes 	__le16  interval;
124307f7fa5dSAndre Guedes 	__le16  window;
124407f7fa5dSAndre Guedes 	__u8    own_address_type;
124507f7fa5dSAndre Guedes 	__u8    filter_policy;
124607f7fa5dSAndre Guedes } __packed;
124707f7fa5dSAndre Guedes 
124876a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
124976a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1250525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1251525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
125268a8aea4SAndrei Emeltchenko 
1253eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1254eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1255eb9d91f5SAndre Guedes 	__u8     enable;
1256eb9d91f5SAndre Guedes 	__u8     filter_dup;
1257eb9d91f5SAndre Guedes } __packed;
1258eb9d91f5SAndre Guedes 
1259a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1260a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1261a7139eddSJohan Hedberg 
126263185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
126363185f64SVille Tervo struct hci_cp_le_create_conn {
126463185f64SVille Tervo 	__le16   scan_interval;
126563185f64SVille Tervo 	__le16   scan_window;
126663185f64SVille Tervo 	__u8     filter_policy;
126763185f64SVille Tervo 	__u8     peer_addr_type;
126863185f64SVille Tervo 	bdaddr_t peer_addr;
126963185f64SVille Tervo 	__u8     own_address_type;
127063185f64SVille Tervo 	__le16   conn_interval_min;
127163185f64SVille Tervo 	__le16   conn_interval_max;
127263185f64SVille Tervo 	__le16   conn_latency;
127363185f64SVille Tervo 	__le16   supervision_timeout;
127463185f64SVille Tervo 	__le16   min_ce_len;
127563185f64SVille Tervo 	__le16   max_ce_len;
127663185f64SVille Tervo } __packed;
127763185f64SVille Tervo 
127863185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
127963185f64SVille Tervo 
1280cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1281cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1282cf1d081fSJohan Hedberg 	__u8	status;
1283cf1d081fSJohan Hedberg 	__u8	size;
1284cf1d081fSJohan Hedberg } __packed;
1285cf1d081fSJohan Hedberg 
1286d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1287d9a7b0a5SMarcel Holtmann 
1288d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1289d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1290d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1291d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1292d9a7b0a5SMarcel Holtmann } __packed;
1293d9a7b0a5SMarcel Holtmann 
1294d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1295d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1296d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1297d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1298d9a7b0a5SMarcel Holtmann } __packed;
1299d9a7b0a5SMarcel Holtmann 
13002ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
13012ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
13022ce603ebSClaudio Takahasi 	__le16   handle;
13032ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
13042ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
13052ce603ebSClaudio Takahasi 	__le16   conn_latency;
13062ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
13072ce603ebSClaudio Takahasi 	__le16   min_ce_len;
13082ce603ebSClaudio Takahasi 	__le16   max_ce_len;
13092ce603ebSClaudio Takahasi } __packed;
13102ce603ebSClaudio Takahasi 
1311a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1312a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1313a7a595f6SVinicius Costa Gomes 	__le16	handle;
1314fe39c7b2SMarcel Holtmann 	__le64	rand;
1315a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1316a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1317a7a595f6SVinicius Costa Gomes } __packed;
1318a7a595f6SVinicius Costa Gomes 
1319a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1320a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1321a7a595f6SVinicius Costa Gomes 	__le16	handle;
1322a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1323a7a595f6SVinicius Costa Gomes } __packed;
1324a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1325a7a595f6SVinicius Costa Gomes 	__u8	status;
1326a7a595f6SVinicius Costa Gomes 	__le16	handle;
1327a7a595f6SVinicius Costa Gomes } __packed;
1328a7a595f6SVinicius Costa Gomes 
1329a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1330a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1331a7a595f6SVinicius Costa Gomes 	__le16	handle;
1332a7a595f6SVinicius Costa Gomes } __packed;
1333a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1334a7a595f6SVinicius Costa Gomes 	__u8	status;
1335a7a595f6SVinicius Costa Gomes 	__le16	handle;
1336a7a595f6SVinicius Costa Gomes } __packed;
1337a7a595f6SVinicius Costa Gomes 
13389b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
13399b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
13409b008c04SJohan Hedberg 	__u8	status;
13419b008c04SJohan Hedberg 	__u8	le_states[8];
13429b008c04SJohan Hedberg } __packed;
13439b008c04SJohan Hedberg 
13448e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_REPLY	0x2020
13458e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_reply {
13468e75b46aSAndre Guedes 	__le16	handle;
13478e75b46aSAndre Guedes 	__le16	interval_min;
13488e75b46aSAndre Guedes 	__le16	interval_max;
13498e75b46aSAndre Guedes 	__le16	latency;
13508e75b46aSAndre Guedes 	__le16	timeout;
13518e75b46aSAndre Guedes 	__le16	min_ce_len;
13528e75b46aSAndre Guedes 	__le16	max_ce_len;
13538e75b46aSAndre Guedes } __packed;
13548e75b46aSAndre Guedes 
13558e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY	0x2021
13568e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_neg_reply {
13578e75b46aSAndre Guedes 	__le16	handle;
13588e75b46aSAndre Guedes 	__u8	reason;
13598e75b46aSAndre Guedes } __packed;
13608e75b46aSAndre Guedes 
13611da177e4SLinus Torvalds /* ---- HCI Events ---- */
13621da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
13631da177e4SLinus Torvalds 
13641da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
13651da177e4SLinus Torvalds struct inquiry_info {
13661da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13671da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
13681da177e4SLinus Torvalds 	__u8     pscan_period_mode;
13691da177e4SLinus Torvalds 	__u8     pscan_mode;
13701da177e4SLinus Torvalds 	__u8     dev_class[3];
13711ebb9252SMarcel Holtmann 	__le16   clock_offset;
137266c853ccSGustavo F. Padovan } __packed;
13731da177e4SLinus Torvalds 
13741da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
13751da177e4SLinus Torvalds struct hci_ev_conn_complete {
13761da177e4SLinus Torvalds 	__u8     status;
13771ebb9252SMarcel Holtmann 	__le16   handle;
13781da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13791da177e4SLinus Torvalds 	__u8     link_type;
13801da177e4SLinus Torvalds 	__u8     encr_mode;
138166c853ccSGustavo F. Padovan } __packed;
13821da177e4SLinus Torvalds 
13831da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
13841da177e4SLinus Torvalds struct hci_ev_conn_request {
13851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
13861da177e4SLinus Torvalds 	__u8     dev_class[3];
13871da177e4SLinus Torvalds 	__u8     link_type;
138866c853ccSGustavo F. Padovan } __packed;
13891da177e4SLinus Torvalds 
13901da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
13911da177e4SLinus Torvalds struct hci_ev_disconn_complete {
13921da177e4SLinus Torvalds 	__u8     status;
13931ebb9252SMarcel Holtmann 	__le16   handle;
13941da177e4SLinus Torvalds 	__u8     reason;
139566c853ccSGustavo F. Padovan } __packed;
13961da177e4SLinus Torvalds 
13971da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
13981da177e4SLinus Torvalds struct hci_ev_auth_complete {
13991da177e4SLinus Torvalds 	__u8     status;
14001ebb9252SMarcel Holtmann 	__le16   handle;
140166c853ccSGustavo F. Padovan } __packed;
14021da177e4SLinus Torvalds 
1403a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1404a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1405a9de9248SMarcel Holtmann 	__u8     status;
1406a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
14071f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
140866c853ccSGustavo F. Padovan } __packed;
1409a9de9248SMarcel Holtmann 
14101da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
14111da177e4SLinus Torvalds struct hci_ev_encrypt_change {
14121da177e4SLinus Torvalds 	__u8     status;
14131ebb9252SMarcel Holtmann 	__le16   handle;
14141da177e4SLinus Torvalds 	__u8     encrypt;
141566c853ccSGustavo F. Padovan } __packed;
14161da177e4SLinus Torvalds 
1417a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1418a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
14191da177e4SLinus Torvalds 	__u8     status;
14201ebb9252SMarcel Holtmann 	__le16   handle;
142166c853ccSGustavo F. Padovan } __packed;
14221da177e4SLinus Torvalds 
1423a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1424a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1425a9de9248SMarcel Holtmann 	__u8     status;
1426a9de9248SMarcel Holtmann 	__le16   handle;
1427a9de9248SMarcel Holtmann 	__u8     features[8];
142866c853ccSGustavo F. Padovan } __packed;
1429a9de9248SMarcel Holtmann 
1430a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1431a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1432a9de9248SMarcel Holtmann 	__u8     status;
1433a9de9248SMarcel Holtmann 	__le16   handle;
1434a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1435a9de9248SMarcel Holtmann 	__le16   manufacturer;
1436a9de9248SMarcel Holtmann 	__le16   lmp_subver;
143766c853ccSGustavo F. Padovan } __packed;
1438a9de9248SMarcel Holtmann 
1439a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
14401da177e4SLinus Torvalds struct hci_qos {
14411da177e4SLinus Torvalds 	__u8     service_type;
14421da177e4SLinus Torvalds 	__u32    token_rate;
14431da177e4SLinus Torvalds 	__u32    peak_bandwidth;
14441da177e4SLinus Torvalds 	__u32    latency;
14451da177e4SLinus Torvalds 	__u32    delay_variation;
144666c853ccSGustavo F. Padovan } __packed;
14471da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
14481da177e4SLinus Torvalds 	__u8     status;
14491ebb9252SMarcel Holtmann 	__le16   handle;
14501da177e4SLinus Torvalds 	struct   hci_qos qos;
145166c853ccSGustavo F. Padovan } __packed;
14521da177e4SLinus Torvalds 
1453a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
14541da177e4SLinus Torvalds struct hci_ev_cmd_complete {
14551da177e4SLinus Torvalds 	__u8     ncmd;
14561ebb9252SMarcel Holtmann 	__le16   opcode;
145766c853ccSGustavo F. Padovan } __packed;
14581da177e4SLinus Torvalds 
1459a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
14601da177e4SLinus Torvalds struct hci_ev_cmd_status {
14611da177e4SLinus Torvalds 	__u8     status;
14621da177e4SLinus Torvalds 	__u8     ncmd;
14631ebb9252SMarcel Holtmann 	__le16   opcode;
146466c853ccSGustavo F. Padovan } __packed;
14651da177e4SLinus Torvalds 
14661da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
14671da177e4SLinus Torvalds struct hci_ev_role_change {
14681da177e4SLinus Torvalds 	__u8     status;
14691da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14701da177e4SLinus Torvalds 	__u8     role;
147166c853ccSGustavo F. Padovan } __packed;
14721da177e4SLinus Torvalds 
1473a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1474613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1475613a1c0cSAndrei Emeltchenko 	__le16   handle;
1476613a1c0cSAndrei Emeltchenko 	__le16   count;
1477613a1c0cSAndrei Emeltchenko } __packed;
1478613a1c0cSAndrei Emeltchenko 
1479a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1480a9de9248SMarcel Holtmann 	__u8     num_hndl;
1481613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
148266c853ccSGustavo F. Padovan } __packed;
1483a9de9248SMarcel Holtmann 
14841da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
14851da177e4SLinus Torvalds struct hci_ev_mode_change {
14861da177e4SLinus Torvalds 	__u8     status;
14871ebb9252SMarcel Holtmann 	__le16   handle;
14881da177e4SLinus Torvalds 	__u8     mode;
14891ebb9252SMarcel Holtmann 	__le16   interval;
149066c853ccSGustavo F. Padovan } __packed;
14911da177e4SLinus Torvalds 
14921da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
14931da177e4SLinus Torvalds struct hci_ev_pin_code_req {
14941da177e4SLinus Torvalds 	bdaddr_t bdaddr;
149566c853ccSGustavo F. Padovan } __packed;
14961da177e4SLinus Torvalds 
14971da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
14981da177e4SLinus Torvalds struct hci_ev_link_key_req {
14991da177e4SLinus Torvalds 	bdaddr_t bdaddr;
150066c853ccSGustavo F. Padovan } __packed;
15011da177e4SLinus Torvalds 
15021da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
15031da177e4SLinus Torvalds struct hci_ev_link_key_notify {
15041da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15059b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
15061da177e4SLinus Torvalds 	__u8     key_type;
150766c853ccSGustavo F. Padovan } __packed;
15081da177e4SLinus Torvalds 
1509a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
15101da177e4SLinus Torvalds struct hci_ev_clock_offset {
15111da177e4SLinus Torvalds 	__u8     status;
15121ebb9252SMarcel Holtmann 	__le16   handle;
15131ebb9252SMarcel Holtmann 	__le16   clock_offset;
151466c853ccSGustavo F. Padovan } __packed;
15151da177e4SLinus Torvalds 
1516a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1517a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1518a8746417SMarcel Holtmann 	__u8     status;
1519a8746417SMarcel Holtmann 	__le16   handle;
1520a8746417SMarcel Holtmann 	__le16   pkt_type;
152166c853ccSGustavo F. Padovan } __packed;
1522a8746417SMarcel Holtmann 
152385a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
152485a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
152585a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
152685a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
152766c853ccSGustavo F. Padovan } __packed;
152885a1e930SMarcel Holtmann 
1529a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1530a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1531a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1532a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1533a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1534a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1535a9de9248SMarcel Holtmann 	__le16   clock_offset;
1536a9de9248SMarcel Holtmann 	__s8     rssi;
153766c853ccSGustavo F. Padovan } __packed;
1538a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1539a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1540a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1541a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1542a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1543a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1544a9de9248SMarcel Holtmann 	__le16   clock_offset;
1545a9de9248SMarcel Holtmann 	__s8     rssi;
154666c853ccSGustavo F. Padovan } __packed;
1547a9de9248SMarcel Holtmann 
1548a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1549a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1550a9de9248SMarcel Holtmann 	__u8     status;
1551a9de9248SMarcel Holtmann 	__le16   handle;
1552a9de9248SMarcel Holtmann 	__u8     page;
1553a9de9248SMarcel Holtmann 	__u8     max_page;
1554a9de9248SMarcel Holtmann 	__u8     features[8];
155566c853ccSGustavo F. Padovan } __packed;
1556a9de9248SMarcel Holtmann 
1557a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1558a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1559a9de9248SMarcel Holtmann 	__u8     status;
1560a9de9248SMarcel Holtmann 	__le16   handle;
1561a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1562a9de9248SMarcel Holtmann 	__u8     link_type;
1563a9de9248SMarcel Holtmann 	__u8     tx_interval;
1564a9de9248SMarcel Holtmann 	__u8     retrans_window;
1565a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1566a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1567a9de9248SMarcel Holtmann 	__u8     air_mode;
156866c853ccSGustavo F. Padovan } __packed;
1569a9de9248SMarcel Holtmann 
1570a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1571a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1572a9de9248SMarcel Holtmann 	__u8     status;
1573a9de9248SMarcel Holtmann 	__le16   handle;
1574a9de9248SMarcel Holtmann 	__u8     tx_interval;
1575a9de9248SMarcel Holtmann 	__u8     retrans_window;
1576a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1577a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
157866c853ccSGustavo F. Padovan } __packed;
1579a9de9248SMarcel Holtmann 
1580a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
158104837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
158204837f64SMarcel Holtmann 	__u8     status;
158304837f64SMarcel Holtmann 	__le16   handle;
158404837f64SMarcel Holtmann 	__le16   max_tx_latency;
158504837f64SMarcel Holtmann 	__le16   max_rx_latency;
158604837f64SMarcel Holtmann 	__le16   max_remote_timeout;
158704837f64SMarcel Holtmann 	__le16   max_local_timeout;
158866c853ccSGustavo F. Padovan } __packed;
158904837f64SMarcel Holtmann 
1590a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1591a9de9248SMarcel Holtmann struct extended_inquiry_info {
1592a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1593a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1594a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1595a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1596a9de9248SMarcel Holtmann 	__le16   clock_offset;
1597a9de9248SMarcel Holtmann 	__s8     rssi;
1598a9de9248SMarcel Holtmann 	__u8     data[240];
159966c853ccSGustavo F. Padovan } __packed;
1600a9de9248SMarcel Holtmann 
16011c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
16021c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
16031c2e0041SJohan Hedberg 	__u8	status;
16041c2e0041SJohan Hedberg 	__le16	handle;
16051c2e0041SJohan Hedberg } __packed;
16061c2e0041SJohan Hedberg 
16070493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
16080493684eSMarcel Holtmann struct hci_ev_io_capa_request {
16090493684eSMarcel Holtmann 	bdaddr_t bdaddr;
161066c853ccSGustavo F. Padovan } __packed;
16110493684eSMarcel Holtmann 
161203b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
161303b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
161403b555e1SJohan Hedberg 	bdaddr_t bdaddr;
161503b555e1SJohan Hedberg 	__u8     capability;
161603b555e1SJohan Hedberg 	__u8     oob_data;
161703b555e1SJohan Hedberg 	__u8     authentication;
161803b555e1SJohan Hedberg } __packed;
161903b555e1SJohan Hedberg 
1620a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1621a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1622a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1623a5c29683SJohan Hedberg 	__le32		passkey;
1624a5c29683SJohan Hedberg } __packed;
1625a5c29683SJohan Hedberg 
16269ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
16279ad4019aSBrian Gix struct hci_ev_user_passkey_req {
16289ad4019aSBrian Gix 	bdaddr_t	bdaddr;
16299ad4019aSBrian Gix } __packed;
16309ad4019aSBrian Gix 
16312763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
16322763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
16332763eda6SSzymon Janc 	bdaddr_t bdaddr;
16342763eda6SSzymon Janc } __packed;
16352763eda6SSzymon Janc 
16360493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
16370493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
16380493684eSMarcel Holtmann 	__u8     status;
16390493684eSMarcel Holtmann 	bdaddr_t bdaddr;
164066c853ccSGustavo F. Padovan } __packed;
16410493684eSMarcel Holtmann 
164292a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
164392a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
164492a25256SJohan Hedberg 	bdaddr_t	bdaddr;
164592a25256SJohan Hedberg 	__le32		passkey;
164692a25256SJohan Hedberg } __packed;
164792a25256SJohan Hedberg 
164892a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
164992a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
165092a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
165192a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
165292a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
165392a25256SJohan Hedberg 
165492a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
165592a25256SJohan Hedberg struct hci_ev_keypress_notify {
165692a25256SJohan Hedberg 	bdaddr_t	bdaddr;
165792a25256SJohan Hedberg 	__u8		type;
165892a25256SJohan Hedberg } __packed;
165992a25256SJohan Hedberg 
166041a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
166141a96212SMarcel Holtmann struct hci_ev_remote_host_features {
166241a96212SMarcel Holtmann 	bdaddr_t bdaddr;
166341a96212SMarcel Holtmann 	__u8     features[8];
166466c853ccSGustavo F. Padovan } __packed;
166541a96212SMarcel Holtmann 
166663185f64SVille Tervo #define HCI_EV_LE_META			0x3e
166763185f64SVille Tervo struct hci_ev_le_meta {
166863185f64SVille Tervo 	__u8     subevent;
166963185f64SVille Tervo } __packed;
167063185f64SVille Tervo 
1671523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1672523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1673523e93cdSAndrei Emeltchenko 	__u8     status;
1674523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1675523e93cdSAndrei Emeltchenko } __packed;
1676523e93cdSAndrei Emeltchenko 
1677523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1678523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1679523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1680523e93cdSAndrei Emeltchenko } __packed;
1681523e93cdSAndrei Emeltchenko 
1682523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1683523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1684523e93cdSAndrei Emeltchenko 	__u8     status;
1685523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1686523e93cdSAndrei Emeltchenko 	__u8     reason;
1687523e93cdSAndrei Emeltchenko } __packed;
1688523e93cdSAndrei Emeltchenko 
1689523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1690523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1691523e93cdSAndrei Emeltchenko 	__u8     status;
1692523e93cdSAndrei Emeltchenko 	__le16   handle;
1693523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1694523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1695523e93cdSAndrei Emeltchenko } __packed;
1696523e93cdSAndrei Emeltchenko 
1697523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1698523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1699523e93cdSAndrei Emeltchenko 	__u8     status;
1700523e93cdSAndrei Emeltchenko 	__le16   handle;
1701523e93cdSAndrei Emeltchenko 	__u8     reason;
1702523e93cdSAndrei Emeltchenko } __packed;
1703523e93cdSAndrei Emeltchenko 
170425e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
170525e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
170625e89e99SAndrei Emeltchenko 	__le16   handle;
170725e89e99SAndrei Emeltchenko 	__le16   pkts;
170825e89e99SAndrei Emeltchenko 	__le16   blocks;
170925e89e99SAndrei Emeltchenko } __packed;
171025e89e99SAndrei Emeltchenko 
171125e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
171225e89e99SAndrei Emeltchenko 	__le16   num_blocks;
171325e89e99SAndrei Emeltchenko 	__u8     num_hndl;
171425e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
171525e89e99SAndrei Emeltchenko } __packed;
171625e89e99SAndrei Emeltchenko 
17172b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
17182b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
17192b359445SDoHyun Pyun 	__u8	status;
17202b359445SDoHyun Pyun } __packed;
17212b359445SDoHyun Pyun 
17222ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
17232ed01805SDoHyun Pyun 
172463185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
172563185f64SVille Tervo struct hci_ev_le_conn_complete {
172663185f64SVille Tervo 	__u8     status;
172763185f64SVille Tervo 	__le16   handle;
172863185f64SVille Tervo 	__u8     role;
172963185f64SVille Tervo 	__u8     bdaddr_type;
173063185f64SVille Tervo 	bdaddr_t bdaddr;
173163185f64SVille Tervo 	__le16   interval;
173263185f64SVille Tervo 	__le16   latency;
173363185f64SVille Tervo 	__le16   supervision_timeout;
173463185f64SVille Tervo 	__u8     clk_accurancy;
173563185f64SVille Tervo } __packed;
173663185f64SVille Tervo 
17371855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
17381855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
17391855d92dSMarcel Holtmann 	__u8     status;
17401855d92dSMarcel Holtmann 	__le16   handle;
17411855d92dSMarcel Holtmann 	__le16   interval;
17421855d92dSMarcel Holtmann 	__le16   latency;
17431855d92dSMarcel Holtmann 	__le16   supervision_timeout;
17441855d92dSMarcel Holtmann } __packed;
17451855d92dSMarcel Holtmann 
1746a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1747a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1748a7a595f6SVinicius Costa Gomes 	__le16	handle;
1749fe39c7b2SMarcel Holtmann 	__le64	rand;
1750a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1751a7a595f6SVinicius Costa Gomes } __packed;
1752a7a595f6SVinicius Costa Gomes 
17538e75b46aSAndre Guedes #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ	0x06
17548e75b46aSAndre Guedes struct hci_ev_le_remote_conn_param_req {
17558e75b46aSAndre Guedes 	__le16 handle;
17568e75b46aSAndre Guedes 	__le16 interval_min;
17578e75b46aSAndre Guedes 	__le16 interval_max;
17588e75b46aSAndre Guedes 	__le16 latency;
17598e75b46aSAndre Guedes 	__le16 timeout;
17608e75b46aSAndre Guedes } __packed;
17618e75b46aSAndre Guedes 
176257a56fd4SAnderson Briglia /* Advertising report event types */
1763db3aebf4SMarcel Holtmann #define LE_ADV_IND		0x00
1764db3aebf4SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
1765db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
1766db3aebf4SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
1767db3aebf4SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
176857a56fd4SAnderson Briglia 
176957a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
177057a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
177157a56fd4SAnderson Briglia 
177257a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
177357a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
177457a56fd4SAnderson Briglia 	__u8	 evt_type;
177557a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
177657a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
177757a56fd4SAnderson Briglia 	__u8	 length;
177857a56fd4SAnderson Briglia 	__u8	 data[0];
177957a56fd4SAnderson Briglia } __packed;
178057a56fd4SAnderson Briglia 
17811da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1782a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
17831da177e4SLinus Torvalds struct hci_ev_stack_internal {
17841da177e4SLinus Torvalds 	__u16    type;
17851da177e4SLinus Torvalds 	__u8     data[0];
178666c853ccSGustavo F. Padovan } __packed;
17871da177e4SLinus Torvalds 
17881da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
17891da177e4SLinus Torvalds struct hci_ev_si_device {
17901da177e4SLinus Torvalds 	__u16    event;
17911da177e4SLinus Torvalds 	__u16    dev_id;
179266c853ccSGustavo F. Padovan } __packed;
17931da177e4SLinus Torvalds 
17941da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
17951da177e4SLinus Torvalds struct hci_ev_si_security {
17961da177e4SLinus Torvalds 	__u16    event;
17971da177e4SLinus Torvalds 	__u16    proto;
17981da177e4SLinus Torvalds 	__u16    subproto;
17991da177e4SLinus Torvalds 	__u8     incoming;
180066c853ccSGustavo F. Padovan } __packed;
18011da177e4SLinus Torvalds 
18021da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
18031da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
18041da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
18051da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
18061da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
18071da177e4SLinus Torvalds 
18081da177e4SLinus Torvalds struct hci_command_hdr {
18091ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
18101da177e4SLinus Torvalds 	__u8	plen;
181166c853ccSGustavo F. Padovan } __packed;
18121da177e4SLinus Torvalds 
18131da177e4SLinus Torvalds struct hci_event_hdr {
18141da177e4SLinus Torvalds 	__u8	evt;
18151da177e4SLinus Torvalds 	__u8	plen;
181666c853ccSGustavo F. Padovan } __packed;
18171da177e4SLinus Torvalds 
18181da177e4SLinus Torvalds struct hci_acl_hdr {
18191ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
18201ebb9252SMarcel Holtmann 	__le16	dlen;
182166c853ccSGustavo F. Padovan } __packed;
18221da177e4SLinus Torvalds 
18231da177e4SLinus Torvalds struct hci_sco_hdr {
18241ebb9252SMarcel Holtmann 	__le16	handle;
18251da177e4SLinus Torvalds 	__u8	dlen;
182666c853ccSGustavo F. Padovan } __packed;
18271da177e4SLinus Torvalds 
18282a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
18292a123b86SArnaldo Carvalho de Melo {
18302a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
18312a123b86SArnaldo Carvalho de Melo }
18322a123b86SArnaldo Carvalho de Melo 
18332a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
18342a123b86SArnaldo Carvalho de Melo {
18352a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
18362a123b86SArnaldo Carvalho de Melo }
18372a123b86SArnaldo Carvalho de Melo 
18382a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
18392a123b86SArnaldo Carvalho de Melo {
18402a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
18412a123b86SArnaldo Carvalho de Melo }
18422a123b86SArnaldo Carvalho de Melo 
18431da177e4SLinus Torvalds /* Command opcode pack/unpack */
1844c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
18451da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
18461da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
18471da177e4SLinus Torvalds 
18481da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1849c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
18501da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
18511da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
18521da177e4SLinus Torvalds 
18531da177e4SLinus Torvalds #endif /* __HCI_H */
1854