xref: /openbmc/linux/include/net/bluetooth/hci.h (revision d619ffcfbd07983d34dc87d474af6cb5c21adf27)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds    BlueZ - Bluetooth protocol stack for Linux
31da177e4SLinus Torvalds    Copyright (C) 2000-2001 Qualcomm Incorporated
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
61da177e4SLinus Torvalds 
71da177e4SLinus Torvalds    This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds    it under the terms of the GNU General Public License version 2 as
91da177e4SLinus Torvalds    published by the Free Software Foundation;
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
121da177e4SLinus Torvalds    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131da177e4SLinus Torvalds    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
141da177e4SLinus Torvalds    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
151da177e4SLinus Torvalds    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
161da177e4SLinus Torvalds    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171da177e4SLinus Torvalds    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
181da177e4SLinus Torvalds    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
211da177e4SLinus Torvalds    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
221da177e4SLinus Torvalds    SOFTWARE IS DISCLAIMED.
231da177e4SLinus Torvalds */
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds #ifndef __HCI_H
261da177e4SLinus Torvalds #define __HCI_H
271da177e4SLinus Torvalds 
281da177e4SLinus Torvalds #define HCI_MAX_ACL_SIZE	1024
291da177e4SLinus Torvalds #define HCI_MAX_SCO_SIZE	255
301da177e4SLinus Torvalds #define HCI_MAX_EVENT_SIZE	260
311da177e4SLinus Torvalds #define HCI_MAX_FRAME_SIZE	(HCI_MAX_ACL_SIZE + 4)
321da177e4SLinus Torvalds 
339b3b4460SAndrei Emeltchenko #define HCI_LINK_KEY_SIZE	16
34523e93cdSAndrei Emeltchenko #define HCI_AMP_LINK_KEY_SIZE	(2 * HCI_LINK_KEY_SIZE)
359b3b4460SAndrei Emeltchenko 
36903e4541SAndrei Emeltchenko #define HCI_MAX_AMP_ASSOC_SIZE	672
37903e4541SAndrei Emeltchenko 
387d1dab49SDoHyun Pyun #define HCI_MAX_CSB_DATA_SIZE	252
397d1dab49SDoHyun Pyun 
401da177e4SLinus Torvalds /* HCI dev events */
411da177e4SLinus Torvalds #define HCI_DEV_REG			1
421da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
431da177e4SLinus Torvalds #define HCI_DEV_UP			3
441da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
451da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
461da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
471da177e4SLinus Torvalds 
481da177e4SLinus Torvalds /* HCI notify events */
491da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
501da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
511da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
521da177e4SLinus Torvalds 
53c13854ceSMarcel Holtmann /* HCI bus types */
540ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
551da177e4SLinus Torvalds #define HCI_USB		1
561da177e4SLinus Torvalds #define HCI_PCCARD	2
571da177e4SLinus Torvalds #define HCI_UART	3
581da177e4SLinus Torvalds #define HCI_RS232	4
591da177e4SLinus Torvalds #define HCI_PCI		5
600ac53939SMarcel Holtmann #define HCI_SDIO	6
611da177e4SLinus Torvalds 
62943da25dSMarcel Holtmann /* HCI controller types */
63943da25dSMarcel Holtmann #define HCI_BREDR	0x00
648f1e1742SDavid Vrabel #define HCI_AMP		0x01
65943da25dSMarcel Holtmann 
668598d064SAndrei Emeltchenko /* First BR/EDR Controller shall have ID = 0 */
676ed971caSMarcel Holtmann #define AMP_ID_BREDR	0x00
688598d064SAndrei Emeltchenko 
697c13823dSMarcel Holtmann /* AMP controller types */
707c13823dSMarcel Holtmann #define AMP_TYPE_BREDR	0x00
717c13823dSMarcel Holtmann #define AMP_TYPE_80211	0x01
727c13823dSMarcel Holtmann 
73ab846ec4SAndrei Emeltchenko /* AMP controller status */
74536619e8SMarcel Holtmann #define AMP_STATUS_POWERED_DOWN			0x00
75536619e8SMarcel Holtmann #define AMP_STATUS_BLUETOOTH_ONLY		0x01
76536619e8SMarcel Holtmann #define AMP_STATUS_NO_CAPACITY			0x02
77536619e8SMarcel Holtmann #define AMP_STATUS_LOW_CAPACITY			0x03
78536619e8SMarcel Holtmann #define AMP_STATUS_MEDIUM_CAPACITY		0x04
79536619e8SMarcel Holtmann #define AMP_STATUS_HIGH_CAPACITY		0x05
80536619e8SMarcel Holtmann #define AMP_STATUS_FULL_CAPACITY		0x06
81ab846ec4SAndrei Emeltchenko 
821da177e4SLinus Torvalds /* HCI device quirks */
831da177e4SLinus Torvalds enum {
84118305b5SMarcel Holtmann 	/* When this quirk is set, the HCI Reset command is send when
85118305b5SMarcel Holtmann 	 * closing the transport instead of when opening it.
86118305b5SMarcel Holtmann 	 *
87118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
88118305b5SMarcel Holtmann 	 */
89a6c511c6SSzymon Janc 	HCI_QUIRK_RESET_ON_CLOSE,
90118305b5SMarcel Holtmann 
91118305b5SMarcel Holtmann 	/* When this quirk is set, the device is turned into a raw-only
92118305b5SMarcel Holtmann 	 * device and it will stay in unconfigured state.
93118305b5SMarcel Holtmann 	 *
94118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
95118305b5SMarcel Holtmann 	 */
96da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
97118305b5SMarcel Holtmann 
98118305b5SMarcel Holtmann 	/* When this quirk is set, the buffer sizes reported by
99118305b5SMarcel Holtmann 	 * HCI Read Buffer Size command are corrected if invalid.
100118305b5SMarcel Holtmann 	 *
101118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
102118305b5SMarcel Holtmann 	 */
103f9f462faSMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE,
104118305b5SMarcel Holtmann 
105043ec9bfSMarcel Holtmann 	/* When this quirk is set, then a controller that does not
106043ec9bfSMarcel Holtmann 	 * indicate support for Inquiry Result with RSSI is assumed to
107043ec9bfSMarcel Holtmann 	 * support it anyway. Some early Bluetooth 1.2 controllers had
108043ec9bfSMarcel Holtmann 	 * wrongly configured local features that will require forcing
109043ec9bfSMarcel Holtmann 	 * them to enable this mode. Getting RSSI information with the
110043ec9bfSMarcel Holtmann 	 * inquiry responses is preferred since it allows for a better
111043ec9bfSMarcel Holtmann 	 * user expierence.
112043ec9bfSMarcel Holtmann 	 *
113043ec9bfSMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
114043ec9bfSMarcel Holtmann 	 */
115043ec9bfSMarcel Holtmann 	HCI_QUIRK_FIXUP_INQUIRY_MODE,
116043ec9bfSMarcel Holtmann 
117711ffa78SMarcel Holtmann 	/* When this quirk is set, then the HCI Read Local Supported
118711ffa78SMarcel Holtmann 	 * Commands command is not supported. In general Bluetooth 1.2
119711ffa78SMarcel Holtmann 	 * and later controllers should support this command. However
120711ffa78SMarcel Holtmann 	 * some controllers indicate Bluetooth 1.2 support, but do
121711ffa78SMarcel Holtmann 	 * not support this command.
122711ffa78SMarcel Holtmann 	 *
123711ffa78SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
124711ffa78SMarcel Holtmann 	 */
125711ffa78SMarcel Holtmann 	HCI_QUIRK_BROKEN_LOCAL_COMMANDS,
126711ffa78SMarcel Holtmann 
127118305b5SMarcel Holtmann 	/* When this quirk is set, then no stored link key handling
128118305b5SMarcel Holtmann 	 * is performed. This is mainly due to the fact that the
129118305b5SMarcel Holtmann 	 * HCI Delete Stored Link Key command is advertised, but
130118305b5SMarcel Holtmann 	 * not supported.
131118305b5SMarcel Holtmann 	 *
132118305b5SMarcel Holtmann 	 * This quirk must be set before hci_register_dev is called.
133118305b5SMarcel Holtmann 	 */
134f9f462faSMarcel Holtmann 	HCI_QUIRK_BROKEN_STORED_LINK_KEY,
13589bc22d2SMarcel Holtmann 
136eb1904f4SMarcel Holtmann 	/* When this quirk is set, an external configuration step
137eb1904f4SMarcel Holtmann 	 * is required and will be indicated with the controller
138eb1904f4SMarcel Holtmann 	 * configuation.
139eb1904f4SMarcel Holtmann 	 *
140eb1904f4SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
141eb1904f4SMarcel Holtmann 	 * during the hdev->setup vendor callback.
142eb1904f4SMarcel Holtmann 	 */
143eb1904f4SMarcel Holtmann 	HCI_QUIRK_EXTERNAL_CONFIG,
144eb1904f4SMarcel Holtmann 
14589bc22d2SMarcel Holtmann 	/* When this quirk is set, the public Bluetooth address
14689bc22d2SMarcel Holtmann 	 * initially reported by HCI Read BD Address command
14789bc22d2SMarcel Holtmann 	 * is considered invalid. Controller configuration is
14889bc22d2SMarcel Holtmann 	 * required before this device can be used.
14989bc22d2SMarcel Holtmann 	 *
15089bc22d2SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
15189bc22d2SMarcel Holtmann 	 * during the hdev->setup vendor callback.
15289bc22d2SMarcel Holtmann 	 */
15389bc22d2SMarcel Holtmann 	HCI_QUIRK_INVALID_BDADDR,
15443d6bc46SMarcel Holtmann 
15543d6bc46SMarcel Holtmann 	/* When this quirk is set, the duplicate filtering during
15643d6bc46SMarcel Holtmann 	 * scanning is based on Bluetooth devices addresses. To allow
15743d6bc46SMarcel Holtmann 	 * RSSI based updates, restart scanning if needed.
15843d6bc46SMarcel Holtmann 	 *
15943d6bc46SMarcel Holtmann 	 * This quirk can be set before hci_register_dev is called or
16043d6bc46SMarcel Holtmann 	 * during the hdev->setup vendor callback.
16143d6bc46SMarcel Holtmann 	 */
16243d6bc46SMarcel Holtmann 	HCI_QUIRK_STRICT_DUPLICATE_FILTER,
163695c4cb6SJakub Pawlowski 
164695c4cb6SJakub Pawlowski 	/* When this quirk is set, LE scan and BR/EDR inquiry is done
165695c4cb6SJakub Pawlowski 	 * simultaneously, otherwise it's interleaved.
166695c4cb6SJakub Pawlowski 	 *
167695c4cb6SJakub Pawlowski 	 * This quirk can be set before hci_register_dev is called or
168695c4cb6SJakub Pawlowski 	 * during the hdev->setup vendor callback.
169695c4cb6SJakub Pawlowski 	 */
170695c4cb6SJakub Pawlowski 	HCI_QUIRK_SIMULTANEOUS_DISCOVERY,
1711da177e4SLinus Torvalds };
1721da177e4SLinus Torvalds 
1731da177e4SLinus Torvalds /* HCI device flags */
1741da177e4SLinus Torvalds enum {
1751da177e4SLinus Torvalds 	HCI_UP,
1761da177e4SLinus Torvalds 	HCI_INIT,
1771da177e4SLinus Torvalds 	HCI_RUNNING,
1781da177e4SLinus Torvalds 
1791da177e4SLinus Torvalds 	HCI_PSCAN,
1801da177e4SLinus Torvalds 	HCI_ISCAN,
1811da177e4SLinus Torvalds 	HCI_AUTH,
1821da177e4SLinus Torvalds 	HCI_ENCRYPT,
1831da177e4SLinus Torvalds 	HCI_INQUIRY,
1841da177e4SLinus Torvalds 
1851da177e4SLinus Torvalds 	HCI_RAW,
186ab81cbf9SJohan Hedberg 
18710572132SGustavo F. Padovan 	HCI_RESET,
1881da177e4SLinus Torvalds };
1891da177e4SLinus Torvalds 
190f9207338SMarcel Holtmann /* HCI socket flags */
191f9207338SMarcel Holtmann enum {
19250ebc055SMarcel Holtmann 	HCI_SOCK_TRUSTED,
193f9207338SMarcel Holtmann 	HCI_MGMT_INDEX_EVENTS,
194f9207338SMarcel Holtmann 	HCI_MGMT_UNCONF_INDEX_EVENTS,
195ced85549SMarcel Holtmann 	HCI_MGMT_EXT_INDEX_EVENTS,
196f6b7712eSMarcel Holtmann 	HCI_MGMT_GENERIC_EVENTS,
19772000df2SMarcel Holtmann 	HCI_MGMT_OOB_DATA_EVENTS,
198f9207338SMarcel Holtmann };
199f9207338SMarcel Holtmann 
200d23264a8SAndre Guedes /*
201d23264a8SAndre Guedes  * BR/EDR and/or LE controller flags: the flags defined here should represent
202d23264a8SAndre Guedes  * states from the controller.
203d23264a8SAndre Guedes  */
204d23264a8SAndre Guedes enum {
205a8b2d5c2SJohan Hedberg 	HCI_SETUP,
206d603b76bSMarcel Holtmann 	HCI_CONFIG,
207a8b2d5c2SJohan Hedberg 	HCI_AUTO_OFF,
2085e130367SJohan Hedberg 	HCI_RFKILLED,
209a8b2d5c2SJohan Hedberg 	HCI_MGMT,
210b6ae8457SJohan Hedberg 	HCI_BONDABLE,
211a8b2d5c2SJohan Hedberg 	HCI_SERVICE_CACHE,
2120663b297SJohan Hedberg 	HCI_KEEP_DEBUG_KEYS,
2133769972bSJohan Hedberg 	HCI_USE_DEBUG_KEYS,
21494324962SJohan Hovold 	HCI_UNREGISTER,
2154a964404SMarcel Holtmann 	HCI_UNCONFIGURED,
2160736cfa8SMarcel Holtmann 	HCI_USER_CHANNEL,
217dbece37aSMarcel Holtmann 	HCI_EXT_CONFIGURED,
21866c417c1SJohan Hedberg 	HCI_LE_ADV,
219d23264a8SAndre Guedes 	HCI_LE_SCAN,
22084bde9d6SJohan Hedberg 	HCI_SSP_ENABLED,
221e98d2ce2SMarcel Holtmann 	HCI_SC_ENABLED,
222134c2a89SMarcel Holtmann 	HCI_SC_ONLY,
223863efaf2SJohan Hedberg 	HCI_PRIVACY,
224d6bfd59cSJohan Hedberg 	HCI_RPA_EXPIRED,
22541edf160SJohan Hedberg 	HCI_RPA_RESOLVING,
2266d80dfd0SJohan Hedberg 	HCI_HS_ENABLED,
22706199cf8SJohan Hedberg 	HCI_LE_ENABLED,
228f3d3444aSJohan Hedberg 	HCI_ADVERTISING,
229cc91cb04SMarcel Holtmann 	HCI_ADVERTISING_CONNECTABLE,
2304453b006SArman Uguray 	HCI_ADVERTISING_INSTANCE,
2315e5282bbSJohan Hedberg 	HCI_CONNECTABLE,
2325e5282bbSJohan Hedberg 	HCI_DISCOVERABLE,
2336acd7db4SMarcel Holtmann 	HCI_LIMITED_DISCOVERABLE,
23447990ea0SJohan Hedberg 	HCI_LINK_SECURITY,
23521693c15SAndre Guedes 	HCI_PERIODIC_INQ,
2361a4d3c4bSJohan Hedberg 	HCI_FAST_CONNECTABLE,
23756f87901SJohan Hedberg 	HCI_BREDR_ENABLED,
23881ad6fd9SJohan Hedberg 	HCI_LE_SCAN_INTERRUPTED,
239b7cb93e5SMarcel Holtmann 
240b7cb93e5SMarcel Holtmann 	HCI_DUT_MODE,
241b7cb93e5SMarcel Holtmann 	HCI_FORCE_BREDR_SMP,
242b7cb93e5SMarcel Holtmann 	HCI_FORCE_STATIC_ADDR,
243b7cb93e5SMarcel Holtmann 
244eacb44dfSMarcel Holtmann 	__HCI_NUM_FLAGS,
245d23264a8SAndre Guedes };
246d23264a8SAndre Guedes 
2471da177e4SLinus Torvalds /* HCI timeouts */
2485f246e89SAndrei Emeltchenko #define HCI_DISCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2495f246e89SAndrei Emeltchenko #define HCI_PAIRING_TIMEOUT	msecs_to_jiffies(60000)	/* 60 seconds */
2505f246e89SAndrei Emeltchenko #define HCI_INIT_TIMEOUT	msecs_to_jiffies(10000)	/* 10 seconds */
251d1244adcSSzymon Janc #define HCI_CMD_TIMEOUT		msecs_to_jiffies(2000)	/* 2 seconds */
2525f246e89SAndrei Emeltchenko #define HCI_ACL_TX_TIMEOUT	msecs_to_jiffies(45000)	/* 45 seconds */
2539345d40cSAndrei Emeltchenko #define HCI_AUTO_OFF_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
254a3172b7eSJohan Hedberg #define HCI_POWER_OFF_TIMEOUT	msecs_to_jiffies(5000)	/* 5 seconds */
2559489eca4SJohan Hedberg #define HCI_LE_CONN_TIMEOUT	msecs_to_jiffies(20000)	/* 20 seconds */
25609ae260bSJohan Hedberg #define HCI_LE_AUTOCONN_TIMEOUT	msecs_to_jiffies(2000)	/* 2 seconds */
2571da177e4SLinus Torvalds 
2585b7f9909SMarcel Holtmann /* HCI data types */
2591da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
2601da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
2611da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
2621da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
2631da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
2641da177e4SLinus Torvalds 
2655b7f9909SMarcel Holtmann /* HCI packet types */
2661da177e4SLinus Torvalds #define HCI_DM1		0x0008
2671da177e4SLinus Torvalds #define HCI_DM3		0x0400
2681da177e4SLinus Torvalds #define HCI_DM5		0x4000
2691da177e4SLinus Torvalds #define HCI_DH1		0x0010
2701da177e4SLinus Torvalds #define HCI_DH3		0x0800
2711da177e4SLinus Torvalds #define HCI_DH5		0x8000
2721da177e4SLinus Torvalds 
2731da177e4SLinus Torvalds #define HCI_HV1		0x0020
2741da177e4SLinus Torvalds #define HCI_HV2		0x0040
2751da177e4SLinus Torvalds #define HCI_HV3		0x0080
2761da177e4SLinus Torvalds 
2771da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
2781da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
2791da177e4SLinus Torvalds 
2805b7f9909SMarcel Holtmann /* eSCO packet types */
2815b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
2825b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
2835b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
2845b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
2855b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
2865b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
287efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
288efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
289efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
290efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
2915b7f9909SMarcel Holtmann 
292a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
293efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
294a8746417SMarcel Holtmann 
2951da177e4SLinus Torvalds /* ACL flags */
296e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
2971da177e4SLinus Torvalds #define ACL_CONT		0x01
2981da177e4SLinus Torvalds #define ACL_START		0x02
299d73a0988SAndrei Emeltchenko #define ACL_COMPLETE		0x03
3001da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
3011da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
3021da177e4SLinus Torvalds 
3031da177e4SLinus Torvalds /* Baseband links */
3041da177e4SLinus Torvalds #define SCO_LINK	0x00
3051da177e4SLinus Torvalds #define ACL_LINK	0x01
3065b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
307fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
308fcd89c09SVille Tervo #define LE_LINK		0x80
3093161ae1cSAndrei Emeltchenko #define AMP_LINK	0x81
310845472e8SMarcel Holtmann #define INVALID_LINK	0xff
3111da177e4SLinus Torvalds 
3121da177e4SLinus Torvalds /* LMP features */
3131da177e4SLinus Torvalds #define LMP_3SLOT	0x01
3141da177e4SLinus Torvalds #define LMP_5SLOT	0x02
3151da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
3161da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
3171da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
3181da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
3191da177e4SLinus Torvalds #define LMP_HOLD	0x40
32004837f64SMarcel Holtmann #define LMP_SNIFF	0x80
3211da177e4SLinus Torvalds 
3221da177e4SLinus Torvalds #define LMP_PARK	0x01
3231da177e4SLinus Torvalds #define LMP_RSSI	0x02
3241da177e4SLinus Torvalds #define LMP_QUALITY	0x04
3251da177e4SLinus Torvalds #define LMP_SCO		0x08
3261da177e4SLinus Torvalds #define LMP_HV2		0x10
3271da177e4SLinus Torvalds #define LMP_HV3		0x20
3281da177e4SLinus Torvalds #define LMP_ULAW	0x40
3291da177e4SLinus Torvalds #define LMP_ALAW	0x80
3301da177e4SLinus Torvalds 
3311da177e4SLinus Torvalds #define LMP_CVSD	0x01
3321da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
3331da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
33407a5c61eSFrédéric Dalleau #define LMP_TRANSPARENT	0x08
3351da177e4SLinus Torvalds 
336d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
3375b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
3385b7f9909SMarcel Holtmann 
3395b7f9909SMarcel Holtmann #define LMP_EV4		0x01
3405b7f9909SMarcel Holtmann #define LMP_EV5		0x02
34169ab39eaSJohan Hedberg #define LMP_NO_BREDR	0x20
342d5859e22SJohan Hedberg #define LMP_LE		0x40
3435b7f9909SMarcel Holtmann 
34404837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
345d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
346efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
347efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
348efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
34904837f64SMarcel Holtmann 
350d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
351e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
352769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
353e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
354769be974SMarcel Holtmann 
355d5859e22SJohan Hedberg #define LMP_LSTO	0x01
356d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
357971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
358d5859e22SJohan Hedberg 
359eead27daSAndre Guedes /* Extended LMP features */
36053b834d2SMarcel Holtmann #define LMP_CSB_MASTER	0x01
36153b834d2SMarcel Holtmann #define LMP_CSB_SLAVE	0x02
36253b834d2SMarcel Holtmann #define LMP_SYNC_TRAIN	0x04
36353b834d2SMarcel Holtmann #define LMP_SYNC_SCAN	0x08
36453b834d2SMarcel Holtmann 
365d5991585SMarcel Holtmann #define LMP_SC		0x01
366d5991585SMarcel Holtmann #define LMP_PING	0x02
367d5991585SMarcel Holtmann 
36853b834d2SMarcel Holtmann /* Host features */
369cc2c04ecSJohan Hedberg #define LMP_HOST_SSP		0x01
370eead27daSAndre Guedes #define LMP_HOST_LE		0x02
371cc2c04ecSJohan Hedberg #define LMP_HOST_LE_BREDR	0x04
372d5991585SMarcel Holtmann #define LMP_HOST_SC		0x08
373eead27daSAndre Guedes 
374662bc2e6SAndre Guedes /* LE features */
3750da71f1bSMarcel Holtmann #define HCI_LE_ENCRYPTION		0x01
376662bc2e6SAndre Guedes #define HCI_LE_CONN_PARAM_REQ_PROC	0x02
377cd7ca0ecSMarcel Holtmann #define HCI_LE_PING			0x10
37894a3bd02SMarcel Holtmann #define HCI_LE_DATA_LEN_EXT		0x20
3794b71bba4SMarcel Holtmann #define HCI_LE_EXT_SCAN_POLICY		0x80
380662bc2e6SAndre Guedes 
38104837f64SMarcel Holtmann /* Connection modes */
38204837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
38304837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
38404837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
38504837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
38604837f64SMarcel Holtmann 
3871da177e4SLinus Torvalds /* Link policies */
3881da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
3891da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
3901da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
3911da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
3921da177e4SLinus Torvalds 
39304837f64SMarcel Holtmann /* Link modes */
3941da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
3951da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
3961da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
3971da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
3981da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
3991da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
4001da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
4017b5a9241SMarcel Holtmann #define HCI_LM_FIPS	0x0040
4021da177e4SLinus Torvalds 
40340be492fSMarcel Holtmann /* Authentication types */
40440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
40540be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
40640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
40740be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
40840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
40940be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
41040be492fSMarcel Holtmann 
411a77b15a6SMikel Astiz /* I/O capabilities */
412a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_ONLY	0x00
413a77b15a6SMikel Astiz #define HCI_IO_DISPLAY_YESNO	0x01
414a77b15a6SMikel Astiz #define HCI_IO_KEYBOARD_ONLY	0x02
415a77b15a6SMikel Astiz #define HCI_IO_NO_INPUT_OUTPUT	0x03
416a77b15a6SMikel Astiz 
417b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
418b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
419b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
420b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
421b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
42211015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P192	0x04
42311015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P192	0x05
424b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
42511015c79SMarcel Holtmann #define HCI_LK_UNAUTH_COMBINATION_P256	0x07
42611015c79SMarcel Holtmann #define HCI_LK_AUTH_COMBINATION_P256	0x08
427b6020ba0SWaldemar Rymarkiewicz 
4289f5a0d7bSAndrei Emeltchenko /* ---- HCI Error Codes ---- */
4298e75b46aSAndre Guedes #define HCI_ERROR_UNKNOWN_CONN_ID	0x02
4309f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_AUTH_FAILURE		0x05
4312acf3d90SAndre Guedes #define HCI_ERROR_MEMORY_EXCEEDED	0x07
432cdcba7c6SMikel Astiz #define HCI_ERROR_CONNECTION_TIMEOUT	0x08
433d41c15cfSJohan Hedberg #define HCI_ERROR_REJ_LIMITED_RESOURCES	0x0d
4349f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REJ_BAD_ADDR		0x0f
4359f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_REMOTE_USER_TERM	0x13
436cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_LOW_RESOURCES	0x14
437cdcba7c6SMikel Astiz #define HCI_ERROR_REMOTE_POWER_OFF	0x15
4389f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_LOCAL_HOST_TERM	0x16
4399f5a0d7bSAndrei Emeltchenko #define HCI_ERROR_PAIRING_NOT_ALLOWED	0x18
4408e75b46aSAndre Guedes #define HCI_ERROR_INVALID_LL_PARAMS	0x1E
4413c857757SJohan Hedberg #define HCI_ERROR_ADVERTISING_TIMEOUT	0x3c
4429f5a0d7bSAndrei Emeltchenko 
4432455a3eaSAndrei Emeltchenko /* Flow control modes */
4442455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_PACKET_BASED	0x00
4452455a3eaSAndrei Emeltchenko #define HCI_FLOW_CTL_MODE_BLOCK_BASED	0x01
4462455a3eaSAndrei Emeltchenko 
447bbaf444aSJohan Hedberg /* The core spec defines 127 as the "not available" value */
448bbaf444aSJohan Hedberg #define HCI_TX_POWER_INVALID	127
449a89612aaSMarcel Holtmann #define HCI_RSSI_INVALID	127
450bbaf444aSJohan Hedberg 
451ba165a90SJohan Hedberg #define HCI_ROLE_MASTER		0x00
452ba165a90SJohan Hedberg #define HCI_ROLE_SLAVE		0x01
453ba165a90SJohan Hedberg 
45432748db0SJohan Hedberg /* Extended Inquiry Response field types */
45532748db0SJohan Hedberg #define EIR_FLAGS		0x01 /* flags */
45632748db0SJohan Hedberg #define EIR_UUID16_SOME		0x02 /* 16-bit UUID, more available */
45732748db0SJohan Hedberg #define EIR_UUID16_ALL		0x03 /* 16-bit UUID, all listed */
45832748db0SJohan Hedberg #define EIR_UUID32_SOME		0x04 /* 32-bit UUID, more available */
45932748db0SJohan Hedberg #define EIR_UUID32_ALL		0x05 /* 32-bit UUID, all listed */
46032748db0SJohan Hedberg #define EIR_UUID128_SOME	0x06 /* 128-bit UUID, more available */
46132748db0SJohan Hedberg #define EIR_UUID128_ALL		0x07 /* 128-bit UUID, all listed */
46232748db0SJohan Hedberg #define EIR_NAME_SHORT		0x08 /* shortened local name */
46332748db0SJohan Hedberg #define EIR_NAME_COMPLETE	0x09 /* complete local name */
46432748db0SJohan Hedberg #define EIR_TX_POWER		0x0A /* transmit power level */
4659ec9fc8aSJohan Hedberg #define EIR_CLASS_OF_DEV	0x0D /* Class of Device */
466*d619ffcfSJohan Hedberg #define EIR_SSP_HASH_C192	0x0E /* Simple Pairing Hash C-192 */
467*d619ffcfSJohan Hedberg #define EIR_SSP_RAND_R192	0x0F /* Simple Pairing Randomizer R-192 */
46832748db0SJohan Hedberg #define EIR_DEVICE_ID		0x10 /* device ID */
4694453b006SArman Uguray #define EIR_APPEARANCE		0x19 /* Device appearance */
4701471aae0SMarcel Holtmann #define EIR_LE_BDADDR		0x1B /* LE Bluetooth device address */
4711471aae0SMarcel Holtmann #define EIR_LE_ROLE		0x1C /* LE role */
472*d619ffcfSJohan Hedberg #define EIR_SSP_HASH_C256	0x1D /* Simple Pairing Hash C-256 */
473*d619ffcfSJohan Hedberg #define EIR_SSP_RAND_R256	0x1E /* Simple Pairing Rand R-256 */
474f709bfcfSMarcel Holtmann #define EIR_LE_SC_CONFIRM	0x22 /* LE SC Confirmation Value */
475f709bfcfSMarcel Holtmann #define EIR_LE_SC_RANDOM	0x23 /* LE SC Random Value */
47632748db0SJohan Hedberg 
4773f0f524bSJohan Hedberg /* Low Energy Advertising Flags */
4783f0f524bSJohan Hedberg #define LE_AD_LIMITED		0x01 /* Limited Discoverable */
4793f0f524bSJohan Hedberg #define LE_AD_GENERAL		0x02 /* General Discoverable */
4803f0f524bSJohan Hedberg #define LE_AD_NO_BREDR		0x04 /* BR/EDR not supported */
4813f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_CTRL	0x08 /* Simultaneous LE & BR/EDR Controller */
4823f0f524bSJohan Hedberg #define LE_AD_SIM_LE_BREDR_HOST	0x10 /* Simultaneous LE & BR/EDR Host */
4833f0f524bSJohan Hedberg 
4841da177e4SLinus Torvalds /* -----  HCI Commands ---- */
4856bd32326SVille Tervo #define HCI_OP_NOP			0x0000
4866bd32326SVille Tervo 
487a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
488a9de9248SMarcel Holtmann struct hci_cp_inquiry {
489a9de9248SMarcel Holtmann 	__u8     lap[3];
490a9de9248SMarcel Holtmann 	__u8     length;
491a9de9248SMarcel Holtmann 	__u8     num_rsp;
49266c853ccSGustavo F. Padovan } __packed;
4931da177e4SLinus Torvalds 
494a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
495a9de9248SMarcel Holtmann 
49679d6e068SAndre Guedes #define HCI_OP_PERIODIC_INQ		0x0403
49779d6e068SAndre Guedes 
498a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
499a9de9248SMarcel Holtmann 
500a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
501a9de9248SMarcel Holtmann struct hci_cp_create_conn {
502a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
503a9de9248SMarcel Holtmann 	__le16   pkt_type;
504a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
505a9de9248SMarcel Holtmann 	__u8     pscan_mode;
506a9de9248SMarcel Holtmann 	__le16   clock_offset;
507a9de9248SMarcel Holtmann 	__u8     role_switch;
50866c853ccSGustavo F. Padovan } __packed;
5091da177e4SLinus Torvalds 
510a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
511a9de9248SMarcel Holtmann struct hci_cp_disconnect {
512a9de9248SMarcel Holtmann 	__le16   handle;
513a9de9248SMarcel Holtmann 	__u8     reason;
51466c853ccSGustavo F. Padovan } __packed;
5151da177e4SLinus Torvalds 
516a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
517a9de9248SMarcel Holtmann struct hci_cp_add_sco {
518a9de9248SMarcel Holtmann 	__le16   handle;
519a9de9248SMarcel Holtmann 	__le16   pkt_type;
52066c853ccSGustavo F. Padovan } __packed;
521a9de9248SMarcel Holtmann 
522a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
523a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
5241da177e4SLinus Torvalds 	bdaddr_t bdaddr;
52566c853ccSGustavo F. Padovan } __packed;
5261da177e4SLinus Torvalds 
527a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
528a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
529a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
530a9de9248SMarcel Holtmann 	__u8     role;
53166c853ccSGustavo F. Padovan } __packed;
5321da177e4SLinus Torvalds 
533a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
534a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
535a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
536a9de9248SMarcel Holtmann 	__u8     reason;
53766c853ccSGustavo F. Padovan } __packed;
5381da177e4SLinus Torvalds 
539a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
540a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
541a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
5429b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
54366c853ccSGustavo F. Padovan } __packed;
5441da177e4SLinus Torvalds 
545a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
546a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
547a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
54866c853ccSGustavo F. Padovan } __packed;
5491da177e4SLinus Torvalds 
550a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
551a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
552a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
553a9de9248SMarcel Holtmann 	__u8     pin_len;
554a9de9248SMarcel Holtmann 	__u8     pin_code[16];
55566c853ccSGustavo F. Padovan } __packed;
556980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
557980e1a53SJohan Hedberg 	__u8     status;
558980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
559980e1a53SJohan Hedberg } __packed;
560a9de9248SMarcel Holtmann 
561a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
562a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
563a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
56466c853ccSGustavo F. Padovan } __packed;
565980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
566980e1a53SJohan Hedberg 	__u8     status;
567980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
568980e1a53SJohan Hedberg } __packed;
569a9de9248SMarcel Holtmann 
570a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
571a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
572a9de9248SMarcel Holtmann 	__le16   handle;
573a9de9248SMarcel Holtmann 	__le16   pkt_type;
57466c853ccSGustavo F. Padovan } __packed;
575a9de9248SMarcel Holtmann 
576a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
577a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
578a9de9248SMarcel Holtmann 	__le16   handle;
57966c853ccSGustavo F. Padovan } __packed;
580a9de9248SMarcel Holtmann 
581a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
582a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
583a9de9248SMarcel Holtmann 	__le16   handle;
584a9de9248SMarcel Holtmann 	__u8     encrypt;
58566c853ccSGustavo F. Padovan } __packed;
586a9de9248SMarcel Holtmann 
587a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
588a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
589a9de9248SMarcel Holtmann 	__le16   handle;
59066c853ccSGustavo F. Padovan } __packed;
591a9de9248SMarcel Holtmann 
592a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
593a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
594a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
595a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
596a9de9248SMarcel Holtmann 	__u8     pscan_mode;
597a9de9248SMarcel Holtmann 	__le16   clock_offset;
59866c853ccSGustavo F. Padovan } __packed;
599a9de9248SMarcel Holtmann 
600a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
601a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
602a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
60366c853ccSGustavo F. Padovan } __packed;
604a9de9248SMarcel Holtmann 
605a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
606a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
607a9de9248SMarcel Holtmann 	__le16   handle;
60866c853ccSGustavo F. Padovan } __packed;
609a9de9248SMarcel Holtmann 
610a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
611a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
612a9de9248SMarcel Holtmann 	__le16   handle;
613a9de9248SMarcel Holtmann 	__u8     page;
61466c853ccSGustavo F. Padovan } __packed;
615a9de9248SMarcel Holtmann 
616a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
617a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
618a9de9248SMarcel Holtmann 	__le16   handle;
61966c853ccSGustavo F. Padovan } __packed;
620a9de9248SMarcel Holtmann 
621df935429SMarcel Holtmann #define HCI_OP_READ_CLOCK_OFFSET	0x041f
622df935429SMarcel Holtmann struct hci_cp_read_clock_offset {
623df935429SMarcel Holtmann 	__le16   handle;
624df935429SMarcel Holtmann } __packed;
625df935429SMarcel Holtmann 
626a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
627a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
628a9de9248SMarcel Holtmann 	__le16   handle;
629a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
630a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
631a9de9248SMarcel Holtmann 	__le16   max_latency;
632a9de9248SMarcel Holtmann 	__le16   voice_setting;
633a9de9248SMarcel Holtmann 	__u8     retrans_effort;
634a9de9248SMarcel Holtmann 	__le16   pkt_type;
63566c853ccSGustavo F. Padovan } __packed;
636a9de9248SMarcel Holtmann 
637a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
638a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
639a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
640a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
641a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
642a9de9248SMarcel Holtmann 	__le16   max_latency;
643a9de9248SMarcel Holtmann 	__le16   content_format;
644a9de9248SMarcel Holtmann 	__u8     retrans_effort;
645a9de9248SMarcel Holtmann 	__le16   pkt_type;
64666c853ccSGustavo F. Padovan } __packed;
647a9de9248SMarcel Holtmann 
648a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
649a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
650a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
651a9de9248SMarcel Holtmann 	__u8     reason;
65266c853ccSGustavo F. Padovan } __packed;
653a9de9248SMarcel Holtmann 
65417fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
65517fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
65617fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
65717fa4b9dSJohan Hedberg 	__u8     capability;
65817fa4b9dSJohan Hedberg 	__u8     oob_data;
65917fa4b9dSJohan Hedberg 	__u8     authentication;
66017fa4b9dSJohan Hedberg } __packed;
66117fa4b9dSJohan Hedberg 
662a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
663a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
664a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
665a5c29683SJohan Hedberg } __packed;
666a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
667a5c29683SJohan Hedberg 	__u8     status;
668a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
669a5c29683SJohan Hedberg } __packed;
670a5c29683SJohan Hedberg 
671a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
672a5c29683SJohan Hedberg 
6739ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_REPLY		0x042e
6749ad4019aSBrian Gix struct hci_cp_user_passkey_reply {
6759ad4019aSBrian Gix 	bdaddr_t bdaddr;
6769ad4019aSBrian Gix 	__le32	passkey;
6779ad4019aSBrian Gix } __packed;
6789ad4019aSBrian Gix 
6799ad4019aSBrian Gix #define HCI_OP_USER_PASSKEY_NEG_REPLY	0x042f
6809ad4019aSBrian Gix 
6812763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
6822763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
6832763eda6SSzymon Janc 	bdaddr_t bdaddr;
6842763eda6SSzymon Janc 	__u8     hash[16];
68538da1703SJohan Hedberg 	__u8     rand[16];
6862763eda6SSzymon Janc } __packed;
6872763eda6SSzymon Janc 
6882763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
6892763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
6902763eda6SSzymon Janc 	bdaddr_t bdaddr;
6912763eda6SSzymon Janc } __packed;
6922763eda6SSzymon Janc 
69303b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
69403b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
69503b555e1SJohan Hedberg 	bdaddr_t bdaddr;
69603b555e1SJohan Hedberg 	__u8     reason;
69703b555e1SJohan Hedberg } __packed;
69803b555e1SJohan Hedberg 
699523e93cdSAndrei Emeltchenko #define HCI_OP_CREATE_PHY_LINK		0x0435
700523e93cdSAndrei Emeltchenko struct hci_cp_create_phy_link {
701523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
702523e93cdSAndrei Emeltchenko 	__u8     key_len;
703523e93cdSAndrei Emeltchenko 	__u8     key_type;
704523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
705523e93cdSAndrei Emeltchenko } __packed;
706523e93cdSAndrei Emeltchenko 
707523e93cdSAndrei Emeltchenko #define HCI_OP_ACCEPT_PHY_LINK		0x0436
708523e93cdSAndrei Emeltchenko struct hci_cp_accept_phy_link {
709523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
710523e93cdSAndrei Emeltchenko 	__u8     key_len;
711523e93cdSAndrei Emeltchenko 	__u8     key_type;
712523e93cdSAndrei Emeltchenko 	__u8     key[HCI_AMP_LINK_KEY_SIZE];
713523e93cdSAndrei Emeltchenko } __packed;
714523e93cdSAndrei Emeltchenko 
715523e93cdSAndrei Emeltchenko #define HCI_OP_DISCONN_PHY_LINK		0x0437
716523e93cdSAndrei Emeltchenko struct hci_cp_disconn_phy_link {
717523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
718523e93cdSAndrei Emeltchenko 	__u8     reason;
719b078b564SAndrei Emeltchenko } __packed;
720b078b564SAndrei Emeltchenko 
721b078b564SAndrei Emeltchenko struct ext_flow_spec {
722b078b564SAndrei Emeltchenko 	__u8       id;
723b078b564SAndrei Emeltchenko 	__u8       stype;
724b078b564SAndrei Emeltchenko 	__le16     msdu;
725b078b564SAndrei Emeltchenko 	__le32     sdu_itime;
726b078b564SAndrei Emeltchenko 	__le32     acc_lat;
727b078b564SAndrei Emeltchenko 	__le32     flush_to;
728b078b564SAndrei Emeltchenko } __packed;
729b078b564SAndrei Emeltchenko 
730b078b564SAndrei Emeltchenko #define HCI_OP_CREATE_LOGICAL_LINK	0x0438
731b078b564SAndrei Emeltchenko #define HCI_OP_ACCEPT_LOGICAL_LINK	0x0439
732b078b564SAndrei Emeltchenko struct hci_cp_create_accept_logical_link {
733b078b564SAndrei Emeltchenko 	__u8                  phy_handle;
734b078b564SAndrei Emeltchenko 	struct ext_flow_spec  tx_flow_spec;
735b078b564SAndrei Emeltchenko 	struct ext_flow_spec  rx_flow_spec;
736b078b564SAndrei Emeltchenko } __packed;
737b078b564SAndrei Emeltchenko 
738b078b564SAndrei Emeltchenko #define HCI_OP_DISCONN_LOGICAL_LINK	0x043a
739b078b564SAndrei Emeltchenko struct hci_cp_disconn_logical_link {
740b078b564SAndrei Emeltchenko 	__le16   log_handle;
741b078b564SAndrei Emeltchenko } __packed;
742b078b564SAndrei Emeltchenko 
743b078b564SAndrei Emeltchenko #define HCI_OP_LOGICAL_LINK_CANCEL	0x043b
744b078b564SAndrei Emeltchenko struct hci_cp_logical_link_cancel {
745b078b564SAndrei Emeltchenko 	__u8     phy_handle;
746b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
747b078b564SAndrei Emeltchenko } __packed;
748b078b564SAndrei Emeltchenko 
749b078b564SAndrei Emeltchenko struct hci_rp_logical_link_cancel {
750b078b564SAndrei Emeltchenko 	__u8     status;
751b078b564SAndrei Emeltchenko 	__u8     phy_handle;
752b078b564SAndrei Emeltchenko 	__u8     flow_spec_id;
753523e93cdSAndrei Emeltchenko } __packed;
754523e93cdSAndrei Emeltchenko 
7558c9a041bSDoHyun Pyun #define HCI_OP_SET_CSB			0x0441
7568c9a041bSDoHyun Pyun struct hci_cp_set_csb {
7578c9a041bSDoHyun Pyun 	__u8	enable;
7588c9a041bSDoHyun Pyun 	__u8	lt_addr;
7598c9a041bSDoHyun Pyun 	__u8	lpo_allowed;
7608c9a041bSDoHyun Pyun 	__le16	packet_type;
7618c9a041bSDoHyun Pyun 	__le16	interval_min;
7628c9a041bSDoHyun Pyun 	__le16	interval_max;
7638c9a041bSDoHyun Pyun 	__le16	csb_sv_tout;
7648c9a041bSDoHyun Pyun } __packed;
7658c9a041bSDoHyun Pyun struct hci_rp_set_csb {
7668c9a041bSDoHyun Pyun 	__u8	status;
7678c9a041bSDoHyun Pyun 	__u8	lt_addr;
7688c9a041bSDoHyun Pyun 	__le16	interval;
7698c9a041bSDoHyun Pyun } __packed;
7708c9a041bSDoHyun Pyun 
771cefded98SDoHyun Pyun #define HCI_OP_START_SYNC_TRAIN		0x0443
772cefded98SDoHyun Pyun 
773e2f99131SMarcel Holtmann #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY	0x0445
774e2f99131SMarcel Holtmann struct hci_cp_remote_oob_ext_data_reply {
775e2f99131SMarcel Holtmann 	bdaddr_t bdaddr;
776e2f99131SMarcel Holtmann 	__u8     hash192[16];
77738da1703SJohan Hedberg 	__u8     rand192[16];
778e2f99131SMarcel Holtmann 	__u8     hash256[16];
77938da1703SJohan Hedberg 	__u8     rand256[16];
780e2f99131SMarcel Holtmann } __packed;
781e2f99131SMarcel Holtmann 
782a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
783a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
784a9de9248SMarcel Holtmann 	__le16   handle;
785a9de9248SMarcel Holtmann 	__le16   max_interval;
786a9de9248SMarcel Holtmann 	__le16   min_interval;
787a9de9248SMarcel Holtmann 	__le16   attempt;
788a9de9248SMarcel Holtmann 	__le16   timeout;
78966c853ccSGustavo F. Padovan } __packed;
790a9de9248SMarcel Holtmann 
791a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
792a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
793a9de9248SMarcel Holtmann 	__le16   handle;
79466c853ccSGustavo F. Padovan } __packed;
795a9de9248SMarcel Holtmann 
796a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
797a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
798a9de9248SMarcel Holtmann 	__le16   handle;
79966c853ccSGustavo F. Padovan } __packed;
800a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
801a9de9248SMarcel Holtmann 	__u8     status;
802a9de9248SMarcel Holtmann 	__le16   handle;
803a9de9248SMarcel Holtmann 	__u8     role;
80466c853ccSGustavo F. Padovan } __packed;
805a9de9248SMarcel Holtmann 
806a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
807a9de9248SMarcel Holtmann struct hci_cp_switch_role {
808a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
809a9de9248SMarcel Holtmann 	__u8     role;
81066c853ccSGustavo F. Padovan } __packed;
811a9de9248SMarcel Holtmann 
812a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
813a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
814a9de9248SMarcel Holtmann 	__le16   handle;
81566c853ccSGustavo F. Padovan } __packed;
816a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
817a9de9248SMarcel Holtmann 	__u8     status;
818a9de9248SMarcel Holtmann 	__le16   handle;
819a9de9248SMarcel Holtmann 	__le16   policy;
82066c853ccSGustavo F. Padovan } __packed;
821a9de9248SMarcel Holtmann 
822a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
823a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
824a9de9248SMarcel Holtmann 	__le16   handle;
825a9de9248SMarcel Holtmann 	__le16   policy;
82666c853ccSGustavo F. Padovan } __packed;
827a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
828a9de9248SMarcel Holtmann 	__u8     status;
829a9de9248SMarcel Holtmann 	__le16   handle;
83066c853ccSGustavo F. Padovan } __packed;
831a9de9248SMarcel Holtmann 
832e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
833e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
834e4e8e37cSMarcel Holtmann 	__u8     status;
835e4e8e37cSMarcel Holtmann 	__le16   policy;
83666c853ccSGustavo F. Padovan } __packed;
837e4e8e37cSMarcel Holtmann 
838e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
839e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
840e4e8e37cSMarcel Holtmann 	__le16   policy;
84166c853ccSGustavo F. Padovan } __packed;
842e4e8e37cSMarcel Holtmann 
843a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
844a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
845a9de9248SMarcel Holtmann 	__le16   handle;
846a9de9248SMarcel Holtmann 	__le16   max_latency;
847a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
848a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
84966c853ccSGustavo F. Padovan } __packed;
850a9de9248SMarcel Holtmann 
851a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
852a9de9248SMarcel Holtmann 
853a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
854a9de9248SMarcel Holtmann 
855a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
8561da177e4SLinus Torvalds struct hci_cp_set_event_flt {
8571da177e4SLinus Torvalds 	__u8     flt_type;
8581da177e4SLinus Torvalds 	__u8     cond_type;
8591da177e4SLinus Torvalds 	__u8     condition[0];
86066c853ccSGustavo F. Padovan } __packed;
8611da177e4SLinus Torvalds 
8621da177e4SLinus Torvalds /* Filter types */
8631da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
8641da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
8651da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
8661da177e4SLinus Torvalds 
8671da177e4SLinus Torvalds /* CONN_SETUP Condition types */
8681da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
8691da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
8701da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
8711da177e4SLinus Torvalds 
8721da177e4SLinus Torvalds /* CONN_SETUP Conditions */
8731da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
8741da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
8751da177e4SLinus Torvalds 
876cb962780SMarcel Holtmann #define HCI_OP_READ_STORED_LINK_KEY	0x0c0d
877cb962780SMarcel Holtmann struct hci_cp_read_stored_link_key {
878cb962780SMarcel Holtmann 	bdaddr_t bdaddr;
879cb962780SMarcel Holtmann 	__u8     read_all;
880cb962780SMarcel Holtmann } __packed;
881cb962780SMarcel Holtmann struct hci_rp_read_stored_link_key {
882cb962780SMarcel Holtmann 	__u8     status;
883cb962780SMarcel Holtmann 	__u8     max_keys;
884cb962780SMarcel Holtmann 	__u8     num_keys;
885cb962780SMarcel Holtmann } __packed;
886cb962780SMarcel Holtmann 
887b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
888b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
889b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
890b0916ea0SJohan Hedberg 	__u8     delete_all;
891b0916ea0SJohan Hedberg } __packed;
892039d4e41SMarcel Holtmann struct hci_rp_delete_stored_link_key {
893039d4e41SMarcel Holtmann 	__u8     status;
894039d4e41SMarcel Holtmann 	__u8     num_keys;
895039d4e41SMarcel Holtmann } __packed;
896b0916ea0SJohan Hedberg 
8971f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
8981f6c6378SJohan Hedberg 
899a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
900a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
9011f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
90266c853ccSGustavo F. Padovan } __packed;
903a9de9248SMarcel Holtmann 
904a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
905a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
906a9de9248SMarcel Holtmann 	__u8     status;
9071f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
90866c853ccSGustavo F. Padovan } __packed;
909a9de9248SMarcel Holtmann 
910a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
911a9de9248SMarcel Holtmann 
912a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
913a9de9248SMarcel Holtmann 
914a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
915a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
916a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
917a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
918a9de9248SMarcel Holtmann 
919a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
920a9de9248SMarcel Holtmann 
921a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
922a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
923a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
924a9de9248SMarcel Holtmann 
925a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
926a9de9248SMarcel Holtmann 
927a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
928a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
929a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
930a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
931a9de9248SMarcel Holtmann 
932a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
933a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
9341da177e4SLinus Torvalds 	__u8     status;
9351da177e4SLinus Torvalds 	__u8     dev_class[3];
93666c853ccSGustavo F. Padovan } __packed;
9371da177e4SLinus Torvalds 
938a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
939a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
9401da177e4SLinus Torvalds 	__u8     dev_class[3];
94166c853ccSGustavo F. Padovan } __packed;
9421da177e4SLinus Torvalds 
943a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
9441da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
9451da177e4SLinus Torvalds 	__u8     status;
9461ebb9252SMarcel Holtmann 	__le16   voice_setting;
94766c853ccSGustavo F. Padovan } __packed;
9481da177e4SLinus Torvalds 
949a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
9501da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
9511ebb9252SMarcel Holtmann 	__le16   voice_setting;
95266c853ccSGustavo F. Padovan } __packed;
9531da177e4SLinus Torvalds 
954a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
9551da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
9561ebb9252SMarcel Holtmann 	__le16   acl_mtu;
9571da177e4SLinus Torvalds 	__u8     sco_mtu;
9581ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
9591ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
96066c853ccSGustavo F. Padovan } __packed;
9611da177e4SLinus Torvalds 
962b4cb9fb2SMarcel Holtmann #define HCI_OP_READ_NUM_SUPPORTED_IAC	0x0c38
963b4cb9fb2SMarcel Holtmann struct hci_rp_read_num_supported_iac {
964b4cb9fb2SMarcel Holtmann 	__u8	status;
965b4cb9fb2SMarcel Holtmann 	__u8	num_iac;
966b4cb9fb2SMarcel Holtmann } __packed;
967b4cb9fb2SMarcel Holtmann 
9684b836f39SMarcel Holtmann #define HCI_OP_READ_CURRENT_IAC_LAP	0x0c39
9694b836f39SMarcel Holtmann 
9703d505312SMarcel Holtmann #define HCI_OP_WRITE_CURRENT_IAC_LAP	0x0c3a
9713d505312SMarcel Holtmann struct hci_cp_write_current_iac_lap {
9723d505312SMarcel Holtmann 	__u8	num_iac;
9733d505312SMarcel Holtmann 	__u8	iac_lap[6];
9743d505312SMarcel Holtmann } __packed;
9753d505312SMarcel Holtmann 
976d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
977d5859e22SJohan Hedberg 
97880a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
97980a1e1dbSJohan Hedberg 
98080a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
98180a1e1dbSJohan Hedberg struct hci_cp_write_eir {
982816a11d5SJohan Hedberg 	__u8	fec;
983816a11d5SJohan Hedberg 	__u8	data[HCI_MAX_EIR_LENGTH];
98480a1e1dbSJohan Hedberg } __packed;
98580a1e1dbSJohan Hedberg 
986333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
987333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
988333140b5SMarcel Holtmann 	__u8     status;
989333140b5SMarcel Holtmann 	__u8     mode;
99066c853ccSGustavo F. Padovan } __packed;
991333140b5SMarcel Holtmann 
992333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
993333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
994333140b5SMarcel Holtmann 	__u8     mode;
99566c853ccSGustavo F. Padovan } __packed;
996333140b5SMarcel Holtmann 
997c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
998c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
999c35938b2SSzymon Janc 	__u8     status;
1000c35938b2SSzymon Janc 	__u8     hash[16];
100138da1703SJohan Hedberg 	__u8     rand[16];
1002c35938b2SSzymon Janc } __packed;
1003c35938b2SSzymon Janc 
1004d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
100591c4e9b1SMarcel Holtmann struct hci_rp_read_inq_rsp_tx_power {
100691c4e9b1SMarcel Holtmann 	__u8     status;
100791c4e9b1SMarcel Holtmann 	__s8     tx_power;
100891c4e9b1SMarcel Holtmann } __packed;
1009d5859e22SJohan Hedberg 
1010d62e6d67SJohan Hedberg #define HCI_OP_SET_EVENT_MASK_PAGE_2	0x0c63
1011d62e6d67SJohan Hedberg 
10127528ca1cSMarcel Holtmann #define HCI_OP_READ_LOCATION_DATA	0x0c64
10137528ca1cSMarcel Holtmann 
10141e89cffbSAndrei Emeltchenko #define HCI_OP_READ_FLOW_CONTROL_MODE	0x0c66
10151e89cffbSAndrei Emeltchenko struct hci_rp_read_flow_control_mode {
10161e89cffbSAndrei Emeltchenko 	__u8     status;
10171e89cffbSAndrei Emeltchenko 	__u8     mode;
10181e89cffbSAndrei Emeltchenko } __packed;
10191e89cffbSAndrei Emeltchenko 
1020f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
1021f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
1022f9b49306SAndre Guedes 	__u8	le;
1023f9b49306SAndre Guedes 	__u8	simul;
1024f9b49306SAndre Guedes } __packed;
1025f9b49306SAndre Guedes 
1026d0bf75a5SDoHyun Pyun #define HCI_OP_SET_RESERVED_LT_ADDR	0x0c74
1027d0bf75a5SDoHyun Pyun struct hci_cp_set_reserved_lt_addr {
1028d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1029d0bf75a5SDoHyun Pyun } __packed;
1030d0bf75a5SDoHyun Pyun struct hci_rp_set_reserved_lt_addr {
1031d0bf75a5SDoHyun Pyun 	__u8	status;
1032d0bf75a5SDoHyun Pyun 	__u8	lt_addr;
1033d0bf75a5SDoHyun Pyun } __packed;
1034d0bf75a5SDoHyun Pyun 
10356a20eaf4SDoHyun Pyun #define HCI_OP_DELETE_RESERVED_LT_ADDR	0x0c75
10366a20eaf4SDoHyun Pyun struct hci_cp_delete_reserved_lt_addr {
10376a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10386a20eaf4SDoHyun Pyun } __packed;
10396a20eaf4SDoHyun Pyun struct hci_rp_delete_reserved_lt_addr {
10406a20eaf4SDoHyun Pyun 	__u8	status;
10416a20eaf4SDoHyun Pyun 	__u8	lt_addr;
10426a20eaf4SDoHyun Pyun } __packed;
10436a20eaf4SDoHyun Pyun 
10447d1dab49SDoHyun Pyun #define HCI_OP_SET_CSB_DATA		0x0c76
10457d1dab49SDoHyun Pyun struct hci_cp_set_csb_data {
10467d1dab49SDoHyun Pyun 	__u8	lt_addr;
10477d1dab49SDoHyun Pyun 	__u8	fragment;
10487d1dab49SDoHyun Pyun 	__u8	data_length;
10497d1dab49SDoHyun Pyun 	__u8	data[HCI_MAX_CSB_DATA_SIZE];
10507d1dab49SDoHyun Pyun } __packed;
10517d1dab49SDoHyun Pyun struct hci_rp_set_csb_data {
10527d1dab49SDoHyun Pyun 	__u8	status;
10537d1dab49SDoHyun Pyun 	__u8	lt_addr;
10547d1dab49SDoHyun Pyun } __packed;
10557d1dab49SDoHyun Pyun 
10565d4e7e8dSJohan Hedberg #define HCI_OP_READ_SYNC_TRAIN_PARAMS	0x0c77
10575d4e7e8dSJohan Hedberg 
1058a9b07a64SDoHyun Pyun #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS	0x0c78
1059a9b07a64SDoHyun Pyun struct hci_cp_write_sync_train_params {
1060a9b07a64SDoHyun Pyun 	__le16	interval_min;
1061a9b07a64SDoHyun Pyun 	__le16	interval_max;
1062a9b07a64SDoHyun Pyun 	__le32	sync_train_tout;
1063a9b07a64SDoHyun Pyun 	__u8	service_data;
1064a9b07a64SDoHyun Pyun } __packed;
1065a9b07a64SDoHyun Pyun struct hci_rp_write_sync_train_params {
1066a9b07a64SDoHyun Pyun 	__u8	status;
1067a9b07a64SDoHyun Pyun 	__le16	sync_train_int;
1068a9b07a64SDoHyun Pyun } __packed;
1069a9b07a64SDoHyun Pyun 
1070eb4b95c6SMarcel Holtmann #define HCI_OP_READ_SC_SUPPORT		0x0c79
1071eb4b95c6SMarcel Holtmann struct hci_rp_read_sc_support {
1072eb4b95c6SMarcel Holtmann 	__u8	status;
1073eb4b95c6SMarcel Holtmann 	__u8	support;
1074eb4b95c6SMarcel Holtmann } __packed;
1075eb4b95c6SMarcel Holtmann 
1076eb4b95c6SMarcel Holtmann #define HCI_OP_WRITE_SC_SUPPORT		0x0c7a
1077eb4b95c6SMarcel Holtmann struct hci_cp_write_sc_support {
1078eb4b95c6SMarcel Holtmann 	__u8	support;
1079eb4b95c6SMarcel Holtmann } __packed;
1080eb4b95c6SMarcel Holtmann 
1081e2f99131SMarcel Holtmann #define HCI_OP_READ_LOCAL_OOB_EXT_DATA	0x0c7d
1082e2f99131SMarcel Holtmann struct hci_rp_read_local_oob_ext_data {
1083e2f99131SMarcel Holtmann 	__u8     status;
1084e2f99131SMarcel Holtmann 	__u8     hash192[16];
108538da1703SJohan Hedberg 	__u8     rand192[16];
1086e2f99131SMarcel Holtmann 	__u8     hash256[16];
108738da1703SJohan Hedberg 	__u8     rand256[16];
1088e2f99131SMarcel Holtmann } __packed;
1089e2f99131SMarcel Holtmann 
1090a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
1091a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
10921da177e4SLinus Torvalds 	__u8     status;
1093a9de9248SMarcel Holtmann 	__u8     hci_ver;
1094a9de9248SMarcel Holtmann 	__le16   hci_rev;
1095a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1096a9de9248SMarcel Holtmann 	__le16   manufacturer;
1097a9de9248SMarcel Holtmann 	__le16   lmp_subver;
109866c853ccSGustavo F. Padovan } __packed;
10991da177e4SLinus Torvalds 
1100a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
1101a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
11021da177e4SLinus Torvalds 	__u8     status;
1103a9de9248SMarcel Holtmann 	__u8     commands[64];
110466c853ccSGustavo F. Padovan } __packed;
11051da177e4SLinus Torvalds 
1106a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
1107a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
1108a9de9248SMarcel Holtmann 	__u8     status;
1109a9de9248SMarcel Holtmann 	__u8     features[8];
111066c853ccSGustavo F. Padovan } __packed;
1111a9de9248SMarcel Holtmann 
1112a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
1113971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
1114971e3a4bSAndre Guedes 	__u8     page;
1115971e3a4bSAndre Guedes } __packed;
1116a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
1117a9de9248SMarcel Holtmann 	__u8     status;
1118a9de9248SMarcel Holtmann 	__u8     page;
1119a9de9248SMarcel Holtmann 	__u8     max_page;
1120a9de9248SMarcel Holtmann 	__u8     features[8];
112166c853ccSGustavo F. Padovan } __packed;
1122a9de9248SMarcel Holtmann 
1123a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
1124a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
1125a9de9248SMarcel Holtmann 	__u8     status;
1126a9de9248SMarcel Holtmann 	__le16   acl_mtu;
1127a9de9248SMarcel Holtmann 	__u8     sco_mtu;
1128a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
1129a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
113066c853ccSGustavo F. Padovan } __packed;
1131a9de9248SMarcel Holtmann 
1132a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
1133a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
1134a9de9248SMarcel Holtmann 	__u8     status;
11351da177e4SLinus Torvalds 	bdaddr_t bdaddr;
113666c853ccSGustavo F. Padovan } __packed;
11371da177e4SLinus Torvalds 
1138350ee4cfSAndrei Emeltchenko #define HCI_OP_READ_DATA_BLOCK_SIZE	0x100a
1139350ee4cfSAndrei Emeltchenko struct hci_rp_read_data_block_size {
1140350ee4cfSAndrei Emeltchenko 	__u8     status;
1141350ee4cfSAndrei Emeltchenko 	__le16   max_acl_len;
1142350ee4cfSAndrei Emeltchenko 	__le16   block_len;
1143350ee4cfSAndrei Emeltchenko 	__le16   num_blocks;
1144350ee4cfSAndrei Emeltchenko } __packed;
1145350ee4cfSAndrei Emeltchenko 
1146109e3191SMarcel Holtmann #define HCI_OP_READ_LOCAL_CODECS	0x100b
1147109e3191SMarcel Holtmann 
1148f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b
1149f332ec66SJohan Hedberg struct hci_rp_read_page_scan_activity {
1150f332ec66SJohan Hedberg 	__u8     status;
1151f332ec66SJohan Hedberg 	__le16   interval;
1152f332ec66SJohan Hedberg 	__le16   window;
1153f332ec66SJohan Hedberg } __packed;
1154f332ec66SJohan Hedberg 
1155f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c
1156f6422ec6SAntti Julku struct hci_cp_write_page_scan_activity {
1157f6422ec6SAntti Julku 	__le16   interval;
1158f6422ec6SAntti Julku 	__le16   window;
1159f6422ec6SAntti Julku } __packed;
1160f6422ec6SAntti Julku 
11615a134faeSAndrzej Kaczmarek #define HCI_OP_READ_TX_POWER		0x0c2d
11625a134faeSAndrzej Kaczmarek struct hci_cp_read_tx_power {
11635a134faeSAndrzej Kaczmarek 	__le16   handle;
11645a134faeSAndrzej Kaczmarek 	__u8     type;
11655a134faeSAndrzej Kaczmarek } __packed;
11665a134faeSAndrzej Kaczmarek struct hci_rp_read_tx_power {
11675a134faeSAndrzej Kaczmarek 	__u8     status;
11685a134faeSAndrzej Kaczmarek 	__le16   handle;
11695a134faeSAndrzej Kaczmarek 	__s8     tx_power;
11705a134faeSAndrzej Kaczmarek } __packed;
11715a134faeSAndrzej Kaczmarek 
1172f332ec66SJohan Hedberg #define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46
1173f332ec66SJohan Hedberg struct hci_rp_read_page_scan_type {
1174f332ec66SJohan Hedberg 	__u8     status;
1175f332ec66SJohan Hedberg 	__u8     type;
1176f332ec66SJohan Hedberg } __packed;
1177f332ec66SJohan Hedberg 
1178f6422ec6SAntti Julku #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47
1179f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_STANDARD		0x00
1180f6422ec6SAntti Julku 	#define PAGE_SCAN_TYPE_INTERLACED	0x01
1181f6422ec6SAntti Julku 
11825ae76a94SAndrzej Kaczmarek #define HCI_OP_READ_RSSI		0x1405
11835ae76a94SAndrzej Kaczmarek struct hci_cp_read_rssi {
11845ae76a94SAndrzej Kaczmarek 	__le16   handle;
11855ae76a94SAndrzej Kaczmarek } __packed;
11865ae76a94SAndrzej Kaczmarek struct hci_rp_read_rssi {
11875ae76a94SAndrzej Kaczmarek 	__u8     status;
11885ae76a94SAndrzej Kaczmarek 	__le16   handle;
11895ae76a94SAndrzej Kaczmarek 	__s8     rssi;
11905ae76a94SAndrzej Kaczmarek } __packed;
11915ae76a94SAndrzej Kaczmarek 
119233f35721SJohan Hedberg #define HCI_OP_READ_CLOCK		0x1407
119333f35721SJohan Hedberg struct hci_cp_read_clock {
119433f35721SJohan Hedberg 	__le16   handle;
119533f35721SJohan Hedberg 	__u8     which;
119633f35721SJohan Hedberg } __packed;
119733f35721SJohan Hedberg struct hci_rp_read_clock {
119833f35721SJohan Hedberg 	__u8     status;
119933f35721SJohan Hedberg 	__le16   handle;
120033f35721SJohan Hedberg 	__le32   clock;
120133f35721SJohan Hedberg 	__le16   accuracy;
120233f35721SJohan Hedberg } __packed;
120333f35721SJohan Hedberg 
1204928abaa7SAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_INFO	0x1409
1205928abaa7SAndrei Emeltchenko struct hci_rp_read_local_amp_info {
1206928abaa7SAndrei Emeltchenko 	__u8     status;
1207928abaa7SAndrei Emeltchenko 	__u8     amp_status;
1208928abaa7SAndrei Emeltchenko 	__le32   total_bw;
1209928abaa7SAndrei Emeltchenko 	__le32   max_bw;
1210928abaa7SAndrei Emeltchenko 	__le32   min_latency;
1211928abaa7SAndrei Emeltchenko 	__le32   max_pdu;
1212928abaa7SAndrei Emeltchenko 	__u8     amp_type;
1213928abaa7SAndrei Emeltchenko 	__le16   pal_cap;
1214928abaa7SAndrei Emeltchenko 	__le16   max_assoc_size;
1215928abaa7SAndrei Emeltchenko 	__le32   max_flush_to;
1216928abaa7SAndrei Emeltchenko 	__le32   be_flush_to;
1217928abaa7SAndrei Emeltchenko } __packed;
1218928abaa7SAndrei Emeltchenko 
1219523e93cdSAndrei Emeltchenko #define HCI_OP_READ_LOCAL_AMP_ASSOC	0x140a
1220523e93cdSAndrei Emeltchenko struct hci_cp_read_local_amp_assoc {
1221523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1222523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1223523e93cdSAndrei Emeltchenko 	__le16   max_len;
1224523e93cdSAndrei Emeltchenko } __packed;
1225523e93cdSAndrei Emeltchenko struct hci_rp_read_local_amp_assoc {
1226523e93cdSAndrei Emeltchenko 	__u8     status;
1227523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1228523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1229523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1230523e93cdSAndrei Emeltchenko } __packed;
1231523e93cdSAndrei Emeltchenko 
1232523e93cdSAndrei Emeltchenko #define HCI_OP_WRITE_REMOTE_AMP_ASSOC	0x140b
1233523e93cdSAndrei Emeltchenko struct hci_cp_write_remote_amp_assoc {
1234523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1235523e93cdSAndrei Emeltchenko 	__le16   len_so_far;
1236523e93cdSAndrei Emeltchenko 	__le16   rem_len;
1237523e93cdSAndrei Emeltchenko 	__u8     frag[0];
1238523e93cdSAndrei Emeltchenko } __packed;
1239523e93cdSAndrei Emeltchenko struct hci_rp_write_remote_amp_assoc {
1240523e93cdSAndrei Emeltchenko 	__u8     status;
1241523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1242523e93cdSAndrei Emeltchenko } __packed;
1243523e93cdSAndrei Emeltchenko 
1244f4fe73edSMarcel Holtmann #define HCI_OP_GET_MWS_TRANSPORT_CONFIG	0x140c
1245f4fe73edSMarcel Holtmann 
12464b4148e9SMarcel Holtmann #define HCI_OP_ENABLE_DUT_MODE		0x1803
12474b4148e9SMarcel Holtmann 
124806f5b778SMarcel Holtmann #define HCI_OP_WRITE_SSP_DEBUG_MODE	0x1804
124906f5b778SMarcel Holtmann 
125063185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
125163185f64SVille Tervo struct hci_cp_le_set_event_mask {
125263185f64SVille Tervo 	__u8     mask[8];
125363185f64SVille Tervo } __packed;
125463185f64SVille Tervo 
125563185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
125663185f64SVille Tervo struct hci_rp_le_read_buffer_size {
125763185f64SVille Tervo 	__u8     status;
125863185f64SVille Tervo 	__le16   le_mtu;
125963185f64SVille Tervo 	__u8     le_max_pkt;
126063185f64SVille Tervo } __packed;
126163185f64SVille Tervo 
126260e77321SJohan Hedberg #define HCI_OP_LE_READ_LOCAL_FEATURES	0x2003
126360e77321SJohan Hedberg struct hci_rp_le_read_local_features {
126460e77321SJohan Hedberg 	__u8     status;
126560e77321SJohan Hedberg 	__u8     features[8];
126660e77321SJohan Hedberg } __packed;
126760e77321SJohan Hedberg 
1268d13eafceSMarcel Holtmann #define HCI_OP_LE_SET_RANDOM_ADDR	0x2005
1269d13eafceSMarcel Holtmann 
12701e191893SMarcel Holtmann #define HCI_OP_LE_SET_ADV_PARAM		0x2006
12711e191893SMarcel Holtmann struct hci_cp_le_set_adv_param {
12721e191893SMarcel Holtmann 	__le16   min_interval;
12731e191893SMarcel Holtmann 	__le16   max_interval;
12741e191893SMarcel Holtmann 	__u8     type;
12751e191893SMarcel Holtmann 	__u8     own_address_type;
12761e191893SMarcel Holtmann 	__u8     direct_addr_type;
12771e191893SMarcel Holtmann 	bdaddr_t direct_addr;
12781e191893SMarcel Holtmann 	__u8     channel_map;
12791e191893SMarcel Holtmann 	__u8     filter_policy;
12801e191893SMarcel Holtmann } __packed;
12811e191893SMarcel Holtmann 
12828fa19098SJohan Hedberg #define HCI_OP_LE_READ_ADV_TX_POWER	0x2007
12838fa19098SJohan Hedberg struct hci_rp_le_read_adv_tx_power {
12848fa19098SJohan Hedberg 	__u8	status;
12858fa19098SJohan Hedberg 	__s8	tx_power;
12868fa19098SJohan Hedberg } __packed;
12878fa19098SJohan Hedberg 
12883f0f524bSJohan Hedberg #define HCI_MAX_AD_LENGTH		31
12893f0f524bSJohan Hedberg 
12903f0f524bSJohan Hedberg #define HCI_OP_LE_SET_ADV_DATA		0x2008
12913f0f524bSJohan Hedberg struct hci_cp_le_set_adv_data {
12923f0f524bSJohan Hedberg 	__u8	length;
12933f0f524bSJohan Hedberg 	__u8	data[HCI_MAX_AD_LENGTH];
12943f0f524bSJohan Hedberg } __packed;
12953f0f524bSJohan Hedberg 
1296f14d8f64SMarcel Holtmann #define HCI_OP_LE_SET_SCAN_RSP_DATA	0x2009
1297f14d8f64SMarcel Holtmann struct hci_cp_le_set_scan_rsp_data {
1298f14d8f64SMarcel Holtmann 	__u8	length;
1299f14d8f64SMarcel Holtmann 	__u8	data[HCI_MAX_AD_LENGTH];
1300f14d8f64SMarcel Holtmann } __packed;
1301f14d8f64SMarcel Holtmann 
1302c1d5dc4aSJohan Hedberg #define HCI_OP_LE_SET_ADV_ENABLE	0x200a
1303c1d5dc4aSJohan Hedberg 
13045df480b5SAndre Guedes #define LE_SCAN_PASSIVE			0x00
13055df480b5SAndre Guedes #define LE_SCAN_ACTIVE			0x01
13065df480b5SAndre Guedes 
130707f7fa5dSAndre Guedes #define HCI_OP_LE_SET_SCAN_PARAM	0x200b
130807f7fa5dSAndre Guedes struct hci_cp_le_set_scan_param {
130907f7fa5dSAndre Guedes 	__u8    type;
131007f7fa5dSAndre Guedes 	__le16  interval;
131107f7fa5dSAndre Guedes 	__le16  window;
131207f7fa5dSAndre Guedes 	__u8    own_address_type;
131307f7fa5dSAndre Guedes 	__u8    filter_policy;
131407f7fa5dSAndre Guedes } __packed;
131507f7fa5dSAndre Guedes 
131676a388beSAndre Guedes #define LE_SCAN_DISABLE			0x00
131776a388beSAndre Guedes #define LE_SCAN_ENABLE			0x01
1318525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_DISABLE	0x00
1319525e296aSAndre Guedes #define LE_SCAN_FILTER_DUP_ENABLE	0x01
132068a8aea4SAndrei Emeltchenko 
1321eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
1322eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
1323eb9d91f5SAndre Guedes 	__u8     enable;
1324eb9d91f5SAndre Guedes 	__u8     filter_dup;
1325eb9d91f5SAndre Guedes } __packed;
1326eb9d91f5SAndre Guedes 
1327a7139eddSJohan Hedberg #define HCI_LE_USE_PEER_ADDR		0x00
1328a7139eddSJohan Hedberg #define HCI_LE_USE_WHITELIST		0x01
1329a7139eddSJohan Hedberg 
133063185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
133163185f64SVille Tervo struct hci_cp_le_create_conn {
133263185f64SVille Tervo 	__le16   scan_interval;
133363185f64SVille Tervo 	__le16   scan_window;
133463185f64SVille Tervo 	__u8     filter_policy;
133563185f64SVille Tervo 	__u8     peer_addr_type;
133663185f64SVille Tervo 	bdaddr_t peer_addr;
133763185f64SVille Tervo 	__u8     own_address_type;
133863185f64SVille Tervo 	__le16   conn_interval_min;
133963185f64SVille Tervo 	__le16   conn_interval_max;
134063185f64SVille Tervo 	__le16   conn_latency;
134163185f64SVille Tervo 	__le16   supervision_timeout;
134263185f64SVille Tervo 	__le16   min_ce_len;
134363185f64SVille Tervo 	__le16   max_ce_len;
134463185f64SVille Tervo } __packed;
134563185f64SVille Tervo 
134663185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
134763185f64SVille Tervo 
1348cf1d081fSJohan Hedberg #define HCI_OP_LE_READ_WHITE_LIST_SIZE	0x200f
1349cf1d081fSJohan Hedberg struct hci_rp_le_read_white_list_size {
1350cf1d081fSJohan Hedberg 	__u8	status;
1351cf1d081fSJohan Hedberg 	__u8	size;
1352cf1d081fSJohan Hedberg } __packed;
1353cf1d081fSJohan Hedberg 
1354d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_CLEAR_WHITE_LIST	0x2010
1355d9a7b0a5SMarcel Holtmann 
1356d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_ADD_TO_WHITE_LIST	0x2011
1357d9a7b0a5SMarcel Holtmann struct hci_cp_le_add_to_white_list {
1358d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1359d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1360d9a7b0a5SMarcel Holtmann } __packed;
1361d9a7b0a5SMarcel Holtmann 
1362d9a7b0a5SMarcel Holtmann #define HCI_OP_LE_DEL_FROM_WHITE_LIST	0x2012
1363d9a7b0a5SMarcel Holtmann struct hci_cp_le_del_from_white_list {
1364d9a7b0a5SMarcel Holtmann 	__u8     bdaddr_type;
1365d9a7b0a5SMarcel Holtmann 	bdaddr_t bdaddr;
1366d9a7b0a5SMarcel Holtmann } __packed;
1367d9a7b0a5SMarcel Holtmann 
13682ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
13692ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
13702ce603ebSClaudio Takahasi 	__le16   handle;
13712ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
13722ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
13732ce603ebSClaudio Takahasi 	__le16   conn_latency;
13742ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
13752ce603ebSClaudio Takahasi 	__le16   min_ce_len;
13762ce603ebSClaudio Takahasi 	__le16   max_ce_len;
13772ce603ebSClaudio Takahasi } __packed;
13782ce603ebSClaudio Takahasi 
1379a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
1380a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
1381a7a595f6SVinicius Costa Gomes 	__le16	handle;
1382fe39c7b2SMarcel Holtmann 	__le64	rand;
1383a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1384a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1385a7a595f6SVinicius Costa Gomes } __packed;
1386a7a595f6SVinicius Costa Gomes 
1387a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
1388a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
1389a7a595f6SVinicius Costa Gomes 	__le16	handle;
1390a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
1391a7a595f6SVinicius Costa Gomes } __packed;
1392a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
1393a7a595f6SVinicius Costa Gomes 	__u8	status;
1394a7a595f6SVinicius Costa Gomes 	__le16	handle;
1395a7a595f6SVinicius Costa Gomes } __packed;
1396a7a595f6SVinicius Costa Gomes 
1397a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
1398a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
1399a7a595f6SVinicius Costa Gomes 	__le16	handle;
1400a7a595f6SVinicius Costa Gomes } __packed;
1401a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
1402a7a595f6SVinicius Costa Gomes 	__u8	status;
1403a7a595f6SVinicius Costa Gomes 	__le16	handle;
1404a7a595f6SVinicius Costa Gomes } __packed;
1405a7a595f6SVinicius Costa Gomes 
14069b008c04SJohan Hedberg #define HCI_OP_LE_READ_SUPPORTED_STATES	0x201c
14079b008c04SJohan Hedberg struct hci_rp_le_read_supported_states {
14089b008c04SJohan Hedberg 	__u8	status;
14099b008c04SJohan Hedberg 	__u8	le_states[8];
14109b008c04SJohan Hedberg } __packed;
14119b008c04SJohan Hedberg 
14128e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_REPLY	0x2020
14138e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_reply {
14148e75b46aSAndre Guedes 	__le16	handle;
14158e75b46aSAndre Guedes 	__le16	interval_min;
14168e75b46aSAndre Guedes 	__le16	interval_max;
14178e75b46aSAndre Guedes 	__le16	latency;
14188e75b46aSAndre Guedes 	__le16	timeout;
14198e75b46aSAndre Guedes 	__le16	min_ce_len;
14208e75b46aSAndre Guedes 	__le16	max_ce_len;
14218e75b46aSAndre Guedes } __packed;
14228e75b46aSAndre Guedes 
14238e75b46aSAndre Guedes #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY	0x2021
14248e75b46aSAndre Guedes struct hci_cp_le_conn_param_req_neg_reply {
14258e75b46aSAndre Guedes 	__le16	handle;
14268e75b46aSAndre Guedes 	__u8	reason;
14278e75b46aSAndre Guedes } __packed;
14288e75b46aSAndre Guedes 
142994a3bd02SMarcel Holtmann #define HCI_OP_LE_SET_DATA_LEN		0x2022
143094a3bd02SMarcel Holtmann struct hci_cp_le_set_data_len {
143194a3bd02SMarcel Holtmann 	__le16	handle;
143294a3bd02SMarcel Holtmann 	__le16	tx_len;
143394a3bd02SMarcel Holtmann 	__le16	tx_time;
143494a3bd02SMarcel Holtmann } __packed;
143594a3bd02SMarcel Holtmann struct hci_rp_le_set_data_len {
143694a3bd02SMarcel Holtmann 	__u8	status;
143794a3bd02SMarcel Holtmann 	__le16	handle;
143894a3bd02SMarcel Holtmann } __packed;
143994a3bd02SMarcel Holtmann 
144094a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_DEF_DATA_LEN	0x2023
144194a3bd02SMarcel Holtmann struct hci_rp_le_read_def_data_len {
144294a3bd02SMarcel Holtmann 	__u8	status;
144394a3bd02SMarcel Holtmann 	__le16	tx_len;
144494a3bd02SMarcel Holtmann 	__le16	tx_time;
144594a3bd02SMarcel Holtmann } __packed;
144694a3bd02SMarcel Holtmann 
144794a3bd02SMarcel Holtmann #define HCI_OP_LE_WRITE_DEF_DATA_LEN	0x2024
144894a3bd02SMarcel Holtmann struct hci_cp_le_write_def_data_len {
144994a3bd02SMarcel Holtmann 	__le16	tx_len;
145094a3bd02SMarcel Holtmann 	__le16	tx_time;
145194a3bd02SMarcel Holtmann } __packed;
145294a3bd02SMarcel Holtmann 
145394a3bd02SMarcel Holtmann #define HCI_OP_LE_READ_MAX_DATA_LEN	0x202f
145494a3bd02SMarcel Holtmann struct hci_rp_le_read_max_data_len {
145594a3bd02SMarcel Holtmann 	__u8	status;
145694a3bd02SMarcel Holtmann 	__le16	tx_len;
145794a3bd02SMarcel Holtmann 	__le16	tx_time;
145894a3bd02SMarcel Holtmann 	__le16	rx_len;
145994a3bd02SMarcel Holtmann 	__le16	rx_time;
146094a3bd02SMarcel Holtmann } __packed;
146194a3bd02SMarcel Holtmann 
14621da177e4SLinus Torvalds /* ---- HCI Events ---- */
14631da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
14641da177e4SLinus Torvalds 
14651da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
14661da177e4SLinus Torvalds struct inquiry_info {
14671da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14681da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
14691da177e4SLinus Torvalds 	__u8     pscan_period_mode;
14701da177e4SLinus Torvalds 	__u8     pscan_mode;
14711da177e4SLinus Torvalds 	__u8     dev_class[3];
14721ebb9252SMarcel Holtmann 	__le16   clock_offset;
147366c853ccSGustavo F. Padovan } __packed;
14741da177e4SLinus Torvalds 
14751da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
14761da177e4SLinus Torvalds struct hci_ev_conn_complete {
14771da177e4SLinus Torvalds 	__u8     status;
14781ebb9252SMarcel Holtmann 	__le16   handle;
14791da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14801da177e4SLinus Torvalds 	__u8     link_type;
14811da177e4SLinus Torvalds 	__u8     encr_mode;
148266c853ccSGustavo F. Padovan } __packed;
14831da177e4SLinus Torvalds 
14841da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
14851da177e4SLinus Torvalds struct hci_ev_conn_request {
14861da177e4SLinus Torvalds 	bdaddr_t bdaddr;
14871da177e4SLinus Torvalds 	__u8     dev_class[3];
14881da177e4SLinus Torvalds 	__u8     link_type;
148966c853ccSGustavo F. Padovan } __packed;
14901da177e4SLinus Torvalds 
14911da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
14921da177e4SLinus Torvalds struct hci_ev_disconn_complete {
14931da177e4SLinus Torvalds 	__u8     status;
14941ebb9252SMarcel Holtmann 	__le16   handle;
14951da177e4SLinus Torvalds 	__u8     reason;
149666c853ccSGustavo F. Padovan } __packed;
14971da177e4SLinus Torvalds 
14981da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
14991da177e4SLinus Torvalds struct hci_ev_auth_complete {
15001da177e4SLinus Torvalds 	__u8     status;
15011ebb9252SMarcel Holtmann 	__le16   handle;
150266c853ccSGustavo F. Padovan } __packed;
15031da177e4SLinus Torvalds 
1504a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
1505a9de9248SMarcel Holtmann struct hci_ev_remote_name {
1506a9de9248SMarcel Holtmann 	__u8     status;
1507a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
15081f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
150966c853ccSGustavo F. Padovan } __packed;
1510a9de9248SMarcel Holtmann 
15111da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
15121da177e4SLinus Torvalds struct hci_ev_encrypt_change {
15131da177e4SLinus Torvalds 	__u8     status;
15141ebb9252SMarcel Holtmann 	__le16   handle;
15151da177e4SLinus Torvalds 	__u8     encrypt;
151666c853ccSGustavo F. Padovan } __packed;
15171da177e4SLinus Torvalds 
1518a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
1519a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
15201da177e4SLinus Torvalds 	__u8     status;
15211ebb9252SMarcel Holtmann 	__le16   handle;
152266c853ccSGustavo F. Padovan } __packed;
15231da177e4SLinus Torvalds 
1524a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
1525a9de9248SMarcel Holtmann struct hci_ev_remote_features {
1526a9de9248SMarcel Holtmann 	__u8     status;
1527a9de9248SMarcel Holtmann 	__le16   handle;
1528a9de9248SMarcel Holtmann 	__u8     features[8];
152966c853ccSGustavo F. Padovan } __packed;
1530a9de9248SMarcel Holtmann 
1531a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
1532a9de9248SMarcel Holtmann struct hci_ev_remote_version {
1533a9de9248SMarcel Holtmann 	__u8     status;
1534a9de9248SMarcel Holtmann 	__le16   handle;
1535a9de9248SMarcel Holtmann 	__u8     lmp_ver;
1536a9de9248SMarcel Holtmann 	__le16   manufacturer;
1537a9de9248SMarcel Holtmann 	__le16   lmp_subver;
153866c853ccSGustavo F. Padovan } __packed;
1539a9de9248SMarcel Holtmann 
1540a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
15411da177e4SLinus Torvalds struct hci_qos {
15421da177e4SLinus Torvalds 	__u8     service_type;
15431da177e4SLinus Torvalds 	__u32    token_rate;
15441da177e4SLinus Torvalds 	__u32    peak_bandwidth;
15451da177e4SLinus Torvalds 	__u32    latency;
15461da177e4SLinus Torvalds 	__u32    delay_variation;
154766c853ccSGustavo F. Padovan } __packed;
15481da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
15491da177e4SLinus Torvalds 	__u8     status;
15501ebb9252SMarcel Holtmann 	__le16   handle;
15511da177e4SLinus Torvalds 	struct   hci_qos qos;
155266c853ccSGustavo F. Padovan } __packed;
15531da177e4SLinus Torvalds 
1554a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
15551da177e4SLinus Torvalds struct hci_ev_cmd_complete {
15561da177e4SLinus Torvalds 	__u8     ncmd;
15571ebb9252SMarcel Holtmann 	__le16   opcode;
155866c853ccSGustavo F. Padovan } __packed;
15591da177e4SLinus Torvalds 
1560a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
15611da177e4SLinus Torvalds struct hci_ev_cmd_status {
15621da177e4SLinus Torvalds 	__u8     status;
15631da177e4SLinus Torvalds 	__u8     ncmd;
15641ebb9252SMarcel Holtmann 	__le16   opcode;
156566c853ccSGustavo F. Padovan } __packed;
15661da177e4SLinus Torvalds 
156724dfa343SMarcel Holtmann #define HCI_EV_HARDWARE_ERROR		0x10
156824dfa343SMarcel Holtmann struct hci_ev_hardware_error {
156924dfa343SMarcel Holtmann 	__u8     code;
157024dfa343SMarcel Holtmann } __packed;
157124dfa343SMarcel Holtmann 
15721da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
15731da177e4SLinus Torvalds struct hci_ev_role_change {
15741da177e4SLinus Torvalds 	__u8     status;
15751da177e4SLinus Torvalds 	bdaddr_t bdaddr;
15761da177e4SLinus Torvalds 	__u8     role;
157766c853ccSGustavo F. Padovan } __packed;
15781da177e4SLinus Torvalds 
1579a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
1580613a1c0cSAndrei Emeltchenko struct hci_comp_pkts_info {
1581613a1c0cSAndrei Emeltchenko 	__le16   handle;
1582613a1c0cSAndrei Emeltchenko 	__le16   count;
1583613a1c0cSAndrei Emeltchenko } __packed;
1584613a1c0cSAndrei Emeltchenko 
1585a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
1586a9de9248SMarcel Holtmann 	__u8     num_hndl;
1587613a1c0cSAndrei Emeltchenko 	struct hci_comp_pkts_info handles[0];
158866c853ccSGustavo F. Padovan } __packed;
1589a9de9248SMarcel Holtmann 
15901da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
15911da177e4SLinus Torvalds struct hci_ev_mode_change {
15921da177e4SLinus Torvalds 	__u8     status;
15931ebb9252SMarcel Holtmann 	__le16   handle;
15941da177e4SLinus Torvalds 	__u8     mode;
15951ebb9252SMarcel Holtmann 	__le16   interval;
159666c853ccSGustavo F. Padovan } __packed;
15971da177e4SLinus Torvalds 
15981da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
15991da177e4SLinus Torvalds struct hci_ev_pin_code_req {
16001da177e4SLinus Torvalds 	bdaddr_t bdaddr;
160166c853ccSGustavo F. Padovan } __packed;
16021da177e4SLinus Torvalds 
16031da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
16041da177e4SLinus Torvalds struct hci_ev_link_key_req {
16051da177e4SLinus Torvalds 	bdaddr_t bdaddr;
160666c853ccSGustavo F. Padovan } __packed;
16071da177e4SLinus Torvalds 
16081da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
16091da177e4SLinus Torvalds struct hci_ev_link_key_notify {
16101da177e4SLinus Torvalds 	bdaddr_t bdaddr;
16119b3b4460SAndrei Emeltchenko 	__u8     link_key[HCI_LINK_KEY_SIZE];
16121da177e4SLinus Torvalds 	__u8     key_type;
161366c853ccSGustavo F. Padovan } __packed;
16141da177e4SLinus Torvalds 
1615a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
16161da177e4SLinus Torvalds struct hci_ev_clock_offset {
16171da177e4SLinus Torvalds 	__u8     status;
16181ebb9252SMarcel Holtmann 	__le16   handle;
16191ebb9252SMarcel Holtmann 	__le16   clock_offset;
162066c853ccSGustavo F. Padovan } __packed;
16211da177e4SLinus Torvalds 
1622a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
1623a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
1624a8746417SMarcel Holtmann 	__u8     status;
1625a8746417SMarcel Holtmann 	__le16   handle;
1626a8746417SMarcel Holtmann 	__le16   pkt_type;
162766c853ccSGustavo F. Padovan } __packed;
1628a8746417SMarcel Holtmann 
162985a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
163085a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
163185a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
163285a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
163366c853ccSGustavo F. Padovan } __packed;
163485a1e930SMarcel Holtmann 
1635a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
1636a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
1637a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1638a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1639a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1640a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1641a9de9248SMarcel Holtmann 	__le16   clock_offset;
1642a9de9248SMarcel Holtmann 	__s8     rssi;
164366c853ccSGustavo F. Padovan } __packed;
1644a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
1645a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1646a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1647a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1648a9de9248SMarcel Holtmann 	__u8     pscan_mode;
1649a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1650a9de9248SMarcel Holtmann 	__le16   clock_offset;
1651a9de9248SMarcel Holtmann 	__s8     rssi;
165266c853ccSGustavo F. Padovan } __packed;
1653a9de9248SMarcel Holtmann 
1654a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
1655a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
1656a9de9248SMarcel Holtmann 	__u8     status;
1657a9de9248SMarcel Holtmann 	__le16   handle;
1658a9de9248SMarcel Holtmann 	__u8     page;
1659a9de9248SMarcel Holtmann 	__u8     max_page;
1660a9de9248SMarcel Holtmann 	__u8     features[8];
166166c853ccSGustavo F. Padovan } __packed;
1662a9de9248SMarcel Holtmann 
1663a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
1664a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
1665a9de9248SMarcel Holtmann 	__u8     status;
1666a9de9248SMarcel Holtmann 	__le16   handle;
1667a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1668a9de9248SMarcel Holtmann 	__u8     link_type;
1669a9de9248SMarcel Holtmann 	__u8     tx_interval;
1670a9de9248SMarcel Holtmann 	__u8     retrans_window;
1671a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1672a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
1673a9de9248SMarcel Holtmann 	__u8     air_mode;
167466c853ccSGustavo F. Padovan } __packed;
1675a9de9248SMarcel Holtmann 
1676a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
1677a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
1678a9de9248SMarcel Holtmann 	__u8     status;
1679a9de9248SMarcel Holtmann 	__le16   handle;
1680a9de9248SMarcel Holtmann 	__u8     tx_interval;
1681a9de9248SMarcel Holtmann 	__u8     retrans_window;
1682a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
1683a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
168466c853ccSGustavo F. Padovan } __packed;
1685a9de9248SMarcel Holtmann 
1686a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
168704837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
168804837f64SMarcel Holtmann 	__u8     status;
168904837f64SMarcel Holtmann 	__le16   handle;
169004837f64SMarcel Holtmann 	__le16   max_tx_latency;
169104837f64SMarcel Holtmann 	__le16   max_rx_latency;
169204837f64SMarcel Holtmann 	__le16   max_remote_timeout;
169304837f64SMarcel Holtmann 	__le16   max_local_timeout;
169466c853ccSGustavo F. Padovan } __packed;
169504837f64SMarcel Holtmann 
1696a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1697a9de9248SMarcel Holtmann struct extended_inquiry_info {
1698a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1699a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1700a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1701a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1702a9de9248SMarcel Holtmann 	__le16   clock_offset;
1703a9de9248SMarcel Holtmann 	__s8     rssi;
1704a9de9248SMarcel Holtmann 	__u8     data[240];
170566c853ccSGustavo F. Padovan } __packed;
1706a9de9248SMarcel Holtmann 
17071c2e0041SJohan Hedberg #define HCI_EV_KEY_REFRESH_COMPLETE	0x30
17081c2e0041SJohan Hedberg struct hci_ev_key_refresh_complete {
17091c2e0041SJohan Hedberg 	__u8	status;
17101c2e0041SJohan Hedberg 	__le16	handle;
17111c2e0041SJohan Hedberg } __packed;
17121c2e0041SJohan Hedberg 
17130493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
17140493684eSMarcel Holtmann struct hci_ev_io_capa_request {
17150493684eSMarcel Holtmann 	bdaddr_t bdaddr;
171666c853ccSGustavo F. Padovan } __packed;
17170493684eSMarcel Holtmann 
171803b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
171903b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
172003b555e1SJohan Hedberg 	bdaddr_t bdaddr;
172103b555e1SJohan Hedberg 	__u8     capability;
172203b555e1SJohan Hedberg 	__u8     oob_data;
172303b555e1SJohan Hedberg 	__u8     authentication;
172403b555e1SJohan Hedberg } __packed;
172503b555e1SJohan Hedberg 
1726a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1727a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1728a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1729a5c29683SJohan Hedberg 	__le32		passkey;
1730a5c29683SJohan Hedberg } __packed;
1731a5c29683SJohan Hedberg 
17329ad4019aSBrian Gix #define HCI_EV_USER_PASSKEY_REQUEST	0x34
17339ad4019aSBrian Gix struct hci_ev_user_passkey_req {
17349ad4019aSBrian Gix 	bdaddr_t	bdaddr;
17359ad4019aSBrian Gix } __packed;
17369ad4019aSBrian Gix 
17372763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
17382763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
17392763eda6SSzymon Janc 	bdaddr_t bdaddr;
17402763eda6SSzymon Janc } __packed;
17412763eda6SSzymon Janc 
17420493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
17430493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
17440493684eSMarcel Holtmann 	__u8     status;
17450493684eSMarcel Holtmann 	bdaddr_t bdaddr;
174666c853ccSGustavo F. Padovan } __packed;
17470493684eSMarcel Holtmann 
174892a25256SJohan Hedberg #define HCI_EV_USER_PASSKEY_NOTIFY	0x3b
174992a25256SJohan Hedberg struct hci_ev_user_passkey_notify {
175092a25256SJohan Hedberg 	bdaddr_t	bdaddr;
175192a25256SJohan Hedberg 	__le32		passkey;
175292a25256SJohan Hedberg } __packed;
175392a25256SJohan Hedberg 
175492a25256SJohan Hedberg #define HCI_KEYPRESS_STARTED		0
175592a25256SJohan Hedberg #define HCI_KEYPRESS_ENTERED		1
175692a25256SJohan Hedberg #define HCI_KEYPRESS_ERASED		2
175792a25256SJohan Hedberg #define HCI_KEYPRESS_CLEARED		3
175892a25256SJohan Hedberg #define HCI_KEYPRESS_COMPLETED		4
175992a25256SJohan Hedberg 
176092a25256SJohan Hedberg #define HCI_EV_KEYPRESS_NOTIFY		0x3c
176192a25256SJohan Hedberg struct hci_ev_keypress_notify {
176292a25256SJohan Hedberg 	bdaddr_t	bdaddr;
176392a25256SJohan Hedberg 	__u8		type;
176492a25256SJohan Hedberg } __packed;
176592a25256SJohan Hedberg 
176641a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
176741a96212SMarcel Holtmann struct hci_ev_remote_host_features {
176841a96212SMarcel Holtmann 	bdaddr_t bdaddr;
176941a96212SMarcel Holtmann 	__u8     features[8];
177066c853ccSGustavo F. Padovan } __packed;
177141a96212SMarcel Holtmann 
177263185f64SVille Tervo #define HCI_EV_LE_META			0x3e
177363185f64SVille Tervo struct hci_ev_le_meta {
177463185f64SVille Tervo 	__u8     subevent;
177563185f64SVille Tervo } __packed;
177663185f64SVille Tervo 
1777523e93cdSAndrei Emeltchenko #define HCI_EV_PHY_LINK_COMPLETE	0x40
1778523e93cdSAndrei Emeltchenko struct hci_ev_phy_link_complete {
1779523e93cdSAndrei Emeltchenko 	__u8     status;
1780523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1781523e93cdSAndrei Emeltchenko } __packed;
1782523e93cdSAndrei Emeltchenko 
1783523e93cdSAndrei Emeltchenko #define HCI_EV_CHANNEL_SELECTED		0x41
1784523e93cdSAndrei Emeltchenko struct hci_ev_channel_selected {
1785523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1786523e93cdSAndrei Emeltchenko } __packed;
1787523e93cdSAndrei Emeltchenko 
1788523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_PHY_LINK_COMPLETE	0x42
1789523e93cdSAndrei Emeltchenko struct hci_ev_disconn_phy_link_complete {
1790523e93cdSAndrei Emeltchenko 	__u8     status;
1791523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1792523e93cdSAndrei Emeltchenko 	__u8     reason;
1793523e93cdSAndrei Emeltchenko } __packed;
1794523e93cdSAndrei Emeltchenko 
1795523e93cdSAndrei Emeltchenko #define HCI_EV_LOGICAL_LINK_COMPLETE		0x45
1796523e93cdSAndrei Emeltchenko struct hci_ev_logical_link_complete {
1797523e93cdSAndrei Emeltchenko 	__u8     status;
1798523e93cdSAndrei Emeltchenko 	__le16   handle;
1799523e93cdSAndrei Emeltchenko 	__u8     phy_handle;
1800523e93cdSAndrei Emeltchenko 	__u8     flow_spec_id;
1801523e93cdSAndrei Emeltchenko } __packed;
1802523e93cdSAndrei Emeltchenko 
1803523e93cdSAndrei Emeltchenko #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE	0x46
1804523e93cdSAndrei Emeltchenko struct hci_ev_disconn_logical_link_complete {
1805523e93cdSAndrei Emeltchenko 	__u8     status;
1806523e93cdSAndrei Emeltchenko 	__le16   handle;
1807523e93cdSAndrei Emeltchenko 	__u8     reason;
1808523e93cdSAndrei Emeltchenko } __packed;
1809523e93cdSAndrei Emeltchenko 
181025e89e99SAndrei Emeltchenko #define HCI_EV_NUM_COMP_BLOCKS		0x48
181125e89e99SAndrei Emeltchenko struct hci_comp_blocks_info {
181225e89e99SAndrei Emeltchenko 	__le16   handle;
181325e89e99SAndrei Emeltchenko 	__le16   pkts;
181425e89e99SAndrei Emeltchenko 	__le16   blocks;
181525e89e99SAndrei Emeltchenko } __packed;
181625e89e99SAndrei Emeltchenko 
181725e89e99SAndrei Emeltchenko struct hci_ev_num_comp_blocks {
181825e89e99SAndrei Emeltchenko 	__le16   num_blocks;
181925e89e99SAndrei Emeltchenko 	__u8     num_hndl;
182025e89e99SAndrei Emeltchenko 	struct hci_comp_blocks_info handles[0];
182125e89e99SAndrei Emeltchenko } __packed;
182225e89e99SAndrei Emeltchenko 
18232b359445SDoHyun Pyun #define HCI_EV_SYNC_TRAIN_COMPLETE	0x4F
18242b359445SDoHyun Pyun struct hci_ev_sync_train_complete {
18252b359445SDoHyun Pyun 	__u8	status;
18262b359445SDoHyun Pyun } __packed;
18272b359445SDoHyun Pyun 
18282ed01805SDoHyun Pyun #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT	0x54
18292ed01805SDoHyun Pyun 
183063185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
183163185f64SVille Tervo struct hci_ev_le_conn_complete {
183263185f64SVille Tervo 	__u8     status;
183363185f64SVille Tervo 	__le16   handle;
183463185f64SVille Tervo 	__u8     role;
183563185f64SVille Tervo 	__u8     bdaddr_type;
183663185f64SVille Tervo 	bdaddr_t bdaddr;
183763185f64SVille Tervo 	__le16   interval;
183863185f64SVille Tervo 	__le16   latency;
183963185f64SVille Tervo 	__le16   supervision_timeout;
184063185f64SVille Tervo 	__u8     clk_accurancy;
184163185f64SVille Tervo } __packed;
184263185f64SVille Tervo 
18432331fd46SMarcel Holtmann /* Advertising report event types */
18442331fd46SMarcel Holtmann #define LE_ADV_IND		0x00
18452331fd46SMarcel Holtmann #define LE_ADV_DIRECT_IND	0x01
18462331fd46SMarcel Holtmann #define LE_ADV_SCAN_IND		0x02
18472331fd46SMarcel Holtmann #define LE_ADV_NONCONN_IND	0x03
18482331fd46SMarcel Holtmann #define LE_ADV_SCAN_RSP		0x04
18492331fd46SMarcel Holtmann 
18502331fd46SMarcel Holtmann #define ADDR_LE_DEV_PUBLIC	0x00
18512331fd46SMarcel Holtmann #define ADDR_LE_DEV_RANDOM	0x01
18522331fd46SMarcel Holtmann 
18532331fd46SMarcel Holtmann #define HCI_EV_LE_ADVERTISING_REPORT	0x02
18542331fd46SMarcel Holtmann struct hci_ev_le_advertising_info {
18552331fd46SMarcel Holtmann 	__u8	 evt_type;
18562331fd46SMarcel Holtmann 	__u8	 bdaddr_type;
18572331fd46SMarcel Holtmann 	bdaddr_t bdaddr;
18582331fd46SMarcel Holtmann 	__u8	 length;
18592331fd46SMarcel Holtmann 	__u8	 data[0];
18602331fd46SMarcel Holtmann } __packed;
18612331fd46SMarcel Holtmann 
18621855d92dSMarcel Holtmann #define HCI_EV_LE_CONN_UPDATE_COMPLETE	0x03
18631855d92dSMarcel Holtmann struct hci_ev_le_conn_update_complete {
18641855d92dSMarcel Holtmann 	__u8     status;
18651855d92dSMarcel Holtmann 	__le16   handle;
18661855d92dSMarcel Holtmann 	__le16   interval;
18671855d92dSMarcel Holtmann 	__le16   latency;
18681855d92dSMarcel Holtmann 	__le16   supervision_timeout;
18691855d92dSMarcel Holtmann } __packed;
18701855d92dSMarcel Holtmann 
1871a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1872a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1873a7a595f6SVinicius Costa Gomes 	__le16	handle;
1874fe39c7b2SMarcel Holtmann 	__le64	rand;
1875a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1876a7a595f6SVinicius Costa Gomes } __packed;
1877a7a595f6SVinicius Costa Gomes 
18788e75b46aSAndre Guedes #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ	0x06
18798e75b46aSAndre Guedes struct hci_ev_le_remote_conn_param_req {
18808e75b46aSAndre Guedes 	__le16 handle;
18818e75b46aSAndre Guedes 	__le16 interval_min;
18828e75b46aSAndre Guedes 	__le16 interval_max;
18838e75b46aSAndre Guedes 	__le16 latency;
18848e75b46aSAndre Guedes 	__le16 timeout;
18858e75b46aSAndre Guedes } __packed;
18868e75b46aSAndre Guedes 
188794a3bd02SMarcel Holtmann #define HCI_EV_LE_DATA_LEN_CHANGE	0x07
188894a3bd02SMarcel Holtmann struct hci_ev_le_data_len_change {
188994a3bd02SMarcel Holtmann 	__le16	handle;
189094a3bd02SMarcel Holtmann 	__le16	tx_len;
189194a3bd02SMarcel Holtmann 	__le16	tx_time;
189294a3bd02SMarcel Holtmann 	__le16	rx_len;
189394a3bd02SMarcel Holtmann 	__le16	rx_time;
189494a3bd02SMarcel Holtmann } __packed;
189594a3bd02SMarcel Holtmann 
189632c9d43fSMarcel Holtmann #define HCI_EV_LE_DIRECT_ADV_REPORT	0x0B
189732c9d43fSMarcel Holtmann struct hci_ev_le_direct_adv_info {
189832c9d43fSMarcel Holtmann 	__u8	 evt_type;
189932c9d43fSMarcel Holtmann 	__u8	 bdaddr_type;
190032c9d43fSMarcel Holtmann 	bdaddr_t bdaddr;
190132c9d43fSMarcel Holtmann 	__u8	 direct_addr_type;
190232c9d43fSMarcel Holtmann 	bdaddr_t direct_addr;
190332c9d43fSMarcel Holtmann 	__s8	 rssi;
190432c9d43fSMarcel Holtmann } __packed;
190532c9d43fSMarcel Holtmann 
19061da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1907a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
19081da177e4SLinus Torvalds struct hci_ev_stack_internal {
19091da177e4SLinus Torvalds 	__u16    type;
19101da177e4SLinus Torvalds 	__u8     data[0];
191166c853ccSGustavo F. Padovan } __packed;
19121da177e4SLinus Torvalds 
19131da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
19141da177e4SLinus Torvalds struct hci_ev_si_device {
19151da177e4SLinus Torvalds 	__u16    event;
19161da177e4SLinus Torvalds 	__u16    dev_id;
191766c853ccSGustavo F. Padovan } __packed;
19181da177e4SLinus Torvalds 
19191da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
19201da177e4SLinus Torvalds struct hci_ev_si_security {
19211da177e4SLinus Torvalds 	__u16    event;
19221da177e4SLinus Torvalds 	__u16    proto;
19231da177e4SLinus Torvalds 	__u16    subproto;
19241da177e4SLinus Torvalds 	__u8     incoming;
192566c853ccSGustavo F. Padovan } __packed;
19261da177e4SLinus Torvalds 
19271da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
19281da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
19291da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
19301da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
19311da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
19321da177e4SLinus Torvalds 
19331da177e4SLinus Torvalds struct hci_command_hdr {
19341ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
19351da177e4SLinus Torvalds 	__u8	plen;
193666c853ccSGustavo F. Padovan } __packed;
19371da177e4SLinus Torvalds 
19381da177e4SLinus Torvalds struct hci_event_hdr {
19391da177e4SLinus Torvalds 	__u8	evt;
19401da177e4SLinus Torvalds 	__u8	plen;
194166c853ccSGustavo F. Padovan } __packed;
19421da177e4SLinus Torvalds 
19431da177e4SLinus Torvalds struct hci_acl_hdr {
19441ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
19451ebb9252SMarcel Holtmann 	__le16	dlen;
194666c853ccSGustavo F. Padovan } __packed;
19471da177e4SLinus Torvalds 
19481da177e4SLinus Torvalds struct hci_sco_hdr {
19491ebb9252SMarcel Holtmann 	__le16	handle;
19501da177e4SLinus Torvalds 	__u8	dlen;
195166c853ccSGustavo F. Padovan } __packed;
19521da177e4SLinus Torvalds 
19532a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
19542a123b86SArnaldo Carvalho de Melo {
19552a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
19562a123b86SArnaldo Carvalho de Melo }
19572a123b86SArnaldo Carvalho de Melo 
19582a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
19592a123b86SArnaldo Carvalho de Melo {
19602a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
19612a123b86SArnaldo Carvalho de Melo }
19622a123b86SArnaldo Carvalho de Melo 
19632a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
19642a123b86SArnaldo Carvalho de Melo {
19652a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
19662a123b86SArnaldo Carvalho de Melo }
19672a123b86SArnaldo Carvalho de Melo 
19681da177e4SLinus Torvalds /* Command opcode pack/unpack */
1969c3c7ea65SGustavo Padovan #define hci_opcode_pack(ogf, ocf)	((__u16) ((ocf & 0x03ff)|(ogf << 10)))
19701da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
19711da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
19721da177e4SLinus Torvalds 
19731da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
1974c3c7ea65SGustavo Padovan #define hci_handle_pack(h, f)	((__u16) ((h & 0x0fff)|(f << 12)))
19751da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
19761da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
19771da177e4SLinus Torvalds 
19781da177e4SLinus Torvalds #endif /* __HCI_H */
1979