xref: /openbmc/linux/include/net/bluetooth/hci.h (revision e6100a2541987b84af37e4c4247d989644a3aa69)
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 
331da177e4SLinus Torvalds /* HCI dev events */
341da177e4SLinus Torvalds #define HCI_DEV_REG			1
351da177e4SLinus Torvalds #define HCI_DEV_UNREG			2
361da177e4SLinus Torvalds #define HCI_DEV_UP			3
371da177e4SLinus Torvalds #define HCI_DEV_DOWN			4
381da177e4SLinus Torvalds #define HCI_DEV_SUSPEND			5
391da177e4SLinus Torvalds #define HCI_DEV_RESUME			6
401da177e4SLinus Torvalds 
411da177e4SLinus Torvalds /* HCI notify events */
421da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_ADD		1
431da177e4SLinus Torvalds #define HCI_NOTIFY_CONN_DEL		2
441da177e4SLinus Torvalds #define HCI_NOTIFY_VOICE_SETTING	3
451da177e4SLinus Torvalds 
46c13854ceSMarcel Holtmann /* HCI bus types */
470ac53939SMarcel Holtmann #define HCI_VIRTUAL	0
481da177e4SLinus Torvalds #define HCI_USB		1
491da177e4SLinus Torvalds #define HCI_PCCARD	2
501da177e4SLinus Torvalds #define HCI_UART	3
511da177e4SLinus Torvalds #define HCI_RS232	4
521da177e4SLinus Torvalds #define HCI_PCI		5
530ac53939SMarcel Holtmann #define HCI_SDIO	6
541da177e4SLinus Torvalds 
55943da25dSMarcel Holtmann /* HCI controller types */
56943da25dSMarcel Holtmann #define HCI_BREDR	0x00
578f1e1742SDavid Vrabel #define HCI_AMP		0x01
58943da25dSMarcel Holtmann 
591da177e4SLinus Torvalds /* HCI device quirks */
601da177e4SLinus Torvalds enum {
617a9d4020SMarcel Holtmann 	HCI_QUIRK_NO_RESET,
62da1f5198SMarcel Holtmann 	HCI_QUIRK_RAW_DEVICE,
63da1f5198SMarcel Holtmann 	HCI_QUIRK_FIXUP_BUFFER_SIZE
641da177e4SLinus Torvalds };
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds /* HCI device flags */
671da177e4SLinus Torvalds enum {
681da177e4SLinus Torvalds 	HCI_UP,
691da177e4SLinus Torvalds 	HCI_INIT,
701da177e4SLinus Torvalds 	HCI_RUNNING,
711da177e4SLinus Torvalds 
721da177e4SLinus Torvalds 	HCI_PSCAN,
731da177e4SLinus Torvalds 	HCI_ISCAN,
741da177e4SLinus Torvalds 	HCI_AUTH,
751da177e4SLinus Torvalds 	HCI_ENCRYPT,
761da177e4SLinus Torvalds 	HCI_INQUIRY,
771da177e4SLinus Torvalds 
781da177e4SLinus Torvalds 	HCI_RAW,
79ab81cbf9SJohan Hedberg 
80ab81cbf9SJohan Hedberg 	HCI_SETUP,
81ab81cbf9SJohan Hedberg 	HCI_AUTO_OFF,
82ebc99febSJohan Hedberg 	HCI_MGMT,
83c542a06cSJohan Hedberg 	HCI_PAIRABLE,
841aff6f09SJohan Hedberg 	HCI_SERVICE_CACHE,
8555ed8ca1SJohan Hedberg 	HCI_LINK_KEYS,
8655ed8ca1SJohan Hedberg 	HCI_DEBUG_KEYS,
8710572132SGustavo F. Padovan 
8810572132SGustavo F. Padovan 	HCI_RESET,
891da177e4SLinus Torvalds };
901da177e4SLinus Torvalds 
911da177e4SLinus Torvalds /* HCI ioctl defines */
921da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
931da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
941da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
951da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
961da177e4SLinus Torvalds 
971da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
981da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
991da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
1001da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
10140be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1021da177e4SLinus Torvalds 
1031da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1041da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1051da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1061da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1071da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1081da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1091da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1101da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1111da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1121da177e4SLinus Torvalds 
113f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
114f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
115f0358568SJohan Hedberg 
1161da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1171da177e4SLinus Torvalds 
1181da177e4SLinus Torvalds /* HCI timeouts */
11904837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT	(40000)	/* 40 seconds */
12004837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT	(2000)	/* 2 seconds */
121052b30b0SMarcel Holtmann #define HCI_PAIRING_TIMEOUT	(60000)	/* 60 seconds */
12204837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT	(6000)	/* 6 seconds */
12304837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT	(10000)	/* 10 seconds */
1246bd32326SVille Tervo #define HCI_CMD_TIMEOUT		(1000)	/* 1 seconds */
1251da177e4SLinus Torvalds 
1265b7f9909SMarcel Holtmann /* HCI data types */
1271da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1281da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1291da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1301da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1311da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1321da177e4SLinus Torvalds 
1335b7f9909SMarcel Holtmann /* HCI packet types */
1341da177e4SLinus Torvalds #define HCI_DM1		0x0008
1351da177e4SLinus Torvalds #define HCI_DM3		0x0400
1361da177e4SLinus Torvalds #define HCI_DM5		0x4000
1371da177e4SLinus Torvalds #define HCI_DH1		0x0010
1381da177e4SLinus Torvalds #define HCI_DH3		0x0800
1391da177e4SLinus Torvalds #define HCI_DH5		0x8000
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds #define HCI_HV1		0x0020
1421da177e4SLinus Torvalds #define HCI_HV2		0x0040
1431da177e4SLinus Torvalds #define HCI_HV3		0x0080
1441da177e4SLinus Torvalds 
1451da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1461da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1471da177e4SLinus Torvalds 
1485b7f9909SMarcel Holtmann /* eSCO packet types */
1495b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1505b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1515b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1525b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1535b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1545b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
155efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
156efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
157efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
158efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
1595b7f9909SMarcel Holtmann 
160a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
161efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
162a8746417SMarcel Holtmann 
1631da177e4SLinus Torvalds /* ACL flags */
164e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
1651da177e4SLinus Torvalds #define ACL_CONT		0x01
1661da177e4SLinus Torvalds #define ACL_START		0x02
1671da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
1681da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
1691da177e4SLinus Torvalds 
1701da177e4SLinus Torvalds /* Baseband links */
1711da177e4SLinus Torvalds #define SCO_LINK	0x00
1721da177e4SLinus Torvalds #define ACL_LINK	0x01
1735b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
174fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
175fcd89c09SVille Tervo #define LE_LINK		0x80
1761da177e4SLinus Torvalds 
1771da177e4SLinus Torvalds /* LMP features */
1781da177e4SLinus Torvalds #define LMP_3SLOT	0x01
1791da177e4SLinus Torvalds #define LMP_5SLOT	0x02
1801da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
1811da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
1821da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
1831da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
1841da177e4SLinus Torvalds #define LMP_HOLD	0x40
18504837f64SMarcel Holtmann #define LMP_SNIFF	0x80
1861da177e4SLinus Torvalds 
1871da177e4SLinus Torvalds #define LMP_PARK	0x01
1881da177e4SLinus Torvalds #define LMP_RSSI	0x02
1891da177e4SLinus Torvalds #define LMP_QUALITY	0x04
1901da177e4SLinus Torvalds #define LMP_SCO		0x08
1911da177e4SLinus Torvalds #define LMP_HV2		0x10
1921da177e4SLinus Torvalds #define LMP_HV3		0x20
1931da177e4SLinus Torvalds #define LMP_ULAW	0x40
1941da177e4SLinus Torvalds #define LMP_ALAW	0x80
1951da177e4SLinus Torvalds 
1961da177e4SLinus Torvalds #define LMP_CVSD	0x01
1971da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
1981da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
1991da177e4SLinus Torvalds 
200d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
2015b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2025b7f9909SMarcel Holtmann 
2035b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2045b7f9909SMarcel Holtmann #define LMP_EV5		0x02
205d5859e22SJohan Hedberg #define LMP_LE		0x40
2065b7f9909SMarcel Holtmann 
20704837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
208d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
209efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
210efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
211efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
21204837f64SMarcel Holtmann 
213d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
214*e6100a25SAndre Guedes #define LMP_SIMUL_LE_BR	0x02
215769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
216e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
217769be974SMarcel Holtmann 
218d5859e22SJohan Hedberg #define LMP_LSTO	0x01
219d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
220971e3a4bSAndre Guedes #define LMP_EXTFEATURES	0x80
221d5859e22SJohan Hedberg 
22204837f64SMarcel Holtmann /* Connection modes */
22304837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
22404837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
22504837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
22604837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
22704837f64SMarcel Holtmann 
2281da177e4SLinus Torvalds /* Link policies */
2291da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2301da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2311da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2321da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2331da177e4SLinus Torvalds 
23404837f64SMarcel Holtmann /* Link modes */
2351da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2361da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2371da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2381da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2391da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2401da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2411da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2421da177e4SLinus Torvalds 
24340be492fSMarcel Holtmann /* Authentication types */
24440be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
24540be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
24640be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
24740be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
24840be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
24940be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
25040be492fSMarcel Holtmann 
251b6020ba0SWaldemar Rymarkiewicz /* Link Key types */
252b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_COMBINATION		0x00
253b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_LOCAL_UNIT		0x01
254b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_REMOTE_UNIT		0x02
255b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_DEBUG_COMBINATION	0x03
256b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_UNAUTH_COMBINATION	0x04
257b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_AUTH_COMBINATION		0x05
258b6020ba0SWaldemar Rymarkiewicz #define HCI_LK_CHANGED_COMBINATION	0x06
259b6020ba0SWaldemar Rymarkiewicz 
2601da177e4SLinus Torvalds /* -----  HCI Commands ---- */
2616bd32326SVille Tervo #define HCI_OP_NOP			0x0000
2626bd32326SVille Tervo 
263a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
264a9de9248SMarcel Holtmann struct hci_cp_inquiry {
265a9de9248SMarcel Holtmann 	__u8     lap[3];
266a9de9248SMarcel Holtmann 	__u8     length;
267a9de9248SMarcel Holtmann 	__u8     num_rsp;
26866c853ccSGustavo F. Padovan } __packed;
2691da177e4SLinus Torvalds 
270a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
271a9de9248SMarcel Holtmann 
272a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
273a9de9248SMarcel Holtmann 
274a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
275a9de9248SMarcel Holtmann struct hci_cp_create_conn {
276a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
277a9de9248SMarcel Holtmann 	__le16   pkt_type;
278a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
279a9de9248SMarcel Holtmann 	__u8     pscan_mode;
280a9de9248SMarcel Holtmann 	__le16   clock_offset;
281a9de9248SMarcel Holtmann 	__u8     role_switch;
28266c853ccSGustavo F. Padovan } __packed;
2831da177e4SLinus Torvalds 
284a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
285a9de9248SMarcel Holtmann struct hci_cp_disconnect {
286a9de9248SMarcel Holtmann 	__le16   handle;
287a9de9248SMarcel Holtmann 	__u8     reason;
28866c853ccSGustavo F. Padovan } __packed;
2891da177e4SLinus Torvalds 
290a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
291a9de9248SMarcel Holtmann struct hci_cp_add_sco {
292a9de9248SMarcel Holtmann 	__le16   handle;
293a9de9248SMarcel Holtmann 	__le16   pkt_type;
29466c853ccSGustavo F. Padovan } __packed;
295a9de9248SMarcel Holtmann 
296a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
297a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
2981da177e4SLinus Torvalds 	bdaddr_t bdaddr;
29966c853ccSGustavo F. Padovan } __packed;
3001da177e4SLinus Torvalds 
301a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
302a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
303a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
304a9de9248SMarcel Holtmann 	__u8     role;
30566c853ccSGustavo F. Padovan } __packed;
3061da177e4SLinus Torvalds 
307a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
308a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
309a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
310a9de9248SMarcel Holtmann 	__u8     reason;
31166c853ccSGustavo F. Padovan } __packed;
3121da177e4SLinus Torvalds 
313a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
314a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
315a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
316a9de9248SMarcel Holtmann 	__u8     link_key[16];
31766c853ccSGustavo F. Padovan } __packed;
3181da177e4SLinus Torvalds 
319a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
320a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
321a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
32266c853ccSGustavo F. Padovan } __packed;
3231da177e4SLinus Torvalds 
324a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
325a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
326a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
327a9de9248SMarcel Holtmann 	__u8     pin_len;
328a9de9248SMarcel Holtmann 	__u8     pin_code[16];
32966c853ccSGustavo F. Padovan } __packed;
330980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
331980e1a53SJohan Hedberg 	__u8     status;
332980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
333980e1a53SJohan Hedberg } __packed;
334a9de9248SMarcel Holtmann 
335a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
336a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
337a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
33866c853ccSGustavo F. Padovan } __packed;
339980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
340980e1a53SJohan Hedberg 	__u8     status;
341980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
342980e1a53SJohan Hedberg } __packed;
343a9de9248SMarcel Holtmann 
344a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
345a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
346a9de9248SMarcel Holtmann 	__le16   handle;
347a9de9248SMarcel Holtmann 	__le16   pkt_type;
34866c853ccSGustavo F. Padovan } __packed;
349a9de9248SMarcel Holtmann 
350a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
351a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
352a9de9248SMarcel Holtmann 	__le16   handle;
35366c853ccSGustavo F. Padovan } __packed;
354a9de9248SMarcel Holtmann 
355a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
356a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
357a9de9248SMarcel Holtmann 	__le16   handle;
358a9de9248SMarcel Holtmann 	__u8     encrypt;
35966c853ccSGustavo F. Padovan } __packed;
360a9de9248SMarcel Holtmann 
361a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
362a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
363a9de9248SMarcel Holtmann 	__le16   handle;
36466c853ccSGustavo F. Padovan } __packed;
365a9de9248SMarcel Holtmann 
366a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
367a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
368a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
369a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
370a9de9248SMarcel Holtmann 	__u8     pscan_mode;
371a9de9248SMarcel Holtmann 	__le16   clock_offset;
37266c853ccSGustavo F. Padovan } __packed;
373a9de9248SMarcel Holtmann 
374a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
375a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
376a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
37766c853ccSGustavo F. Padovan } __packed;
378a9de9248SMarcel Holtmann 
379a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
380a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
381a9de9248SMarcel Holtmann 	__le16   handle;
38266c853ccSGustavo F. Padovan } __packed;
383a9de9248SMarcel Holtmann 
384a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
385a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
386a9de9248SMarcel Holtmann 	__le16   handle;
387a9de9248SMarcel Holtmann 	__u8     page;
38866c853ccSGustavo F. Padovan } __packed;
389a9de9248SMarcel Holtmann 
390a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
391a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
392a9de9248SMarcel Holtmann 	__le16   handle;
39366c853ccSGustavo F. Padovan } __packed;
394a9de9248SMarcel Holtmann 
395a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
396a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
397a9de9248SMarcel Holtmann 	__le16   handle;
398a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
399a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
400a9de9248SMarcel Holtmann 	__le16   max_latency;
401a9de9248SMarcel Holtmann 	__le16   voice_setting;
402a9de9248SMarcel Holtmann 	__u8     retrans_effort;
403a9de9248SMarcel Holtmann 	__le16   pkt_type;
40466c853ccSGustavo F. Padovan } __packed;
405a9de9248SMarcel Holtmann 
406a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
407a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
408a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
409a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
410a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
411a9de9248SMarcel Holtmann 	__le16   max_latency;
412a9de9248SMarcel Holtmann 	__le16   content_format;
413a9de9248SMarcel Holtmann 	__u8     retrans_effort;
414a9de9248SMarcel Holtmann 	__le16   pkt_type;
41566c853ccSGustavo F. Padovan } __packed;
416a9de9248SMarcel Holtmann 
417a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
418a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
419a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
420a9de9248SMarcel Holtmann 	__u8     reason;
42166c853ccSGustavo F. Padovan } __packed;
422a9de9248SMarcel Holtmann 
42317fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
42417fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
42517fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
42617fa4b9dSJohan Hedberg 	__u8     capability;
42717fa4b9dSJohan Hedberg 	__u8     oob_data;
42817fa4b9dSJohan Hedberg 	__u8     authentication;
42917fa4b9dSJohan Hedberg } __packed;
43017fa4b9dSJohan Hedberg 
431a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
432a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
433a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
434a5c29683SJohan Hedberg } __packed;
435a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
436a5c29683SJohan Hedberg 	__u8     status;
437a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
438a5c29683SJohan Hedberg } __packed;
439a5c29683SJohan Hedberg 
440a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
441a5c29683SJohan Hedberg 
4422763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
4432763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
4442763eda6SSzymon Janc 	bdaddr_t bdaddr;
4452763eda6SSzymon Janc 	__u8     hash[16];
4462763eda6SSzymon Janc 	__u8     randomizer[16];
4472763eda6SSzymon Janc } __packed;
4482763eda6SSzymon Janc 
4492763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
4502763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
4512763eda6SSzymon Janc 	bdaddr_t bdaddr;
4522763eda6SSzymon Janc } __packed;
4532763eda6SSzymon Janc 
45403b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
45503b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
45603b555e1SJohan Hedberg 	bdaddr_t bdaddr;
45703b555e1SJohan Hedberg 	__u8     reason;
45803b555e1SJohan Hedberg } __packed;
45903b555e1SJohan Hedberg 
460a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
461a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
462a9de9248SMarcel Holtmann 	__le16   handle;
463a9de9248SMarcel Holtmann 	__le16   max_interval;
464a9de9248SMarcel Holtmann 	__le16   min_interval;
465a9de9248SMarcel Holtmann 	__le16   attempt;
466a9de9248SMarcel Holtmann 	__le16   timeout;
46766c853ccSGustavo F. Padovan } __packed;
468a9de9248SMarcel Holtmann 
469a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
470a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
471a9de9248SMarcel Holtmann 	__le16   handle;
47266c853ccSGustavo F. Padovan } __packed;
473a9de9248SMarcel Holtmann 
474a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
475a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
476a9de9248SMarcel Holtmann 	__le16   handle;
47766c853ccSGustavo F. Padovan } __packed;
478a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
479a9de9248SMarcel Holtmann 	__u8     status;
480a9de9248SMarcel Holtmann 	__le16   handle;
481a9de9248SMarcel Holtmann 	__u8     role;
48266c853ccSGustavo F. Padovan } __packed;
483a9de9248SMarcel Holtmann 
484a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
485a9de9248SMarcel Holtmann struct hci_cp_switch_role {
486a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
487a9de9248SMarcel Holtmann 	__u8     role;
48866c853ccSGustavo F. Padovan } __packed;
489a9de9248SMarcel Holtmann 
490a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
491a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
492a9de9248SMarcel Holtmann 	__le16   handle;
49366c853ccSGustavo F. Padovan } __packed;
494a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
495a9de9248SMarcel Holtmann 	__u8     status;
496a9de9248SMarcel Holtmann 	__le16   handle;
497a9de9248SMarcel Holtmann 	__le16   policy;
49866c853ccSGustavo F. Padovan } __packed;
499a9de9248SMarcel Holtmann 
500a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
501a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
502a9de9248SMarcel Holtmann 	__le16   handle;
503a9de9248SMarcel Holtmann 	__le16   policy;
50466c853ccSGustavo F. Padovan } __packed;
505a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
506a9de9248SMarcel Holtmann 	__u8     status;
507a9de9248SMarcel Holtmann 	__le16   handle;
50866c853ccSGustavo F. Padovan } __packed;
509a9de9248SMarcel Holtmann 
510e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
511e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
512e4e8e37cSMarcel Holtmann 	__u8     status;
513e4e8e37cSMarcel Holtmann 	__le16   policy;
51466c853ccSGustavo F. Padovan } __packed;
515e4e8e37cSMarcel Holtmann 
516e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
517e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
518e4e8e37cSMarcel Holtmann 	__le16   policy;
51966c853ccSGustavo F. Padovan } __packed;
520e4e8e37cSMarcel Holtmann 
521a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
522a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
523a9de9248SMarcel Holtmann 	__le16   handle;
524a9de9248SMarcel Holtmann 	__le16   max_latency;
525a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
526a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
52766c853ccSGustavo F. Padovan } __packed;
528a9de9248SMarcel Holtmann 
529a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
530a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
531a9de9248SMarcel Holtmann 	__u8     mask[8];
53266c853ccSGustavo F. Padovan } __packed;
533a9de9248SMarcel Holtmann 
534a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
535a9de9248SMarcel Holtmann 
536a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
5371da177e4SLinus Torvalds struct hci_cp_set_event_flt {
5381da177e4SLinus Torvalds 	__u8     flt_type;
5391da177e4SLinus Torvalds 	__u8     cond_type;
5401da177e4SLinus Torvalds 	__u8     condition[0];
54166c853ccSGustavo F. Padovan } __packed;
5421da177e4SLinus Torvalds 
5431da177e4SLinus Torvalds /* Filter types */
5441da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
5451da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
5461da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
5471da177e4SLinus Torvalds 
5481da177e4SLinus Torvalds /* CONN_SETUP Condition types */
5491da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
5501da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
5511da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
5521da177e4SLinus Torvalds 
5531da177e4SLinus Torvalds /* CONN_SETUP Conditions */
5541da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
5551da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
5561da177e4SLinus Torvalds 
557b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
558b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
559b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
560b0916ea0SJohan Hedberg 	__u8     delete_all;
561b0916ea0SJohan Hedberg } __packed;
562b0916ea0SJohan Hedberg 
5631f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
5641f6c6378SJohan Hedberg 
565a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
566a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
5671f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
56866c853ccSGustavo F. Padovan } __packed;
569a9de9248SMarcel Holtmann 
570a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
571a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
572a9de9248SMarcel Holtmann 	__u8     status;
5731f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
57466c853ccSGustavo F. Padovan } __packed;
575a9de9248SMarcel Holtmann 
576a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
577a9de9248SMarcel Holtmann 
578a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
579a9de9248SMarcel Holtmann 
580a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
581a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
582a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
583a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
584a9de9248SMarcel Holtmann 
585a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
586a9de9248SMarcel Holtmann 
587a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
588a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
589a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
590a9de9248SMarcel Holtmann 
591a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
592a9de9248SMarcel Holtmann 
593a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
594a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
595a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
596a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
597a9de9248SMarcel Holtmann 
598a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
599a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
6001da177e4SLinus Torvalds 	__u8     status;
6011da177e4SLinus Torvalds 	__u8     dev_class[3];
60266c853ccSGustavo F. Padovan } __packed;
6031da177e4SLinus Torvalds 
604a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
605a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
6061da177e4SLinus Torvalds 	__u8     dev_class[3];
60766c853ccSGustavo F. Padovan } __packed;
6081da177e4SLinus Torvalds 
609a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
6101da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
6111da177e4SLinus Torvalds 	__u8     status;
6121ebb9252SMarcel Holtmann 	__le16   voice_setting;
61366c853ccSGustavo F. Padovan } __packed;
6141da177e4SLinus Torvalds 
615a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
6161da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
6171ebb9252SMarcel Holtmann 	__le16   voice_setting;
61866c853ccSGustavo F. Padovan } __packed;
6191da177e4SLinus Torvalds 
620a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
6211da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
6221ebb9252SMarcel Holtmann 	__le16   acl_mtu;
6231da177e4SLinus Torvalds 	__u8     sco_mtu;
6241ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
6251ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
62666c853ccSGustavo F. Padovan } __packed;
6271da177e4SLinus Torvalds 
628d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
629d5859e22SJohan Hedberg 
63080a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
63180a1e1dbSJohan Hedberg 
63280a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
63380a1e1dbSJohan Hedberg struct hci_cp_write_eir {
63480a1e1dbSJohan Hedberg 	uint8_t		fec;
63580a1e1dbSJohan Hedberg 	uint8_t		data[HCI_MAX_EIR_LENGTH];
63680a1e1dbSJohan Hedberg } __packed;
63780a1e1dbSJohan Hedberg 
638333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
639333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
640333140b5SMarcel Holtmann 	__u8     status;
641333140b5SMarcel Holtmann 	__u8     mode;
64266c853ccSGustavo F. Padovan } __packed;
643333140b5SMarcel Holtmann 
644333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
645333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
646333140b5SMarcel Holtmann 	__u8     mode;
64766c853ccSGustavo F. Padovan } __packed;
648333140b5SMarcel Holtmann 
649c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
650c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
651c35938b2SSzymon Janc 	__u8     status;
652c35938b2SSzymon Janc 	__u8     hash[16];
653c35938b2SSzymon Janc 	__u8     randomizer[16];
654c35938b2SSzymon Janc } __packed;
655c35938b2SSzymon Janc 
656d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
657d5859e22SJohan Hedberg 
658f9b49306SAndre Guedes #define HCI_OP_WRITE_LE_HOST_SUPPORTED	0x0c6d
659f9b49306SAndre Guedes struct hci_cp_write_le_host_supported {
660f9b49306SAndre Guedes 	__u8 le;
661f9b49306SAndre Guedes 	__u8 simul;
662f9b49306SAndre Guedes } __packed;
663f9b49306SAndre Guedes 
664a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
665a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
6661da177e4SLinus Torvalds 	__u8     status;
667a9de9248SMarcel Holtmann 	__u8     hci_ver;
668a9de9248SMarcel Holtmann 	__le16   hci_rev;
669a9de9248SMarcel Holtmann 	__u8     lmp_ver;
670a9de9248SMarcel Holtmann 	__le16   manufacturer;
671a9de9248SMarcel Holtmann 	__le16   lmp_subver;
67266c853ccSGustavo F. Padovan } __packed;
6731da177e4SLinus Torvalds 
674a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
675a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
6761da177e4SLinus Torvalds 	__u8     status;
677a9de9248SMarcel Holtmann 	__u8     commands[64];
67866c853ccSGustavo F. Padovan } __packed;
6791da177e4SLinus Torvalds 
680a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
681a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
682a9de9248SMarcel Holtmann 	__u8     status;
683a9de9248SMarcel Holtmann 	__u8     features[8];
68466c853ccSGustavo F. Padovan } __packed;
685a9de9248SMarcel Holtmann 
686a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
687971e3a4bSAndre Guedes struct hci_cp_read_local_ext_features {
688971e3a4bSAndre Guedes 	__u8     page;
689971e3a4bSAndre Guedes } __packed;
690a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
691a9de9248SMarcel Holtmann 	__u8     status;
692a9de9248SMarcel Holtmann 	__u8     page;
693a9de9248SMarcel Holtmann 	__u8     max_page;
694a9de9248SMarcel Holtmann 	__u8     features[8];
69566c853ccSGustavo F. Padovan } __packed;
696a9de9248SMarcel Holtmann 
697a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
698a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
699a9de9248SMarcel Holtmann 	__u8     status;
700a9de9248SMarcel Holtmann 	__le16   acl_mtu;
701a9de9248SMarcel Holtmann 	__u8     sco_mtu;
702a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
703a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
70466c853ccSGustavo F. Padovan } __packed;
705a9de9248SMarcel Holtmann 
706a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
707a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
708a9de9248SMarcel Holtmann 	__u8     status;
7091da177e4SLinus Torvalds 	bdaddr_t bdaddr;
71066c853ccSGustavo F. Padovan } __packed;
7111da177e4SLinus Torvalds 
71263185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
71363185f64SVille Tervo struct hci_cp_le_set_event_mask {
71463185f64SVille Tervo 	__u8     mask[8];
71563185f64SVille Tervo } __packed;
71663185f64SVille Tervo 
71763185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
71863185f64SVille Tervo struct hci_rp_le_read_buffer_size {
71963185f64SVille Tervo 	__u8     status;
72063185f64SVille Tervo 	__le16   le_mtu;
72163185f64SVille Tervo 	__u8     le_max_pkt;
72263185f64SVille Tervo } __packed;
72363185f64SVille Tervo 
724eb9d91f5SAndre Guedes #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c
725eb9d91f5SAndre Guedes struct hci_cp_le_set_scan_enable {
726eb9d91f5SAndre Guedes 	__u8     enable;
727eb9d91f5SAndre Guedes 	__u8     filter_dup;
728eb9d91f5SAndre Guedes } __packed;
729eb9d91f5SAndre Guedes 
73063185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
73163185f64SVille Tervo struct hci_cp_le_create_conn {
73263185f64SVille Tervo 	__le16   scan_interval;
73363185f64SVille Tervo 	__le16   scan_window;
73463185f64SVille Tervo 	__u8     filter_policy;
73563185f64SVille Tervo 	__u8     peer_addr_type;
73663185f64SVille Tervo 	bdaddr_t peer_addr;
73763185f64SVille Tervo 	__u8     own_address_type;
73863185f64SVille Tervo 	__le16   conn_interval_min;
73963185f64SVille Tervo 	__le16   conn_interval_max;
74063185f64SVille Tervo 	__le16   conn_latency;
74163185f64SVille Tervo 	__le16   supervision_timeout;
74263185f64SVille Tervo 	__le16   min_ce_len;
74363185f64SVille Tervo 	__le16   max_ce_len;
74463185f64SVille Tervo } __packed;
74563185f64SVille Tervo 
74663185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
74763185f64SVille Tervo 
7482ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
7492ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
7502ce603ebSClaudio Takahasi 	__le16   handle;
7512ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
7522ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
7532ce603ebSClaudio Takahasi 	__le16   conn_latency;
7542ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
7552ce603ebSClaudio Takahasi 	__le16   min_ce_len;
7562ce603ebSClaudio Takahasi 	__le16   max_ce_len;
7572ce603ebSClaudio Takahasi } __packed;
7582ce603ebSClaudio Takahasi 
759a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_START_ENC		0x2019
760a7a595f6SVinicius Costa Gomes struct hci_cp_le_start_enc {
761a7a595f6SVinicius Costa Gomes 	__le16	handle;
762a7a595f6SVinicius Costa Gomes 	__u8	rand[8];
763a7a595f6SVinicius Costa Gomes 	__le16	ediv;
764a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
765a7a595f6SVinicius Costa Gomes } __packed;
766a7a595f6SVinicius Costa Gomes 
767a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_REPLY		0x201a
768a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_reply {
769a7a595f6SVinicius Costa Gomes 	__le16	handle;
770a7a595f6SVinicius Costa Gomes 	__u8	ltk[16];
771a7a595f6SVinicius Costa Gomes } __packed;
772a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_reply {
773a7a595f6SVinicius Costa Gomes 	__u8	status;
774a7a595f6SVinicius Costa Gomes 	__le16	handle;
775a7a595f6SVinicius Costa Gomes } __packed;
776a7a595f6SVinicius Costa Gomes 
777a7a595f6SVinicius Costa Gomes #define HCI_OP_LE_LTK_NEG_REPLY		0x201b
778a7a595f6SVinicius Costa Gomes struct hci_cp_le_ltk_neg_reply {
779a7a595f6SVinicius Costa Gomes 	__le16	handle;
780a7a595f6SVinicius Costa Gomes } __packed;
781a7a595f6SVinicius Costa Gomes struct hci_rp_le_ltk_neg_reply {
782a7a595f6SVinicius Costa Gomes 	__u8	status;
783a7a595f6SVinicius Costa Gomes 	__le16	handle;
784a7a595f6SVinicius Costa Gomes } __packed;
785a7a595f6SVinicius Costa Gomes 
7861da177e4SLinus Torvalds /* ---- HCI Events ---- */
7871da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
7881da177e4SLinus Torvalds 
7891da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
7901da177e4SLinus Torvalds struct inquiry_info {
7911da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7921da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
7931da177e4SLinus Torvalds 	__u8     pscan_period_mode;
7941da177e4SLinus Torvalds 	__u8     pscan_mode;
7951da177e4SLinus Torvalds 	__u8     dev_class[3];
7961ebb9252SMarcel Holtmann 	__le16   clock_offset;
79766c853ccSGustavo F. Padovan } __packed;
7981da177e4SLinus Torvalds 
7991da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
8001da177e4SLinus Torvalds struct hci_ev_conn_complete {
8011da177e4SLinus Torvalds 	__u8     status;
8021ebb9252SMarcel Holtmann 	__le16   handle;
8031da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8041da177e4SLinus Torvalds 	__u8     link_type;
8051da177e4SLinus Torvalds 	__u8     encr_mode;
80666c853ccSGustavo F. Padovan } __packed;
8071da177e4SLinus Torvalds 
8081da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
8091da177e4SLinus Torvalds struct hci_ev_conn_request {
8101da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8111da177e4SLinus Torvalds 	__u8     dev_class[3];
8121da177e4SLinus Torvalds 	__u8     link_type;
81366c853ccSGustavo F. Padovan } __packed;
8141da177e4SLinus Torvalds 
8151da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
8161da177e4SLinus Torvalds struct hci_ev_disconn_complete {
8171da177e4SLinus Torvalds 	__u8     status;
8181ebb9252SMarcel Holtmann 	__le16   handle;
8191da177e4SLinus Torvalds 	__u8     reason;
82066c853ccSGustavo F. Padovan } __packed;
8211da177e4SLinus Torvalds 
8221da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
8231da177e4SLinus Torvalds struct hci_ev_auth_complete {
8241da177e4SLinus Torvalds 	__u8     status;
8251ebb9252SMarcel Holtmann 	__le16   handle;
82666c853ccSGustavo F. Padovan } __packed;
8271da177e4SLinus Torvalds 
828a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
829a9de9248SMarcel Holtmann struct hci_ev_remote_name {
830a9de9248SMarcel Holtmann 	__u8     status;
831a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
8321f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
83366c853ccSGustavo F. Padovan } __packed;
834a9de9248SMarcel Holtmann 
8351da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
8361da177e4SLinus Torvalds struct hci_ev_encrypt_change {
8371da177e4SLinus Torvalds 	__u8     status;
8381ebb9252SMarcel Holtmann 	__le16   handle;
8391da177e4SLinus Torvalds 	__u8     encrypt;
84066c853ccSGustavo F. Padovan } __packed;
8411da177e4SLinus Torvalds 
842a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
843a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
8441da177e4SLinus Torvalds 	__u8     status;
8451ebb9252SMarcel Holtmann 	__le16   handle;
84666c853ccSGustavo F. Padovan } __packed;
8471da177e4SLinus Torvalds 
848a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
849a9de9248SMarcel Holtmann struct hci_ev_remote_features {
850a9de9248SMarcel Holtmann 	__u8     status;
851a9de9248SMarcel Holtmann 	__le16   handle;
852a9de9248SMarcel Holtmann 	__u8     features[8];
85366c853ccSGustavo F. Padovan } __packed;
854a9de9248SMarcel Holtmann 
855a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
856a9de9248SMarcel Holtmann struct hci_ev_remote_version {
857a9de9248SMarcel Holtmann 	__u8     status;
858a9de9248SMarcel Holtmann 	__le16   handle;
859a9de9248SMarcel Holtmann 	__u8     lmp_ver;
860a9de9248SMarcel Holtmann 	__le16   manufacturer;
861a9de9248SMarcel Holtmann 	__le16   lmp_subver;
86266c853ccSGustavo F. Padovan } __packed;
863a9de9248SMarcel Holtmann 
864a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
8651da177e4SLinus Torvalds struct hci_qos {
8661da177e4SLinus Torvalds 	__u8     service_type;
8671da177e4SLinus Torvalds 	__u32    token_rate;
8681da177e4SLinus Torvalds 	__u32    peak_bandwidth;
8691da177e4SLinus Torvalds 	__u32    latency;
8701da177e4SLinus Torvalds 	__u32    delay_variation;
87166c853ccSGustavo F. Padovan } __packed;
8721da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
8731da177e4SLinus Torvalds 	__u8     status;
8741ebb9252SMarcel Holtmann 	__le16   handle;
8751da177e4SLinus Torvalds 	struct   hci_qos qos;
87666c853ccSGustavo F. Padovan } __packed;
8771da177e4SLinus Torvalds 
878a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
8791da177e4SLinus Torvalds struct hci_ev_cmd_complete {
8801da177e4SLinus Torvalds 	__u8     ncmd;
8811ebb9252SMarcel Holtmann 	__le16   opcode;
88266c853ccSGustavo F. Padovan } __packed;
8831da177e4SLinus Torvalds 
884a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
8851da177e4SLinus Torvalds struct hci_ev_cmd_status {
8861da177e4SLinus Torvalds 	__u8     status;
8871da177e4SLinus Torvalds 	__u8     ncmd;
8881ebb9252SMarcel Holtmann 	__le16   opcode;
88966c853ccSGustavo F. Padovan } __packed;
8901da177e4SLinus Torvalds 
8911da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
8921da177e4SLinus Torvalds struct hci_ev_role_change {
8931da177e4SLinus Torvalds 	__u8     status;
8941da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8951da177e4SLinus Torvalds 	__u8     role;
89666c853ccSGustavo F. Padovan } __packed;
8971da177e4SLinus Torvalds 
898a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
899a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
900a9de9248SMarcel Holtmann 	__u8     num_hndl;
901a9de9248SMarcel Holtmann 	/* variable length part */
90266c853ccSGustavo F. Padovan } __packed;
903a9de9248SMarcel Holtmann 
9041da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
9051da177e4SLinus Torvalds struct hci_ev_mode_change {
9061da177e4SLinus Torvalds 	__u8     status;
9071ebb9252SMarcel Holtmann 	__le16   handle;
9081da177e4SLinus Torvalds 	__u8     mode;
9091ebb9252SMarcel Holtmann 	__le16   interval;
91066c853ccSGustavo F. Padovan } __packed;
9111da177e4SLinus Torvalds 
9121da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
9131da177e4SLinus Torvalds struct hci_ev_pin_code_req {
9141da177e4SLinus Torvalds 	bdaddr_t bdaddr;
91566c853ccSGustavo F. Padovan } __packed;
9161da177e4SLinus Torvalds 
9171da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
9181da177e4SLinus Torvalds struct hci_ev_link_key_req {
9191da177e4SLinus Torvalds 	bdaddr_t bdaddr;
92066c853ccSGustavo F. Padovan } __packed;
9211da177e4SLinus Torvalds 
9221da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
9231da177e4SLinus Torvalds struct hci_ev_link_key_notify {
9241da177e4SLinus Torvalds 	bdaddr_t bdaddr;
9251da177e4SLinus Torvalds 	__u8     link_key[16];
9261da177e4SLinus Torvalds 	__u8     key_type;
92766c853ccSGustavo F. Padovan } __packed;
9281da177e4SLinus Torvalds 
929a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
9301da177e4SLinus Torvalds struct hci_ev_clock_offset {
9311da177e4SLinus Torvalds 	__u8     status;
9321ebb9252SMarcel Holtmann 	__le16   handle;
9331ebb9252SMarcel Holtmann 	__le16   clock_offset;
93466c853ccSGustavo F. Padovan } __packed;
9351da177e4SLinus Torvalds 
936a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
937a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
938a8746417SMarcel Holtmann 	__u8     status;
939a8746417SMarcel Holtmann 	__le16   handle;
940a8746417SMarcel Holtmann 	__le16   pkt_type;
94166c853ccSGustavo F. Padovan } __packed;
942a8746417SMarcel Holtmann 
94385a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
94485a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
94585a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
94685a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
94766c853ccSGustavo F. Padovan } __packed;
94885a1e930SMarcel Holtmann 
949a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
950a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
951a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
952a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
953a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
954a9de9248SMarcel Holtmann 	__u8     dev_class[3];
955a9de9248SMarcel Holtmann 	__le16   clock_offset;
956a9de9248SMarcel Holtmann 	__s8     rssi;
95766c853ccSGustavo F. Padovan } __packed;
958a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
959a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
960a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
961a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
962a9de9248SMarcel Holtmann 	__u8     pscan_mode;
963a9de9248SMarcel Holtmann 	__u8     dev_class[3];
964a9de9248SMarcel Holtmann 	__le16   clock_offset;
965a9de9248SMarcel Holtmann 	__s8     rssi;
96666c853ccSGustavo F. Padovan } __packed;
967a9de9248SMarcel Holtmann 
968a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
969a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
970a9de9248SMarcel Holtmann 	__u8     status;
971a9de9248SMarcel Holtmann 	__le16   handle;
972a9de9248SMarcel Holtmann 	__u8     page;
973a9de9248SMarcel Holtmann 	__u8     max_page;
974a9de9248SMarcel Holtmann 	__u8     features[8];
97566c853ccSGustavo F. Padovan } __packed;
976a9de9248SMarcel Holtmann 
977a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
978a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
979a9de9248SMarcel Holtmann 	__u8     status;
980a9de9248SMarcel Holtmann 	__le16   handle;
981a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
982a9de9248SMarcel Holtmann 	__u8     link_type;
983a9de9248SMarcel Holtmann 	__u8     tx_interval;
984a9de9248SMarcel Holtmann 	__u8     retrans_window;
985a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
986a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
987a9de9248SMarcel Holtmann 	__u8     air_mode;
98866c853ccSGustavo F. Padovan } __packed;
989a9de9248SMarcel Holtmann 
990a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
991a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
992a9de9248SMarcel Holtmann 	__u8     status;
993a9de9248SMarcel Holtmann 	__le16   handle;
994a9de9248SMarcel Holtmann 	__u8     tx_interval;
995a9de9248SMarcel Holtmann 	__u8     retrans_window;
996a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
997a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
99866c853ccSGustavo F. Padovan } __packed;
999a9de9248SMarcel Holtmann 
1000a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
100104837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
100204837f64SMarcel Holtmann 	__u8     status;
100304837f64SMarcel Holtmann 	__le16   handle;
100404837f64SMarcel Holtmann 	__le16   max_tx_latency;
100504837f64SMarcel Holtmann 	__le16   max_rx_latency;
100604837f64SMarcel Holtmann 	__le16   max_remote_timeout;
100704837f64SMarcel Holtmann 	__le16   max_local_timeout;
100866c853ccSGustavo F. Padovan } __packed;
100904837f64SMarcel Holtmann 
1010a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
1011a9de9248SMarcel Holtmann struct extended_inquiry_info {
1012a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
1013a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
1014a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
1015a9de9248SMarcel Holtmann 	__u8     dev_class[3];
1016a9de9248SMarcel Holtmann 	__le16   clock_offset;
1017a9de9248SMarcel Holtmann 	__s8     rssi;
1018a9de9248SMarcel Holtmann 	__u8     data[240];
101966c853ccSGustavo F. Padovan } __packed;
1020a9de9248SMarcel Holtmann 
10210493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
10220493684eSMarcel Holtmann struct hci_ev_io_capa_request {
10230493684eSMarcel Holtmann 	bdaddr_t bdaddr;
102466c853ccSGustavo F. Padovan } __packed;
10250493684eSMarcel Holtmann 
102603b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
102703b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
102803b555e1SJohan Hedberg 	bdaddr_t bdaddr;
102903b555e1SJohan Hedberg 	__u8     capability;
103003b555e1SJohan Hedberg 	__u8     oob_data;
103103b555e1SJohan Hedberg 	__u8     authentication;
103203b555e1SJohan Hedberg } __packed;
103303b555e1SJohan Hedberg 
1034a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
1035a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
1036a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
1037a5c29683SJohan Hedberg 	__le32		passkey;
1038a5c29683SJohan Hedberg } __packed;
1039a5c29683SJohan Hedberg 
10402763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
10412763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
10422763eda6SSzymon Janc 	bdaddr_t bdaddr;
10432763eda6SSzymon Janc } __packed;
10442763eda6SSzymon Janc 
10450493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
10460493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
10470493684eSMarcel Holtmann 	__u8     status;
10480493684eSMarcel Holtmann 	bdaddr_t bdaddr;
104966c853ccSGustavo F. Padovan } __packed;
10500493684eSMarcel Holtmann 
105141a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
105241a96212SMarcel Holtmann struct hci_ev_remote_host_features {
105341a96212SMarcel Holtmann 	bdaddr_t bdaddr;
105441a96212SMarcel Holtmann 	__u8     features[8];
105566c853ccSGustavo F. Padovan } __packed;
105641a96212SMarcel Holtmann 
105763185f64SVille Tervo #define HCI_EV_LE_META			0x3e
105863185f64SVille Tervo struct hci_ev_le_meta {
105963185f64SVille Tervo 	__u8     subevent;
106063185f64SVille Tervo } __packed;
106163185f64SVille Tervo 
106263185f64SVille Tervo /* Low energy meta events */
106363185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
106463185f64SVille Tervo struct hci_ev_le_conn_complete {
106563185f64SVille Tervo 	__u8     status;
106663185f64SVille Tervo 	__le16   handle;
106763185f64SVille Tervo 	__u8     role;
106863185f64SVille Tervo 	__u8     bdaddr_type;
106963185f64SVille Tervo 	bdaddr_t bdaddr;
107063185f64SVille Tervo 	__le16   interval;
107163185f64SVille Tervo 	__le16   latency;
107263185f64SVille Tervo 	__le16   supervision_timeout;
107363185f64SVille Tervo 	__u8     clk_accurancy;
107463185f64SVille Tervo } __packed;
107563185f64SVille Tervo 
1076a7a595f6SVinicius Costa Gomes #define HCI_EV_LE_LTK_REQ		0x05
1077a7a595f6SVinicius Costa Gomes struct hci_ev_le_ltk_req {
1078a7a595f6SVinicius Costa Gomes 	__le16	handle;
1079a7a595f6SVinicius Costa Gomes 	__u8	random[8];
1080a7a595f6SVinicius Costa Gomes 	__le16	ediv;
1081a7a595f6SVinicius Costa Gomes } __packed;
1082a7a595f6SVinicius Costa Gomes 
108357a56fd4SAnderson Briglia /* Advertising report event types */
108457a56fd4SAnderson Briglia #define ADV_IND		0x00
108557a56fd4SAnderson Briglia #define ADV_DIRECT_IND	0x01
108657a56fd4SAnderson Briglia #define ADV_SCAN_IND	0x02
108757a56fd4SAnderson Briglia #define ADV_NONCONN_IND	0x03
108857a56fd4SAnderson Briglia #define ADV_SCAN_RSP	0x04
108957a56fd4SAnderson Briglia 
109057a56fd4SAnderson Briglia #define ADDR_LE_DEV_PUBLIC	0x00
109157a56fd4SAnderson Briglia #define ADDR_LE_DEV_RANDOM	0x01
109257a56fd4SAnderson Briglia 
109357a56fd4SAnderson Briglia #define HCI_EV_LE_ADVERTISING_REPORT	0x02
109457a56fd4SAnderson Briglia struct hci_ev_le_advertising_info {
109557a56fd4SAnderson Briglia 	__u8	 evt_type;
109657a56fd4SAnderson Briglia 	__u8	 bdaddr_type;
109757a56fd4SAnderson Briglia 	bdaddr_t bdaddr;
109857a56fd4SAnderson Briglia 	__u8	 length;
109957a56fd4SAnderson Briglia 	__u8	 data[0];
110057a56fd4SAnderson Briglia } __packed;
110157a56fd4SAnderson Briglia 
11021da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1103a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
11041da177e4SLinus Torvalds struct hci_ev_stack_internal {
11051da177e4SLinus Torvalds 	__u16    type;
11061da177e4SLinus Torvalds 	__u8     data[0];
110766c853ccSGustavo F. Padovan } __packed;
11081da177e4SLinus Torvalds 
11091da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
11101da177e4SLinus Torvalds struct hci_ev_si_device {
11111da177e4SLinus Torvalds 	__u16    event;
11121da177e4SLinus Torvalds 	__u16    dev_id;
111366c853ccSGustavo F. Padovan } __packed;
11141da177e4SLinus Torvalds 
11151da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
11161da177e4SLinus Torvalds struct hci_ev_si_security {
11171da177e4SLinus Torvalds 	__u16    event;
11181da177e4SLinus Torvalds 	__u16    proto;
11191da177e4SLinus Torvalds 	__u16    subproto;
11201da177e4SLinus Torvalds 	__u8     incoming;
112166c853ccSGustavo F. Padovan } __packed;
11221da177e4SLinus Torvalds 
11231da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
11241da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
11251da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
11261da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
11271da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
11281da177e4SLinus Torvalds 
11291da177e4SLinus Torvalds struct hci_command_hdr {
11301ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
11311da177e4SLinus Torvalds 	__u8	plen;
113266c853ccSGustavo F. Padovan } __packed;
11331da177e4SLinus Torvalds 
11341da177e4SLinus Torvalds struct hci_event_hdr {
11351da177e4SLinus Torvalds 	__u8	evt;
11361da177e4SLinus Torvalds 	__u8	plen;
113766c853ccSGustavo F. Padovan } __packed;
11381da177e4SLinus Torvalds 
11391da177e4SLinus Torvalds struct hci_acl_hdr {
11401ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
11411ebb9252SMarcel Holtmann 	__le16	dlen;
114266c853ccSGustavo F. Padovan } __packed;
11431da177e4SLinus Torvalds 
11441da177e4SLinus Torvalds struct hci_sco_hdr {
11451ebb9252SMarcel Holtmann 	__le16	handle;
11461da177e4SLinus Torvalds 	__u8	dlen;
114766c853ccSGustavo F. Padovan } __packed;
11481da177e4SLinus Torvalds 
11492a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h>
11502a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
11512a123b86SArnaldo Carvalho de Melo {
11522a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
11532a123b86SArnaldo Carvalho de Melo }
11542a123b86SArnaldo Carvalho de Melo 
11552a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
11562a123b86SArnaldo Carvalho de Melo {
11572a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
11582a123b86SArnaldo Carvalho de Melo }
11592a123b86SArnaldo Carvalho de Melo 
11602a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
11612a123b86SArnaldo Carvalho de Melo {
11622a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
11632a123b86SArnaldo Carvalho de Melo }
11642a123b86SArnaldo Carvalho de Melo 
11651da177e4SLinus Torvalds /* Command opcode pack/unpack */
11661da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf)	(__u16) ((ocf & 0x03ff)|(ogf << 10))
11671da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
11681da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
11691da177e4SLinus Torvalds 
11701da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
11711da177e4SLinus Torvalds #define hci_handle_pack(h, f)	(__u16) ((h & 0x0fff)|(f << 12))
11721da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
11731da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
11741da177e4SLinus Torvalds 
11751da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
11761da177e4SLinus Torvalds 
11771da177e4SLinus Torvalds /* Socket options */
11781da177e4SLinus Torvalds #define HCI_DATA_DIR	1
11791da177e4SLinus Torvalds #define HCI_FILTER	2
11801da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
11811da177e4SLinus Torvalds 
11821da177e4SLinus Torvalds /* CMSG flags */
11831da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
11841da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
11851da177e4SLinus Torvalds 
11861da177e4SLinus Torvalds struct sockaddr_hci {
11871da177e4SLinus Torvalds 	sa_family_t    hci_family;
11881da177e4SLinus Torvalds 	unsigned short hci_dev;
1189c02178d2SJohan Hedberg 	unsigned short hci_channel;
11901da177e4SLinus Torvalds };
11911da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
11921da177e4SLinus Torvalds 
1193c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1194c02178d2SJohan Hedberg #define HCI_CHANNEL_CONTROL	1
1195c02178d2SJohan Hedberg 
11961da177e4SLinus Torvalds struct hci_filter {
11971da177e4SLinus Torvalds 	unsigned long type_mask;
11981da177e4SLinus Torvalds 	unsigned long event_mask[2];
1199905f3ed6SAl Viro 	__le16 opcode;
12001da177e4SLinus Torvalds };
12011da177e4SLinus Torvalds 
12021da177e4SLinus Torvalds struct hci_ufilter {
12031da177e4SLinus Torvalds 	__u32  type_mask;
12041da177e4SLinus Torvalds 	__u32  event_mask[2];
1205905f3ed6SAl Viro 	__le16 opcode;
12061da177e4SLinus Torvalds };
12071da177e4SLinus Torvalds 
12081da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
12091da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
12101da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
12111da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
12121da177e4SLinus Torvalds 
12131da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
12141da177e4SLinus Torvalds struct hci_dev_stats {
12151da177e4SLinus Torvalds 	__u32 err_rx;
12161da177e4SLinus Torvalds 	__u32 err_tx;
12171da177e4SLinus Torvalds 	__u32 cmd_tx;
12181da177e4SLinus Torvalds 	__u32 evt_rx;
12191da177e4SLinus Torvalds 	__u32 acl_tx;
12201da177e4SLinus Torvalds 	__u32 acl_rx;
12211da177e4SLinus Torvalds 	__u32 sco_tx;
12221da177e4SLinus Torvalds 	__u32 sco_rx;
12231da177e4SLinus Torvalds 	__u32 byte_rx;
12241da177e4SLinus Torvalds 	__u32 byte_tx;
12251da177e4SLinus Torvalds };
12261da177e4SLinus Torvalds 
12271da177e4SLinus Torvalds struct hci_dev_info {
12281da177e4SLinus Torvalds 	__u16 dev_id;
12291da177e4SLinus Torvalds 	char  name[8];
12301da177e4SLinus Torvalds 
12311da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12321da177e4SLinus Torvalds 
12331da177e4SLinus Torvalds 	__u32 flags;
12341da177e4SLinus Torvalds 	__u8  type;
12351da177e4SLinus Torvalds 
12361da177e4SLinus Torvalds 	__u8  features[8];
12371da177e4SLinus Torvalds 
12381da177e4SLinus Torvalds 	__u32 pkt_type;
12391da177e4SLinus Torvalds 	__u32 link_policy;
12401da177e4SLinus Torvalds 	__u32 link_mode;
12411da177e4SLinus Torvalds 
12421da177e4SLinus Torvalds 	__u16 acl_mtu;
12431da177e4SLinus Torvalds 	__u16 acl_pkts;
12441da177e4SLinus Torvalds 	__u16 sco_mtu;
12451da177e4SLinus Torvalds 	__u16 sco_pkts;
12461da177e4SLinus Torvalds 
12471da177e4SLinus Torvalds 	struct hci_dev_stats stat;
12481da177e4SLinus Torvalds };
12491da177e4SLinus Torvalds 
12501da177e4SLinus Torvalds struct hci_conn_info {
12511da177e4SLinus Torvalds 	__u16    handle;
12521da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12531da177e4SLinus Torvalds 	__u8     type;
12541da177e4SLinus Torvalds 	__u8     out;
12551da177e4SLinus Torvalds 	__u16    state;
12561da177e4SLinus Torvalds 	__u32    link_mode;
12571da177e4SLinus Torvalds };
12581da177e4SLinus Torvalds 
12591da177e4SLinus Torvalds struct hci_dev_req {
12601da177e4SLinus Torvalds 	__u16  dev_id;
12611da177e4SLinus Torvalds 	__u32  dev_opt;
12621da177e4SLinus Torvalds };
12631da177e4SLinus Torvalds 
12641da177e4SLinus Torvalds struct hci_dev_list_req {
12651da177e4SLinus Torvalds 	__u16  dev_num;
12661da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
12671da177e4SLinus Torvalds };
12681da177e4SLinus Torvalds 
12691da177e4SLinus Torvalds struct hci_conn_list_req {
12701da177e4SLinus Torvalds 	__u16  dev_id;
12711da177e4SLinus Torvalds 	__u16  conn_num;
12721da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
12731da177e4SLinus Torvalds };
12741da177e4SLinus Torvalds 
12751da177e4SLinus Torvalds struct hci_conn_info_req {
12761da177e4SLinus Torvalds 	bdaddr_t bdaddr;
12771da177e4SLinus Torvalds 	__u8     type;
12781da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
12791da177e4SLinus Torvalds };
12801da177e4SLinus Torvalds 
128140be492fSMarcel Holtmann struct hci_auth_info_req {
128240be492fSMarcel Holtmann 	bdaddr_t bdaddr;
128340be492fSMarcel Holtmann 	__u8     type;
128440be492fSMarcel Holtmann };
128540be492fSMarcel Holtmann 
12861da177e4SLinus Torvalds struct hci_inquiry_req {
12871da177e4SLinus Torvalds 	__u16 dev_id;
12881da177e4SLinus Torvalds 	__u16 flags;
12891da177e4SLinus Torvalds 	__u8  lap[3];
12901da177e4SLinus Torvalds 	__u8  length;
12911da177e4SLinus Torvalds 	__u8  num_rsp;
12921da177e4SLinus Torvalds };
12931da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
12941da177e4SLinus Torvalds 
12951da177e4SLinus Torvalds #endif /* __HCI_H */
1296