xref: /openbmc/linux/include/net/bluetooth/hci.h (revision fcd89c09a59a054fb986861e0862aa2fff7d7c40)
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,
871da177e4SLinus Torvalds };
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds /* HCI ioctl defines */
901da177e4SLinus Torvalds #define HCIDEVUP	_IOW('H', 201, int)
911da177e4SLinus Torvalds #define HCIDEVDOWN	_IOW('H', 202, int)
921da177e4SLinus Torvalds #define HCIDEVRESET	_IOW('H', 203, int)
931da177e4SLinus Torvalds #define HCIDEVRESTAT	_IOW('H', 204, int)
941da177e4SLinus Torvalds 
951da177e4SLinus Torvalds #define HCIGETDEVLIST	_IOR('H', 210, int)
961da177e4SLinus Torvalds #define HCIGETDEVINFO	_IOR('H', 211, int)
971da177e4SLinus Torvalds #define HCIGETCONNLIST	_IOR('H', 212, int)
981da177e4SLinus Torvalds #define HCIGETCONNINFO	_IOR('H', 213, int)
9940be492fSMarcel Holtmann #define HCIGETAUTHINFO	_IOR('H', 215, int)
1001da177e4SLinus Torvalds 
1011da177e4SLinus Torvalds #define HCISETRAW	_IOW('H', 220, int)
1021da177e4SLinus Torvalds #define HCISETSCAN	_IOW('H', 221, int)
1031da177e4SLinus Torvalds #define HCISETAUTH	_IOW('H', 222, int)
1041da177e4SLinus Torvalds #define HCISETENCRYPT	_IOW('H', 223, int)
1051da177e4SLinus Torvalds #define HCISETPTYPE	_IOW('H', 224, int)
1061da177e4SLinus Torvalds #define HCISETLINKPOL	_IOW('H', 225, int)
1071da177e4SLinus Torvalds #define HCISETLINKMODE	_IOW('H', 226, int)
1081da177e4SLinus Torvalds #define HCISETACLMTU	_IOW('H', 227, int)
1091da177e4SLinus Torvalds #define HCISETSCOMTU	_IOW('H', 228, int)
1101da177e4SLinus Torvalds 
111f0358568SJohan Hedberg #define HCIBLOCKADDR	_IOW('H', 230, int)
112f0358568SJohan Hedberg #define HCIUNBLOCKADDR	_IOW('H', 231, int)
113f0358568SJohan Hedberg 
1141da177e4SLinus Torvalds #define HCIINQUIRY	_IOR('H', 240, int)
1151da177e4SLinus Torvalds 
1161da177e4SLinus Torvalds /* HCI timeouts */
11704837f64SMarcel Holtmann #define HCI_CONNECT_TIMEOUT	(40000)	/* 40 seconds */
11804837f64SMarcel Holtmann #define HCI_DISCONN_TIMEOUT	(2000)	/* 2 seconds */
119052b30b0SMarcel Holtmann #define HCI_PAIRING_TIMEOUT	(60000)	/* 60 seconds */
12004837f64SMarcel Holtmann #define HCI_IDLE_TIMEOUT	(6000)	/* 6 seconds */
12104837f64SMarcel Holtmann #define HCI_INIT_TIMEOUT	(10000)	/* 10 seconds */
1221da177e4SLinus Torvalds 
1235b7f9909SMarcel Holtmann /* HCI data types */
1241da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1251da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1261da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1271da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1281da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1291da177e4SLinus Torvalds 
1305b7f9909SMarcel Holtmann /* HCI packet types */
1311da177e4SLinus Torvalds #define HCI_DM1		0x0008
1321da177e4SLinus Torvalds #define HCI_DM3		0x0400
1331da177e4SLinus Torvalds #define HCI_DM5		0x4000
1341da177e4SLinus Torvalds #define HCI_DH1		0x0010
1351da177e4SLinus Torvalds #define HCI_DH3		0x0800
1361da177e4SLinus Torvalds #define HCI_DH5		0x8000
1371da177e4SLinus Torvalds 
1381da177e4SLinus Torvalds #define HCI_HV1		0x0020
1391da177e4SLinus Torvalds #define HCI_HV2		0x0040
1401da177e4SLinus Torvalds #define HCI_HV3		0x0080
1411da177e4SLinus Torvalds 
1421da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1431da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1441da177e4SLinus Torvalds 
1455b7f9909SMarcel Holtmann /* eSCO packet types */
1465b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1475b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1485b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1495b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1505b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1515b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
152efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
153efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
154efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
155efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
1565b7f9909SMarcel Holtmann 
157a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
158efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
159a8746417SMarcel Holtmann 
1601da177e4SLinus Torvalds /* ACL flags */
161e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
1621da177e4SLinus Torvalds #define ACL_CONT		0x01
1631da177e4SLinus Torvalds #define ACL_START		0x02
1641da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
1651da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
1661da177e4SLinus Torvalds 
1671da177e4SLinus Torvalds /* Baseband links */
1681da177e4SLinus Torvalds #define SCO_LINK	0x00
1691da177e4SLinus Torvalds #define ACL_LINK	0x01
1705b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
171*fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
172*fcd89c09SVille Tervo #define LE_LINK		0x80
1731da177e4SLinus Torvalds 
1741da177e4SLinus Torvalds /* LMP features */
1751da177e4SLinus Torvalds #define LMP_3SLOT	0x01
1761da177e4SLinus Torvalds #define LMP_5SLOT	0x02
1771da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
1781da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
1791da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
1801da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
1811da177e4SLinus Torvalds #define LMP_HOLD	0x40
18204837f64SMarcel Holtmann #define LMP_SNIFF	0x80
1831da177e4SLinus Torvalds 
1841da177e4SLinus Torvalds #define LMP_PARK	0x01
1851da177e4SLinus Torvalds #define LMP_RSSI	0x02
1861da177e4SLinus Torvalds #define LMP_QUALITY	0x04
1871da177e4SLinus Torvalds #define LMP_SCO		0x08
1881da177e4SLinus Torvalds #define LMP_HV2		0x10
1891da177e4SLinus Torvalds #define LMP_HV3		0x20
1901da177e4SLinus Torvalds #define LMP_ULAW	0x40
1911da177e4SLinus Torvalds #define LMP_ALAW	0x80
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds #define LMP_CVSD	0x01
1941da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
1951da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
1961da177e4SLinus Torvalds 
197d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
1985b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
1995b7f9909SMarcel Holtmann 
2005b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2015b7f9909SMarcel Holtmann #define LMP_EV5		0x02
202d5859e22SJohan Hedberg #define LMP_LE		0x40
2035b7f9909SMarcel Holtmann 
20404837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
205d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
206efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
207efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
208efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
20904837f64SMarcel Holtmann 
210d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
211769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
212e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
213769be974SMarcel Holtmann 
214d5859e22SJohan Hedberg #define LMP_LSTO	0x01
215d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
216d5859e22SJohan Hedberg 
21704837f64SMarcel Holtmann /* Connection modes */
21804837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
21904837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
22004837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
22104837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
22204837f64SMarcel Holtmann 
2231da177e4SLinus Torvalds /* Link policies */
2241da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2251da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2261da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2271da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2281da177e4SLinus Torvalds 
22904837f64SMarcel Holtmann /* Link modes */
2301da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2311da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2321da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2331da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2341da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2351da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2361da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2371da177e4SLinus Torvalds 
23840be492fSMarcel Holtmann /* Authentication types */
23940be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
24040be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
24140be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
24240be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
24340be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
24440be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
24540be492fSMarcel Holtmann 
2461da177e4SLinus Torvalds /* -----  HCI Commands ---- */
247a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
248a9de9248SMarcel Holtmann struct hci_cp_inquiry {
249a9de9248SMarcel Holtmann 	__u8     lap[3];
250a9de9248SMarcel Holtmann 	__u8     length;
251a9de9248SMarcel Holtmann 	__u8     num_rsp;
25266c853ccSGustavo F. Padovan } __packed;
2531da177e4SLinus Torvalds 
254a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
255a9de9248SMarcel Holtmann 
256a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
257a9de9248SMarcel Holtmann 
258a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
259a9de9248SMarcel Holtmann struct hci_cp_create_conn {
260a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
261a9de9248SMarcel Holtmann 	__le16   pkt_type;
262a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
263a9de9248SMarcel Holtmann 	__u8     pscan_mode;
264a9de9248SMarcel Holtmann 	__le16   clock_offset;
265a9de9248SMarcel Holtmann 	__u8     role_switch;
26666c853ccSGustavo F. Padovan } __packed;
2671da177e4SLinus Torvalds 
268a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
269a9de9248SMarcel Holtmann struct hci_cp_disconnect {
270a9de9248SMarcel Holtmann 	__le16   handle;
271a9de9248SMarcel Holtmann 	__u8     reason;
27266c853ccSGustavo F. Padovan } __packed;
2731da177e4SLinus Torvalds 
274a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
275a9de9248SMarcel Holtmann struct hci_cp_add_sco {
276a9de9248SMarcel Holtmann 	__le16   handle;
277a9de9248SMarcel Holtmann 	__le16   pkt_type;
27866c853ccSGustavo F. Padovan } __packed;
279a9de9248SMarcel Holtmann 
280a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
281a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
2821da177e4SLinus Torvalds 	bdaddr_t bdaddr;
28366c853ccSGustavo F. Padovan } __packed;
2841da177e4SLinus Torvalds 
285a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
286a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
287a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
288a9de9248SMarcel Holtmann 	__u8     role;
28966c853ccSGustavo F. Padovan } __packed;
2901da177e4SLinus Torvalds 
291a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
292a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
293a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
294a9de9248SMarcel Holtmann 	__u8     reason;
29566c853ccSGustavo F. Padovan } __packed;
2961da177e4SLinus Torvalds 
297a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
298a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
299a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
300a9de9248SMarcel Holtmann 	__u8     link_key[16];
30166c853ccSGustavo F. Padovan } __packed;
3021da177e4SLinus Torvalds 
303a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
304a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
305a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
30666c853ccSGustavo F. Padovan } __packed;
3071da177e4SLinus Torvalds 
308a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
309a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
310a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
311a9de9248SMarcel Holtmann 	__u8     pin_len;
312a9de9248SMarcel Holtmann 	__u8     pin_code[16];
31366c853ccSGustavo F. Padovan } __packed;
314980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
315980e1a53SJohan Hedberg 	__u8     status;
316980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
317980e1a53SJohan Hedberg } __packed;
318a9de9248SMarcel Holtmann 
319a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
320a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
321a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
32266c853ccSGustavo F. Padovan } __packed;
323980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
324980e1a53SJohan Hedberg 	__u8     status;
325980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
326980e1a53SJohan Hedberg } __packed;
327a9de9248SMarcel Holtmann 
328a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
329a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
330a9de9248SMarcel Holtmann 	__le16   handle;
331a9de9248SMarcel Holtmann 	__le16   pkt_type;
33266c853ccSGustavo F. Padovan } __packed;
333a9de9248SMarcel Holtmann 
334a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
335a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
336a9de9248SMarcel Holtmann 	__le16   handle;
33766c853ccSGustavo F. Padovan } __packed;
338a9de9248SMarcel Holtmann 
339a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
340a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
341a9de9248SMarcel Holtmann 	__le16   handle;
342a9de9248SMarcel Holtmann 	__u8     encrypt;
34366c853ccSGustavo F. Padovan } __packed;
344a9de9248SMarcel Holtmann 
345a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
346a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
347a9de9248SMarcel Holtmann 	__le16   handle;
34866c853ccSGustavo F. Padovan } __packed;
349a9de9248SMarcel Holtmann 
350a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
351a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
352a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
353a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
354a9de9248SMarcel Holtmann 	__u8     pscan_mode;
355a9de9248SMarcel Holtmann 	__le16   clock_offset;
35666c853ccSGustavo F. Padovan } __packed;
357a9de9248SMarcel Holtmann 
358a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
359a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
360a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
36166c853ccSGustavo F. Padovan } __packed;
362a9de9248SMarcel Holtmann 
363a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
364a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
365a9de9248SMarcel Holtmann 	__le16   handle;
36666c853ccSGustavo F. Padovan } __packed;
367a9de9248SMarcel Holtmann 
368a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
369a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
370a9de9248SMarcel Holtmann 	__le16   handle;
371a9de9248SMarcel Holtmann 	__u8     page;
37266c853ccSGustavo F. Padovan } __packed;
373a9de9248SMarcel Holtmann 
374a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
375a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
376a9de9248SMarcel Holtmann 	__le16   handle;
37766c853ccSGustavo F. Padovan } __packed;
378a9de9248SMarcel Holtmann 
379a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
380a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
381a9de9248SMarcel Holtmann 	__le16   handle;
382a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
383a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
384a9de9248SMarcel Holtmann 	__le16   max_latency;
385a9de9248SMarcel Holtmann 	__le16   voice_setting;
386a9de9248SMarcel Holtmann 	__u8     retrans_effort;
387a9de9248SMarcel Holtmann 	__le16   pkt_type;
38866c853ccSGustavo F. Padovan } __packed;
389a9de9248SMarcel Holtmann 
390a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
391a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
392a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
393a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
394a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
395a9de9248SMarcel Holtmann 	__le16   max_latency;
396a9de9248SMarcel Holtmann 	__le16   content_format;
397a9de9248SMarcel Holtmann 	__u8     retrans_effort;
398a9de9248SMarcel Holtmann 	__le16   pkt_type;
39966c853ccSGustavo F. Padovan } __packed;
400a9de9248SMarcel Holtmann 
401a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
402a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
403a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
404a9de9248SMarcel Holtmann 	__u8     reason;
40566c853ccSGustavo F. Padovan } __packed;
406a9de9248SMarcel Holtmann 
40717fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
40817fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
40917fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
41017fa4b9dSJohan Hedberg 	__u8     capability;
41117fa4b9dSJohan Hedberg 	__u8     oob_data;
41217fa4b9dSJohan Hedberg 	__u8     authentication;
41317fa4b9dSJohan Hedberg } __packed;
41417fa4b9dSJohan Hedberg 
41503b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
41603b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
41703b555e1SJohan Hedberg 	bdaddr_t bdaddr;
41803b555e1SJohan Hedberg 	__u8     reason;
41903b555e1SJohan Hedberg } __packed;
42003b555e1SJohan Hedberg 
421a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
422a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
423a9de9248SMarcel Holtmann 	__le16   handle;
424a9de9248SMarcel Holtmann 	__le16   max_interval;
425a9de9248SMarcel Holtmann 	__le16   min_interval;
426a9de9248SMarcel Holtmann 	__le16   attempt;
427a9de9248SMarcel Holtmann 	__le16   timeout;
42866c853ccSGustavo F. Padovan } __packed;
429a9de9248SMarcel Holtmann 
430a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
431a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
432a9de9248SMarcel Holtmann 	__le16   handle;
43366c853ccSGustavo F. Padovan } __packed;
434a9de9248SMarcel Holtmann 
435a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
436a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
437a9de9248SMarcel Holtmann 	__le16   handle;
43866c853ccSGustavo F. Padovan } __packed;
439a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
440a9de9248SMarcel Holtmann 	__u8     status;
441a9de9248SMarcel Holtmann 	__le16   handle;
442a9de9248SMarcel Holtmann 	__u8     role;
44366c853ccSGustavo F. Padovan } __packed;
444a9de9248SMarcel Holtmann 
445a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
446a9de9248SMarcel Holtmann struct hci_cp_switch_role {
447a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
448a9de9248SMarcel Holtmann 	__u8     role;
44966c853ccSGustavo F. Padovan } __packed;
450a9de9248SMarcel Holtmann 
451a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
452a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
453a9de9248SMarcel Holtmann 	__le16   handle;
45466c853ccSGustavo F. Padovan } __packed;
455a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
456a9de9248SMarcel Holtmann 	__u8     status;
457a9de9248SMarcel Holtmann 	__le16   handle;
458a9de9248SMarcel Holtmann 	__le16   policy;
45966c853ccSGustavo F. Padovan } __packed;
460a9de9248SMarcel Holtmann 
461a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
462a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
463a9de9248SMarcel Holtmann 	__le16   handle;
464a9de9248SMarcel Holtmann 	__le16   policy;
46566c853ccSGustavo F. Padovan } __packed;
466a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
467a9de9248SMarcel Holtmann 	__u8     status;
468a9de9248SMarcel Holtmann 	__le16   handle;
46966c853ccSGustavo F. Padovan } __packed;
470a9de9248SMarcel Holtmann 
471e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
472e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
473e4e8e37cSMarcel Holtmann 	__u8     status;
474e4e8e37cSMarcel Holtmann 	__le16   policy;
47566c853ccSGustavo F. Padovan } __packed;
476e4e8e37cSMarcel Holtmann 
477e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
478e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
479e4e8e37cSMarcel Holtmann 	__le16   policy;
48066c853ccSGustavo F. Padovan } __packed;
481e4e8e37cSMarcel Holtmann 
482a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
483a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
484a9de9248SMarcel Holtmann 	__le16   handle;
485a9de9248SMarcel Holtmann 	__le16   max_latency;
486a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
487a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
48866c853ccSGustavo F. Padovan } __packed;
489a9de9248SMarcel Holtmann 
490a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
491a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
492a9de9248SMarcel Holtmann 	__u8     mask[8];
49366c853ccSGustavo F. Padovan } __packed;
494a9de9248SMarcel Holtmann 
495a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
496a9de9248SMarcel Holtmann 
497a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
4981da177e4SLinus Torvalds struct hci_cp_set_event_flt {
4991da177e4SLinus Torvalds 	__u8     flt_type;
5001da177e4SLinus Torvalds 	__u8     cond_type;
5011da177e4SLinus Torvalds 	__u8     condition[0];
50266c853ccSGustavo F. Padovan } __packed;
5031da177e4SLinus Torvalds 
5041da177e4SLinus Torvalds /* Filter types */
5051da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
5061da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
5071da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
5081da177e4SLinus Torvalds 
5091da177e4SLinus Torvalds /* CONN_SETUP Condition types */
5101da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
5111da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
5121da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
5131da177e4SLinus Torvalds 
5141da177e4SLinus Torvalds /* CONN_SETUP Conditions */
5151da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
5161da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
5171da177e4SLinus Torvalds 
518b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
519b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
520b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
521b0916ea0SJohan Hedberg 	__u8     delete_all;
522b0916ea0SJohan Hedberg } __packed;
523b0916ea0SJohan Hedberg 
524a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
525a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
526a9de9248SMarcel Holtmann 	__u8     name[248];
52766c853ccSGustavo F. Padovan } __packed;
528a9de9248SMarcel Holtmann 
529a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
530a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
531a9de9248SMarcel Holtmann 	__u8     status;
532a9de9248SMarcel Holtmann 	__u8     name[248];
53366c853ccSGustavo F. Padovan } __packed;
534a9de9248SMarcel Holtmann 
535a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
536a9de9248SMarcel Holtmann 
537a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
538a9de9248SMarcel Holtmann 
539a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
540a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
541a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
542a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
543a9de9248SMarcel Holtmann 
544a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
545a9de9248SMarcel Holtmann 
546a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
547a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
548a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
549a9de9248SMarcel Holtmann 
550a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
551a9de9248SMarcel Holtmann 
552a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
553a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
554a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
555a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
556a9de9248SMarcel Holtmann 
557a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
558a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
5591da177e4SLinus Torvalds 	__u8     status;
5601da177e4SLinus Torvalds 	__u8     dev_class[3];
56166c853ccSGustavo F. Padovan } __packed;
5621da177e4SLinus Torvalds 
563a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
564a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
5651da177e4SLinus Torvalds 	__u8     dev_class[3];
56666c853ccSGustavo F. Padovan } __packed;
5671da177e4SLinus Torvalds 
568a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
5691da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
5701da177e4SLinus Torvalds 	__u8     status;
5711ebb9252SMarcel Holtmann 	__le16   voice_setting;
57266c853ccSGustavo F. Padovan } __packed;
5731da177e4SLinus Torvalds 
574a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
5751da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
5761ebb9252SMarcel Holtmann 	__le16   voice_setting;
57766c853ccSGustavo F. Padovan } __packed;
5781da177e4SLinus Torvalds 
579a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
5801da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
5811ebb9252SMarcel Holtmann 	__le16   acl_mtu;
5821da177e4SLinus Torvalds 	__u8     sco_mtu;
5831ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
5841ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
58566c853ccSGustavo F. Padovan } __packed;
5861da177e4SLinus Torvalds 
587d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
588d5859e22SJohan Hedberg 
589333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
590333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
591333140b5SMarcel Holtmann 	__u8     status;
592333140b5SMarcel Holtmann 	__u8     mode;
59366c853ccSGustavo F. Padovan } __packed;
594333140b5SMarcel Holtmann 
595333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
596333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
597333140b5SMarcel Holtmann 	__u8     mode;
59866c853ccSGustavo F. Padovan } __packed;
599333140b5SMarcel Holtmann 
600d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
601d5859e22SJohan Hedberg 
602a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
603a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
6041da177e4SLinus Torvalds 	__u8     status;
605a9de9248SMarcel Holtmann 	__u8     hci_ver;
606a9de9248SMarcel Holtmann 	__le16   hci_rev;
607a9de9248SMarcel Holtmann 	__u8     lmp_ver;
608a9de9248SMarcel Holtmann 	__le16   manufacturer;
609a9de9248SMarcel Holtmann 	__le16   lmp_subver;
61066c853ccSGustavo F. Padovan } __packed;
6111da177e4SLinus Torvalds 
612a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
613a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
6141da177e4SLinus Torvalds 	__u8     status;
615a9de9248SMarcel Holtmann 	__u8     commands[64];
61666c853ccSGustavo F. Padovan } __packed;
6171da177e4SLinus Torvalds 
618a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
619a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
620a9de9248SMarcel Holtmann 	__u8     status;
621a9de9248SMarcel Holtmann 	__u8     features[8];
62266c853ccSGustavo F. Padovan } __packed;
623a9de9248SMarcel Holtmann 
624a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
625a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
626a9de9248SMarcel Holtmann 	__u8     status;
627a9de9248SMarcel Holtmann 	__u8     page;
628a9de9248SMarcel Holtmann 	__u8     max_page;
629a9de9248SMarcel Holtmann 	__u8     features[8];
63066c853ccSGustavo F. Padovan } __packed;
631a9de9248SMarcel Holtmann 
632a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
633a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
634a9de9248SMarcel Holtmann 	__u8     status;
635a9de9248SMarcel Holtmann 	__le16   acl_mtu;
636a9de9248SMarcel Holtmann 	__u8     sco_mtu;
637a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
638a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
63966c853ccSGustavo F. Padovan } __packed;
640a9de9248SMarcel Holtmann 
641a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
642a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
643a9de9248SMarcel Holtmann 	__u8     status;
6441da177e4SLinus Torvalds 	bdaddr_t bdaddr;
64566c853ccSGustavo F. Padovan } __packed;
6461da177e4SLinus Torvalds 
64763185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
64863185f64SVille Tervo struct hci_cp_le_set_event_mask {
64963185f64SVille Tervo 	__u8     mask[8];
65063185f64SVille Tervo } __packed;
65163185f64SVille Tervo 
65263185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
65363185f64SVille Tervo struct hci_rp_le_read_buffer_size {
65463185f64SVille Tervo 	__u8     status;
65563185f64SVille Tervo 	__le16   le_mtu;
65663185f64SVille Tervo 	__u8     le_max_pkt;
65763185f64SVille Tervo } __packed;
65863185f64SVille Tervo 
65963185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
66063185f64SVille Tervo struct hci_cp_le_create_conn {
66163185f64SVille Tervo 	__le16   scan_interval;
66263185f64SVille Tervo 	__le16   scan_window;
66363185f64SVille Tervo 	__u8     filter_policy;
66463185f64SVille Tervo 	__u8     peer_addr_type;
66563185f64SVille Tervo 	bdaddr_t peer_addr;
66663185f64SVille Tervo 	__u8     own_address_type;
66763185f64SVille Tervo 	__le16   conn_interval_min;
66863185f64SVille Tervo 	__le16   conn_interval_max;
66963185f64SVille Tervo 	__le16   conn_latency;
67063185f64SVille Tervo 	__le16   supervision_timeout;
67163185f64SVille Tervo 	__le16   min_ce_len;
67263185f64SVille Tervo 	__le16   max_ce_len;
67363185f64SVille Tervo } __packed;
67463185f64SVille Tervo 
67563185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
67663185f64SVille Tervo 
6771da177e4SLinus Torvalds /* ---- HCI Events ---- */
6781da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
6791da177e4SLinus Torvalds 
6801da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
6811da177e4SLinus Torvalds struct inquiry_info {
6821da177e4SLinus Torvalds 	bdaddr_t bdaddr;
6831da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
6841da177e4SLinus Torvalds 	__u8     pscan_period_mode;
6851da177e4SLinus Torvalds 	__u8     pscan_mode;
6861da177e4SLinus Torvalds 	__u8     dev_class[3];
6871ebb9252SMarcel Holtmann 	__le16   clock_offset;
68866c853ccSGustavo F. Padovan } __packed;
6891da177e4SLinus Torvalds 
6901da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
6911da177e4SLinus Torvalds struct hci_ev_conn_complete {
6921da177e4SLinus Torvalds 	__u8     status;
6931ebb9252SMarcel Holtmann 	__le16   handle;
6941da177e4SLinus Torvalds 	bdaddr_t bdaddr;
6951da177e4SLinus Torvalds 	__u8     link_type;
6961da177e4SLinus Torvalds 	__u8     encr_mode;
69766c853ccSGustavo F. Padovan } __packed;
6981da177e4SLinus Torvalds 
6991da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
7001da177e4SLinus Torvalds struct hci_ev_conn_request {
7011da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7021da177e4SLinus Torvalds 	__u8     dev_class[3];
7031da177e4SLinus Torvalds 	__u8     link_type;
70466c853ccSGustavo F. Padovan } __packed;
7051da177e4SLinus Torvalds 
7061da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
7071da177e4SLinus Torvalds struct hci_ev_disconn_complete {
7081da177e4SLinus Torvalds 	__u8     status;
7091ebb9252SMarcel Holtmann 	__le16   handle;
7101da177e4SLinus Torvalds 	__u8     reason;
71166c853ccSGustavo F. Padovan } __packed;
7121da177e4SLinus Torvalds 
7131da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
7141da177e4SLinus Torvalds struct hci_ev_auth_complete {
7151da177e4SLinus Torvalds 	__u8     status;
7161ebb9252SMarcel Holtmann 	__le16   handle;
71766c853ccSGustavo F. Padovan } __packed;
7181da177e4SLinus Torvalds 
719a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
720a9de9248SMarcel Holtmann struct hci_ev_remote_name {
721a9de9248SMarcel Holtmann 	__u8     status;
722a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
723a9de9248SMarcel Holtmann 	__u8     name[248];
72466c853ccSGustavo F. Padovan } __packed;
725a9de9248SMarcel Holtmann 
7261da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
7271da177e4SLinus Torvalds struct hci_ev_encrypt_change {
7281da177e4SLinus Torvalds 	__u8     status;
7291ebb9252SMarcel Holtmann 	__le16   handle;
7301da177e4SLinus Torvalds 	__u8     encrypt;
73166c853ccSGustavo F. Padovan } __packed;
7321da177e4SLinus Torvalds 
733a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
734a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
7351da177e4SLinus Torvalds 	__u8     status;
7361ebb9252SMarcel Holtmann 	__le16   handle;
73766c853ccSGustavo F. Padovan } __packed;
7381da177e4SLinus Torvalds 
739a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
740a9de9248SMarcel Holtmann struct hci_ev_remote_features {
741a9de9248SMarcel Holtmann 	__u8     status;
742a9de9248SMarcel Holtmann 	__le16   handle;
743a9de9248SMarcel Holtmann 	__u8     features[8];
74466c853ccSGustavo F. Padovan } __packed;
745a9de9248SMarcel Holtmann 
746a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
747a9de9248SMarcel Holtmann struct hci_ev_remote_version {
748a9de9248SMarcel Holtmann 	__u8     status;
749a9de9248SMarcel Holtmann 	__le16   handle;
750a9de9248SMarcel Holtmann 	__u8     lmp_ver;
751a9de9248SMarcel Holtmann 	__le16   manufacturer;
752a9de9248SMarcel Holtmann 	__le16   lmp_subver;
75366c853ccSGustavo F. Padovan } __packed;
754a9de9248SMarcel Holtmann 
755a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
7561da177e4SLinus Torvalds struct hci_qos {
7571da177e4SLinus Torvalds 	__u8     service_type;
7581da177e4SLinus Torvalds 	__u32    token_rate;
7591da177e4SLinus Torvalds 	__u32    peak_bandwidth;
7601da177e4SLinus Torvalds 	__u32    latency;
7611da177e4SLinus Torvalds 	__u32    delay_variation;
76266c853ccSGustavo F. Padovan } __packed;
7631da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
7641da177e4SLinus Torvalds 	__u8     status;
7651ebb9252SMarcel Holtmann 	__le16   handle;
7661da177e4SLinus Torvalds 	struct   hci_qos qos;
76766c853ccSGustavo F. Padovan } __packed;
7681da177e4SLinus Torvalds 
769a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
7701da177e4SLinus Torvalds struct hci_ev_cmd_complete {
7711da177e4SLinus Torvalds 	__u8     ncmd;
7721ebb9252SMarcel Holtmann 	__le16   opcode;
77366c853ccSGustavo F. Padovan } __packed;
7741da177e4SLinus Torvalds 
775a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
7761da177e4SLinus Torvalds struct hci_ev_cmd_status {
7771da177e4SLinus Torvalds 	__u8     status;
7781da177e4SLinus Torvalds 	__u8     ncmd;
7791ebb9252SMarcel Holtmann 	__le16   opcode;
78066c853ccSGustavo F. Padovan } __packed;
7811da177e4SLinus Torvalds 
7821da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
7831da177e4SLinus Torvalds struct hci_ev_role_change {
7841da177e4SLinus Torvalds 	__u8     status;
7851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7861da177e4SLinus Torvalds 	__u8     role;
78766c853ccSGustavo F. Padovan } __packed;
7881da177e4SLinus Torvalds 
789a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
790a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
791a9de9248SMarcel Holtmann 	__u8     num_hndl;
792a9de9248SMarcel Holtmann 	/* variable length part */
79366c853ccSGustavo F. Padovan } __packed;
794a9de9248SMarcel Holtmann 
7951da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
7961da177e4SLinus Torvalds struct hci_ev_mode_change {
7971da177e4SLinus Torvalds 	__u8     status;
7981ebb9252SMarcel Holtmann 	__le16   handle;
7991da177e4SLinus Torvalds 	__u8     mode;
8001ebb9252SMarcel Holtmann 	__le16   interval;
80166c853ccSGustavo F. Padovan } __packed;
8021da177e4SLinus Torvalds 
8031da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
8041da177e4SLinus Torvalds struct hci_ev_pin_code_req {
8051da177e4SLinus Torvalds 	bdaddr_t bdaddr;
80666c853ccSGustavo F. Padovan } __packed;
8071da177e4SLinus Torvalds 
8081da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
8091da177e4SLinus Torvalds struct hci_ev_link_key_req {
8101da177e4SLinus Torvalds 	bdaddr_t bdaddr;
81166c853ccSGustavo F. Padovan } __packed;
8121da177e4SLinus Torvalds 
8131da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
8141da177e4SLinus Torvalds struct hci_ev_link_key_notify {
8151da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8161da177e4SLinus Torvalds 	__u8     link_key[16];
8171da177e4SLinus Torvalds 	__u8     key_type;
81866c853ccSGustavo F. Padovan } __packed;
8191da177e4SLinus Torvalds 
820a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
8211da177e4SLinus Torvalds struct hci_ev_clock_offset {
8221da177e4SLinus Torvalds 	__u8     status;
8231ebb9252SMarcel Holtmann 	__le16   handle;
8241ebb9252SMarcel Holtmann 	__le16   clock_offset;
82566c853ccSGustavo F. Padovan } __packed;
8261da177e4SLinus Torvalds 
827a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
828a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
829a8746417SMarcel Holtmann 	__u8     status;
830a8746417SMarcel Holtmann 	__le16   handle;
831a8746417SMarcel Holtmann 	__le16   pkt_type;
83266c853ccSGustavo F. Padovan } __packed;
833a8746417SMarcel Holtmann 
83485a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
83585a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
83685a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
83785a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
83866c853ccSGustavo F. Padovan } __packed;
83985a1e930SMarcel Holtmann 
840a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
841a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
842a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
843a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
844a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
845a9de9248SMarcel Holtmann 	__u8     dev_class[3];
846a9de9248SMarcel Holtmann 	__le16   clock_offset;
847a9de9248SMarcel Holtmann 	__s8     rssi;
84866c853ccSGustavo F. Padovan } __packed;
849a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
850a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
851a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
852a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
853a9de9248SMarcel Holtmann 	__u8     pscan_mode;
854a9de9248SMarcel Holtmann 	__u8     dev_class[3];
855a9de9248SMarcel Holtmann 	__le16   clock_offset;
856a9de9248SMarcel Holtmann 	__s8     rssi;
85766c853ccSGustavo F. Padovan } __packed;
858a9de9248SMarcel Holtmann 
859a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
860a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
861a9de9248SMarcel Holtmann 	__u8     status;
862a9de9248SMarcel Holtmann 	__le16   handle;
863a9de9248SMarcel Holtmann 	__u8     page;
864a9de9248SMarcel Holtmann 	__u8     max_page;
865a9de9248SMarcel Holtmann 	__u8     features[8];
86666c853ccSGustavo F. Padovan } __packed;
867a9de9248SMarcel Holtmann 
868a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
869a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
870a9de9248SMarcel Holtmann 	__u8     status;
871a9de9248SMarcel Holtmann 	__le16   handle;
872a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
873a9de9248SMarcel Holtmann 	__u8     link_type;
874a9de9248SMarcel Holtmann 	__u8     tx_interval;
875a9de9248SMarcel Holtmann 	__u8     retrans_window;
876a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
877a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
878a9de9248SMarcel Holtmann 	__u8     air_mode;
87966c853ccSGustavo F. Padovan } __packed;
880a9de9248SMarcel Holtmann 
881a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
882a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
883a9de9248SMarcel Holtmann 	__u8     status;
884a9de9248SMarcel Holtmann 	__le16   handle;
885a9de9248SMarcel Holtmann 	__u8     tx_interval;
886a9de9248SMarcel Holtmann 	__u8     retrans_window;
887a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
888a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
88966c853ccSGustavo F. Padovan } __packed;
890a9de9248SMarcel Holtmann 
891a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
89204837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
89304837f64SMarcel Holtmann 	__u8     status;
89404837f64SMarcel Holtmann 	__le16   handle;
89504837f64SMarcel Holtmann 	__le16   max_tx_latency;
89604837f64SMarcel Holtmann 	__le16   max_rx_latency;
89704837f64SMarcel Holtmann 	__le16   max_remote_timeout;
89804837f64SMarcel Holtmann 	__le16   max_local_timeout;
89966c853ccSGustavo F. Padovan } __packed;
90004837f64SMarcel Holtmann 
901a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
902a9de9248SMarcel Holtmann struct extended_inquiry_info {
903a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
904a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
905a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
906a9de9248SMarcel Holtmann 	__u8     dev_class[3];
907a9de9248SMarcel Holtmann 	__le16   clock_offset;
908a9de9248SMarcel Holtmann 	__s8     rssi;
909a9de9248SMarcel Holtmann 	__u8     data[240];
91066c853ccSGustavo F. Padovan } __packed;
911a9de9248SMarcel Holtmann 
9120493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
9130493684eSMarcel Holtmann struct hci_ev_io_capa_request {
9140493684eSMarcel Holtmann 	bdaddr_t bdaddr;
91566c853ccSGustavo F. Padovan } __packed;
9160493684eSMarcel Holtmann 
91703b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
91803b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
91903b555e1SJohan Hedberg 	bdaddr_t bdaddr;
92003b555e1SJohan Hedberg 	__u8     capability;
92103b555e1SJohan Hedberg 	__u8     oob_data;
92203b555e1SJohan Hedberg 	__u8     authentication;
92303b555e1SJohan Hedberg } __packed;
92403b555e1SJohan Hedberg 
9250493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
9260493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
9270493684eSMarcel Holtmann 	__u8     status;
9280493684eSMarcel Holtmann 	bdaddr_t bdaddr;
92966c853ccSGustavo F. Padovan } __packed;
9300493684eSMarcel Holtmann 
93141a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
93241a96212SMarcel Holtmann struct hci_ev_remote_host_features {
93341a96212SMarcel Holtmann 	bdaddr_t bdaddr;
93441a96212SMarcel Holtmann 	__u8     features[8];
93566c853ccSGustavo F. Padovan } __packed;
93641a96212SMarcel Holtmann 
93763185f64SVille Tervo #define HCI_EV_LE_META			0x3e
93863185f64SVille Tervo struct hci_ev_le_meta {
93963185f64SVille Tervo 	__u8     subevent;
94063185f64SVille Tervo } __packed;
94163185f64SVille Tervo 
94263185f64SVille Tervo /* Low energy meta events */
94363185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
94463185f64SVille Tervo struct hci_ev_le_conn_complete {
94563185f64SVille Tervo 	__u8     status;
94663185f64SVille Tervo 	__le16   handle;
94763185f64SVille Tervo 	__u8     role;
94863185f64SVille Tervo 	__u8     bdaddr_type;
94963185f64SVille Tervo 	bdaddr_t bdaddr;
95063185f64SVille Tervo 	__le16   interval;
95163185f64SVille Tervo 	__le16   latency;
95263185f64SVille Tervo 	__le16   supervision_timeout;
95363185f64SVille Tervo 	__u8     clk_accurancy;
95463185f64SVille Tervo } __packed;
95563185f64SVille Tervo 
9561da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
957a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
9581da177e4SLinus Torvalds struct hci_ev_stack_internal {
9591da177e4SLinus Torvalds 	__u16    type;
9601da177e4SLinus Torvalds 	__u8     data[0];
96166c853ccSGustavo F. Padovan } __packed;
9621da177e4SLinus Torvalds 
9631da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
9641da177e4SLinus Torvalds struct hci_ev_si_device {
9651da177e4SLinus Torvalds 	__u16    event;
9661da177e4SLinus Torvalds 	__u16    dev_id;
96766c853ccSGustavo F. Padovan } __packed;
9681da177e4SLinus Torvalds 
9691da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
9701da177e4SLinus Torvalds struct hci_ev_si_security {
9711da177e4SLinus Torvalds 	__u16    event;
9721da177e4SLinus Torvalds 	__u16    proto;
9731da177e4SLinus Torvalds 	__u16    subproto;
9741da177e4SLinus Torvalds 	__u8     incoming;
97566c853ccSGustavo F. Padovan } __packed;
9761da177e4SLinus Torvalds 
9771da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
9781da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
9791da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
9801da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
9811da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
9821da177e4SLinus Torvalds 
9831da177e4SLinus Torvalds struct hci_command_hdr {
9841ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
9851da177e4SLinus Torvalds 	__u8	plen;
98666c853ccSGustavo F. Padovan } __packed;
9871da177e4SLinus Torvalds 
9881da177e4SLinus Torvalds struct hci_event_hdr {
9891da177e4SLinus Torvalds 	__u8	evt;
9901da177e4SLinus Torvalds 	__u8	plen;
99166c853ccSGustavo F. Padovan } __packed;
9921da177e4SLinus Torvalds 
9931da177e4SLinus Torvalds struct hci_acl_hdr {
9941ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
9951ebb9252SMarcel Holtmann 	__le16	dlen;
99666c853ccSGustavo F. Padovan } __packed;
9971da177e4SLinus Torvalds 
9981da177e4SLinus Torvalds struct hci_sco_hdr {
9991ebb9252SMarcel Holtmann 	__le16	handle;
10001da177e4SLinus Torvalds 	__u8	dlen;
100166c853ccSGustavo F. Padovan } __packed;
10021da177e4SLinus Torvalds 
10032a123b86SArnaldo Carvalho de Melo #ifdef __KERNEL__
10042a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h>
10052a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
10062a123b86SArnaldo Carvalho de Melo {
10072a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
10082a123b86SArnaldo Carvalho de Melo }
10092a123b86SArnaldo Carvalho de Melo 
10102a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
10112a123b86SArnaldo Carvalho de Melo {
10122a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
10132a123b86SArnaldo Carvalho de Melo }
10142a123b86SArnaldo Carvalho de Melo 
10152a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
10162a123b86SArnaldo Carvalho de Melo {
10172a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
10182a123b86SArnaldo Carvalho de Melo }
10192a123b86SArnaldo Carvalho de Melo #endif
10202a123b86SArnaldo Carvalho de Melo 
10211da177e4SLinus Torvalds /* Command opcode pack/unpack */
10221da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf)	(__u16) ((ocf & 0x03ff)|(ogf << 10))
10231da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
10241da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
10251da177e4SLinus Torvalds 
10261da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
10271da177e4SLinus Torvalds #define hci_handle_pack(h, f)	(__u16) ((h & 0x0fff)|(f << 12))
10281da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
10291da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
10301da177e4SLinus Torvalds 
10311da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
10321da177e4SLinus Torvalds 
10331da177e4SLinus Torvalds /* Socket options */
10341da177e4SLinus Torvalds #define HCI_DATA_DIR	1
10351da177e4SLinus Torvalds #define HCI_FILTER	2
10361da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
10371da177e4SLinus Torvalds 
10381da177e4SLinus Torvalds /* CMSG flags */
10391da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
10401da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
10411da177e4SLinus Torvalds 
10421da177e4SLinus Torvalds struct sockaddr_hci {
10431da177e4SLinus Torvalds 	sa_family_t    hci_family;
10441da177e4SLinus Torvalds 	unsigned short hci_dev;
1045c02178d2SJohan Hedberg 	unsigned short hci_channel;
10461da177e4SLinus Torvalds };
10471da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
10481da177e4SLinus Torvalds 
1049c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1050c02178d2SJohan Hedberg #define HCI_CHANNEL_CONTROL	1
1051c02178d2SJohan Hedberg 
10521da177e4SLinus Torvalds struct hci_filter {
10531da177e4SLinus Torvalds 	unsigned long type_mask;
10541da177e4SLinus Torvalds 	unsigned long event_mask[2];
1055905f3ed6SAl Viro 	__le16 opcode;
10561da177e4SLinus Torvalds };
10571da177e4SLinus Torvalds 
10581da177e4SLinus Torvalds struct hci_ufilter {
10591da177e4SLinus Torvalds 	__u32  type_mask;
10601da177e4SLinus Torvalds 	__u32  event_mask[2];
1061905f3ed6SAl Viro 	__le16 opcode;
10621da177e4SLinus Torvalds };
10631da177e4SLinus Torvalds 
10641da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
10651da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
10661da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
10671da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
10681da177e4SLinus Torvalds 
10691da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
10701da177e4SLinus Torvalds struct hci_dev_stats {
10711da177e4SLinus Torvalds 	__u32 err_rx;
10721da177e4SLinus Torvalds 	__u32 err_tx;
10731da177e4SLinus Torvalds 	__u32 cmd_tx;
10741da177e4SLinus Torvalds 	__u32 evt_rx;
10751da177e4SLinus Torvalds 	__u32 acl_tx;
10761da177e4SLinus Torvalds 	__u32 acl_rx;
10771da177e4SLinus Torvalds 	__u32 sco_tx;
10781da177e4SLinus Torvalds 	__u32 sco_rx;
10791da177e4SLinus Torvalds 	__u32 byte_rx;
10801da177e4SLinus Torvalds 	__u32 byte_tx;
10811da177e4SLinus Torvalds };
10821da177e4SLinus Torvalds 
10831da177e4SLinus Torvalds struct hci_dev_info {
10841da177e4SLinus Torvalds 	__u16 dev_id;
10851da177e4SLinus Torvalds 	char  name[8];
10861da177e4SLinus Torvalds 
10871da177e4SLinus Torvalds 	bdaddr_t bdaddr;
10881da177e4SLinus Torvalds 
10891da177e4SLinus Torvalds 	__u32 flags;
10901da177e4SLinus Torvalds 	__u8  type;
10911da177e4SLinus Torvalds 
10921da177e4SLinus Torvalds 	__u8  features[8];
10931da177e4SLinus Torvalds 
10941da177e4SLinus Torvalds 	__u32 pkt_type;
10951da177e4SLinus Torvalds 	__u32 link_policy;
10961da177e4SLinus Torvalds 	__u32 link_mode;
10971da177e4SLinus Torvalds 
10981da177e4SLinus Torvalds 	__u16 acl_mtu;
10991da177e4SLinus Torvalds 	__u16 acl_pkts;
11001da177e4SLinus Torvalds 	__u16 sco_mtu;
11011da177e4SLinus Torvalds 	__u16 sco_pkts;
11021da177e4SLinus Torvalds 
11031da177e4SLinus Torvalds 	struct hci_dev_stats stat;
11041da177e4SLinus Torvalds };
11051da177e4SLinus Torvalds 
11061da177e4SLinus Torvalds struct hci_conn_info {
11071da177e4SLinus Torvalds 	__u16    handle;
11081da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11091da177e4SLinus Torvalds 	__u8     type;
11101da177e4SLinus Torvalds 	__u8     out;
11111da177e4SLinus Torvalds 	__u16    state;
11121da177e4SLinus Torvalds 	__u32    link_mode;
11131da177e4SLinus Torvalds };
11141da177e4SLinus Torvalds 
11151da177e4SLinus Torvalds struct hci_dev_req {
11161da177e4SLinus Torvalds 	__u16  dev_id;
11171da177e4SLinus Torvalds 	__u32  dev_opt;
11181da177e4SLinus Torvalds };
11191da177e4SLinus Torvalds 
11201da177e4SLinus Torvalds struct hci_dev_list_req {
11211da177e4SLinus Torvalds 	__u16  dev_num;
11221da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
11231da177e4SLinus Torvalds };
11241da177e4SLinus Torvalds 
11251da177e4SLinus Torvalds struct hci_conn_list_req {
11261da177e4SLinus Torvalds 	__u16  dev_id;
11271da177e4SLinus Torvalds 	__u16  conn_num;
11281da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
11291da177e4SLinus Torvalds };
11301da177e4SLinus Torvalds 
11311da177e4SLinus Torvalds struct hci_conn_info_req {
11321da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11331da177e4SLinus Torvalds 	__u8     type;
11341da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
11351da177e4SLinus Torvalds };
11361da177e4SLinus Torvalds 
113740be492fSMarcel Holtmann struct hci_auth_info_req {
113840be492fSMarcel Holtmann 	bdaddr_t bdaddr;
113940be492fSMarcel Holtmann 	__u8     type;
114040be492fSMarcel Holtmann };
114140be492fSMarcel Holtmann 
11421da177e4SLinus Torvalds struct hci_inquiry_req {
11431da177e4SLinus Torvalds 	__u16 dev_id;
11441da177e4SLinus Torvalds 	__u16 flags;
11451da177e4SLinus Torvalds 	__u8  lap[3];
11461da177e4SLinus Torvalds 	__u8  length;
11471da177e4SLinus Torvalds 	__u8  num_rsp;
11481da177e4SLinus Torvalds };
11491da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
11501da177e4SLinus Torvalds 
11511da177e4SLinus Torvalds #endif /* __HCI_H */
1152