xref: /openbmc/linux/include/net/bluetooth/hci.h (revision 80a1e1dbf62a08984d4c1bfb5a4bca38c3e1664f)
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 */
1226bd32326SVille Tervo #define HCI_CMD_TIMEOUT		(1000)	/* 1 seconds */
1231da177e4SLinus Torvalds 
1245b7f9909SMarcel Holtmann /* HCI data types */
1251da177e4SLinus Torvalds #define HCI_COMMAND_PKT		0x01
1261da177e4SLinus Torvalds #define HCI_ACLDATA_PKT		0x02
1271da177e4SLinus Torvalds #define HCI_SCODATA_PKT		0x03
1281da177e4SLinus Torvalds #define HCI_EVENT_PKT		0x04
1291da177e4SLinus Torvalds #define HCI_VENDOR_PKT		0xff
1301da177e4SLinus Torvalds 
1315b7f9909SMarcel Holtmann /* HCI packet types */
1321da177e4SLinus Torvalds #define HCI_DM1		0x0008
1331da177e4SLinus Torvalds #define HCI_DM3		0x0400
1341da177e4SLinus Torvalds #define HCI_DM5		0x4000
1351da177e4SLinus Torvalds #define HCI_DH1		0x0010
1361da177e4SLinus Torvalds #define HCI_DH3		0x0800
1371da177e4SLinus Torvalds #define HCI_DH5		0x8000
1381da177e4SLinus Torvalds 
1391da177e4SLinus Torvalds #define HCI_HV1		0x0020
1401da177e4SLinus Torvalds #define HCI_HV2		0x0040
1411da177e4SLinus Torvalds #define HCI_HV3		0x0080
1421da177e4SLinus Torvalds 
1431da177e4SLinus Torvalds #define SCO_PTYPE_MASK	(HCI_HV1 | HCI_HV2 | HCI_HV3)
1441da177e4SLinus Torvalds #define ACL_PTYPE_MASK	(~SCO_PTYPE_MASK)
1451da177e4SLinus Torvalds 
1465b7f9909SMarcel Holtmann /* eSCO packet types */
1475b7f9909SMarcel Holtmann #define ESCO_HV1	0x0001
1485b7f9909SMarcel Holtmann #define ESCO_HV2	0x0002
1495b7f9909SMarcel Holtmann #define ESCO_HV3	0x0004
1505b7f9909SMarcel Holtmann #define ESCO_EV3	0x0008
1515b7f9909SMarcel Holtmann #define ESCO_EV4	0x0010
1525b7f9909SMarcel Holtmann #define ESCO_EV5	0x0020
153efc7688bSMarcel Holtmann #define ESCO_2EV3	0x0040
154efc7688bSMarcel Holtmann #define ESCO_3EV3	0x0080
155efc7688bSMarcel Holtmann #define ESCO_2EV5	0x0100
156efc7688bSMarcel Holtmann #define ESCO_3EV5	0x0200
1575b7f9909SMarcel Holtmann 
158a8746417SMarcel Holtmann #define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
159efc7688bSMarcel Holtmann #define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
160a8746417SMarcel Holtmann 
1611da177e4SLinus Torvalds /* ACL flags */
162e702112fSAndrei Emeltchenko #define ACL_START_NO_FLUSH	0x00
1631da177e4SLinus Torvalds #define ACL_CONT		0x01
1641da177e4SLinus Torvalds #define ACL_START		0x02
1651da177e4SLinus Torvalds #define ACL_ACTIVE_BCAST	0x04
1661da177e4SLinus Torvalds #define ACL_PICO_BCAST		0x08
1671da177e4SLinus Torvalds 
1681da177e4SLinus Torvalds /* Baseband links */
1691da177e4SLinus Torvalds #define SCO_LINK	0x00
1701da177e4SLinus Torvalds #define ACL_LINK	0x01
1715b7f9909SMarcel Holtmann #define ESCO_LINK	0x02
172fcd89c09SVille Tervo /* Low Energy links do not have defined link type. Use invented one */
173fcd89c09SVille Tervo #define LE_LINK		0x80
1741da177e4SLinus Torvalds 
1751da177e4SLinus Torvalds /* LMP features */
1761da177e4SLinus Torvalds #define LMP_3SLOT	0x01
1771da177e4SLinus Torvalds #define LMP_5SLOT	0x02
1781da177e4SLinus Torvalds #define LMP_ENCRYPT	0x04
1791da177e4SLinus Torvalds #define LMP_SOFFSET	0x08
1801da177e4SLinus Torvalds #define LMP_TACCURACY	0x10
1811da177e4SLinus Torvalds #define LMP_RSWITCH	0x20
1821da177e4SLinus Torvalds #define LMP_HOLD	0x40
18304837f64SMarcel Holtmann #define LMP_SNIFF	0x80
1841da177e4SLinus Torvalds 
1851da177e4SLinus Torvalds #define LMP_PARK	0x01
1861da177e4SLinus Torvalds #define LMP_RSSI	0x02
1871da177e4SLinus Torvalds #define LMP_QUALITY	0x04
1881da177e4SLinus Torvalds #define LMP_SCO		0x08
1891da177e4SLinus Torvalds #define LMP_HV2		0x10
1901da177e4SLinus Torvalds #define LMP_HV3		0x20
1911da177e4SLinus Torvalds #define LMP_ULAW	0x40
1921da177e4SLinus Torvalds #define LMP_ALAW	0x80
1931da177e4SLinus Torvalds 
1941da177e4SLinus Torvalds #define LMP_CVSD	0x01
1951da177e4SLinus Torvalds #define LMP_PSCHEME	0x02
1961da177e4SLinus Torvalds #define LMP_PCONTROL	0x04
1971da177e4SLinus Torvalds 
198d5859e22SJohan Hedberg #define LMP_RSSI_INQ	0x40
1995b7f9909SMarcel Holtmann #define LMP_ESCO	0x80
2005b7f9909SMarcel Holtmann 
2015b7f9909SMarcel Holtmann #define LMP_EV4		0x01
2025b7f9909SMarcel Holtmann #define LMP_EV5		0x02
203d5859e22SJohan Hedberg #define LMP_LE		0x40
2045b7f9909SMarcel Holtmann 
20504837f64SMarcel Holtmann #define LMP_SNIFF_SUBR	0x02
206d5859e22SJohan Hedberg #define LMP_PAUSE_ENC	0x04
207efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_2M	0x20
208efc7688bSMarcel Holtmann #define LMP_EDR_ESCO_3M	0x40
209efc7688bSMarcel Holtmann #define LMP_EDR_3S_ESCO	0x80
21004837f64SMarcel Holtmann 
211d5859e22SJohan Hedberg #define LMP_EXT_INQ	0x01
212769be974SMarcel Holtmann #define LMP_SIMPLE_PAIR	0x08
213e702112fSAndrei Emeltchenko #define LMP_NO_FLUSH	0x40
214769be974SMarcel Holtmann 
215d5859e22SJohan Hedberg #define LMP_LSTO	0x01
216d5859e22SJohan Hedberg #define LMP_INQ_TX_PWR	0x02
217d5859e22SJohan Hedberg 
21804837f64SMarcel Holtmann /* Connection modes */
21904837f64SMarcel Holtmann #define HCI_CM_ACTIVE	0x0000
22004837f64SMarcel Holtmann #define HCI_CM_HOLD	0x0001
22104837f64SMarcel Holtmann #define HCI_CM_SNIFF	0x0002
22204837f64SMarcel Holtmann #define HCI_CM_PARK	0x0003
22304837f64SMarcel Holtmann 
2241da177e4SLinus Torvalds /* Link policies */
2251da177e4SLinus Torvalds #define HCI_LP_RSWITCH	0x0001
2261da177e4SLinus Torvalds #define HCI_LP_HOLD	0x0002
2271da177e4SLinus Torvalds #define HCI_LP_SNIFF	0x0004
2281da177e4SLinus Torvalds #define HCI_LP_PARK	0x0008
2291da177e4SLinus Torvalds 
23004837f64SMarcel Holtmann /* Link modes */
2311da177e4SLinus Torvalds #define HCI_LM_ACCEPT	0x8000
2321da177e4SLinus Torvalds #define HCI_LM_MASTER	0x0001
2331da177e4SLinus Torvalds #define HCI_LM_AUTH	0x0002
2341da177e4SLinus Torvalds #define HCI_LM_ENCRYPT	0x0004
2351da177e4SLinus Torvalds #define HCI_LM_TRUSTED	0x0008
2361da177e4SLinus Torvalds #define HCI_LM_RELIABLE	0x0010
2371da177e4SLinus Torvalds #define HCI_LM_SECURE	0x0020
2381da177e4SLinus Torvalds 
23940be492fSMarcel Holtmann /* Authentication types */
24040be492fSMarcel Holtmann #define HCI_AT_NO_BONDING		0x00
24140be492fSMarcel Holtmann #define HCI_AT_NO_BONDING_MITM		0x01
24240be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING	0x02
24340be492fSMarcel Holtmann #define HCI_AT_DEDICATED_BONDING_MITM	0x03
24440be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING		0x04
24540be492fSMarcel Holtmann #define HCI_AT_GENERAL_BONDING_MITM	0x05
24640be492fSMarcel Holtmann 
2471da177e4SLinus Torvalds /* -----  HCI Commands ---- */
2486bd32326SVille Tervo #define HCI_OP_NOP			0x0000
2496bd32326SVille Tervo 
250a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY			0x0401
251a9de9248SMarcel Holtmann struct hci_cp_inquiry {
252a9de9248SMarcel Holtmann 	__u8     lap[3];
253a9de9248SMarcel Holtmann 	__u8     length;
254a9de9248SMarcel Holtmann 	__u8     num_rsp;
25566c853ccSGustavo F. Padovan } __packed;
2561da177e4SLinus Torvalds 
257a9de9248SMarcel Holtmann #define HCI_OP_INQUIRY_CANCEL		0x0402
258a9de9248SMarcel Holtmann 
259a9de9248SMarcel Holtmann #define HCI_OP_EXIT_PERIODIC_INQ	0x0404
260a9de9248SMarcel Holtmann 
261a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN		0x0405
262a9de9248SMarcel Holtmann struct hci_cp_create_conn {
263a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
264a9de9248SMarcel Holtmann 	__le16   pkt_type;
265a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
266a9de9248SMarcel Holtmann 	__u8     pscan_mode;
267a9de9248SMarcel Holtmann 	__le16   clock_offset;
268a9de9248SMarcel Holtmann 	__u8     role_switch;
26966c853ccSGustavo F. Padovan } __packed;
2701da177e4SLinus Torvalds 
271a9de9248SMarcel Holtmann #define HCI_OP_DISCONNECT		0x0406
272a9de9248SMarcel Holtmann struct hci_cp_disconnect {
273a9de9248SMarcel Holtmann 	__le16   handle;
274a9de9248SMarcel Holtmann 	__u8     reason;
27566c853ccSGustavo F. Padovan } __packed;
2761da177e4SLinus Torvalds 
277a9de9248SMarcel Holtmann #define HCI_OP_ADD_SCO			0x0407
278a9de9248SMarcel Holtmann struct hci_cp_add_sco {
279a9de9248SMarcel Holtmann 	__le16   handle;
280a9de9248SMarcel Holtmann 	__le16   pkt_type;
28166c853ccSGustavo F. Padovan } __packed;
282a9de9248SMarcel Holtmann 
283a9de9248SMarcel Holtmann #define HCI_OP_CREATE_CONN_CANCEL	0x0408
284a9de9248SMarcel Holtmann struct hci_cp_create_conn_cancel {
2851da177e4SLinus Torvalds 	bdaddr_t bdaddr;
28666c853ccSGustavo F. Padovan } __packed;
2871da177e4SLinus Torvalds 
288a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_CONN_REQ		0x0409
289a9de9248SMarcel Holtmann struct hci_cp_accept_conn_req {
290a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
291a9de9248SMarcel Holtmann 	__u8     role;
29266c853ccSGustavo F. Padovan } __packed;
2931da177e4SLinus Torvalds 
294a9de9248SMarcel Holtmann #define HCI_OP_REJECT_CONN_REQ		0x040a
295a9de9248SMarcel Holtmann struct hci_cp_reject_conn_req {
296a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
297a9de9248SMarcel Holtmann 	__u8     reason;
29866c853ccSGustavo F. Padovan } __packed;
2991da177e4SLinus Torvalds 
300a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_REPLY		0x040b
301a9de9248SMarcel Holtmann struct hci_cp_link_key_reply {
302a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
303a9de9248SMarcel Holtmann 	__u8     link_key[16];
30466c853ccSGustavo F. Padovan } __packed;
3051da177e4SLinus Torvalds 
306a9de9248SMarcel Holtmann #define HCI_OP_LINK_KEY_NEG_REPLY	0x040c
307a9de9248SMarcel Holtmann struct hci_cp_link_key_neg_reply {
308a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
30966c853ccSGustavo F. Padovan } __packed;
3101da177e4SLinus Torvalds 
311a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_REPLY		0x040d
312a9de9248SMarcel Holtmann struct hci_cp_pin_code_reply {
313a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
314a9de9248SMarcel Holtmann 	__u8     pin_len;
315a9de9248SMarcel Holtmann 	__u8     pin_code[16];
31666c853ccSGustavo F. Padovan } __packed;
317980e1a53SJohan Hedberg struct hci_rp_pin_code_reply {
318980e1a53SJohan Hedberg 	__u8     status;
319980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
320980e1a53SJohan Hedberg } __packed;
321a9de9248SMarcel Holtmann 
322a9de9248SMarcel Holtmann #define HCI_OP_PIN_CODE_NEG_REPLY	0x040e
323a9de9248SMarcel Holtmann struct hci_cp_pin_code_neg_reply {
324a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
32566c853ccSGustavo F. Padovan } __packed;
326980e1a53SJohan Hedberg struct hci_rp_pin_code_neg_reply {
327980e1a53SJohan Hedberg 	__u8     status;
328980e1a53SJohan Hedberg 	bdaddr_t bdaddr;
329980e1a53SJohan Hedberg } __packed;
330a9de9248SMarcel Holtmann 
331a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_PTYPE	0x040f
332a9de9248SMarcel Holtmann struct hci_cp_change_conn_ptype {
333a9de9248SMarcel Holtmann 	__le16   handle;
334a9de9248SMarcel Holtmann 	__le16   pkt_type;
33566c853ccSGustavo F. Padovan } __packed;
336a9de9248SMarcel Holtmann 
337a9de9248SMarcel Holtmann #define HCI_OP_AUTH_REQUESTED		0x0411
338a9de9248SMarcel Holtmann struct hci_cp_auth_requested {
339a9de9248SMarcel Holtmann 	__le16   handle;
34066c853ccSGustavo F. Padovan } __packed;
341a9de9248SMarcel Holtmann 
342a9de9248SMarcel Holtmann #define HCI_OP_SET_CONN_ENCRYPT		0x0413
343a9de9248SMarcel Holtmann struct hci_cp_set_conn_encrypt {
344a9de9248SMarcel Holtmann 	__le16   handle;
345a9de9248SMarcel Holtmann 	__u8     encrypt;
34666c853ccSGustavo F. Padovan } __packed;
347a9de9248SMarcel Holtmann 
348a9de9248SMarcel Holtmann #define HCI_OP_CHANGE_CONN_LINK_KEY	0x0415
349a9de9248SMarcel Holtmann struct hci_cp_change_conn_link_key {
350a9de9248SMarcel Holtmann 	__le16   handle;
35166c853ccSGustavo F. Padovan } __packed;
352a9de9248SMarcel Holtmann 
353a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ		0x0419
354a9de9248SMarcel Holtmann struct hci_cp_remote_name_req {
355a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
356a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
357a9de9248SMarcel Holtmann 	__u8     pscan_mode;
358a9de9248SMarcel Holtmann 	__le16   clock_offset;
35966c853ccSGustavo F. Padovan } __packed;
360a9de9248SMarcel Holtmann 
361a9de9248SMarcel Holtmann #define HCI_OP_REMOTE_NAME_REQ_CANCEL	0x041a
362a9de9248SMarcel Holtmann struct hci_cp_remote_name_req_cancel {
363a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
36466c853ccSGustavo F. Padovan } __packed;
365a9de9248SMarcel Holtmann 
366a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_FEATURES	0x041b
367a9de9248SMarcel Holtmann struct hci_cp_read_remote_features {
368a9de9248SMarcel Holtmann 	__le16   handle;
36966c853ccSGustavo F. Padovan } __packed;
370a9de9248SMarcel Holtmann 
371a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_EXT_FEATURES	0x041c
372a9de9248SMarcel Holtmann struct hci_cp_read_remote_ext_features {
373a9de9248SMarcel Holtmann 	__le16   handle;
374a9de9248SMarcel Holtmann 	__u8     page;
37566c853ccSGustavo F. Padovan } __packed;
376a9de9248SMarcel Holtmann 
377a9de9248SMarcel Holtmann #define HCI_OP_READ_REMOTE_VERSION	0x041d
378a9de9248SMarcel Holtmann struct hci_cp_read_remote_version {
379a9de9248SMarcel Holtmann 	__le16   handle;
38066c853ccSGustavo F. Padovan } __packed;
381a9de9248SMarcel Holtmann 
382a9de9248SMarcel Holtmann #define HCI_OP_SETUP_SYNC_CONN		0x0428
383a9de9248SMarcel Holtmann struct hci_cp_setup_sync_conn {
384a9de9248SMarcel Holtmann 	__le16   handle;
385a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
386a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
387a9de9248SMarcel Holtmann 	__le16   max_latency;
388a9de9248SMarcel Holtmann 	__le16   voice_setting;
389a9de9248SMarcel Holtmann 	__u8     retrans_effort;
390a9de9248SMarcel Holtmann 	__le16   pkt_type;
39166c853ccSGustavo F. Padovan } __packed;
392a9de9248SMarcel Holtmann 
393a9de9248SMarcel Holtmann #define HCI_OP_ACCEPT_SYNC_CONN_REQ	0x0429
394a9de9248SMarcel Holtmann struct hci_cp_accept_sync_conn_req {
395a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
396a9de9248SMarcel Holtmann 	__le32   tx_bandwidth;
397a9de9248SMarcel Holtmann 	__le32   rx_bandwidth;
398a9de9248SMarcel Holtmann 	__le16   max_latency;
399a9de9248SMarcel Holtmann 	__le16   content_format;
400a9de9248SMarcel Holtmann 	__u8     retrans_effort;
401a9de9248SMarcel Holtmann 	__le16   pkt_type;
40266c853ccSGustavo F. Padovan } __packed;
403a9de9248SMarcel Holtmann 
404a9de9248SMarcel Holtmann #define HCI_OP_REJECT_SYNC_CONN_REQ	0x042a
405a9de9248SMarcel Holtmann struct hci_cp_reject_sync_conn_req {
406a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
407a9de9248SMarcel Holtmann 	__u8     reason;
40866c853ccSGustavo F. Padovan } __packed;
409a9de9248SMarcel Holtmann 
41017fa4b9dSJohan Hedberg #define HCI_OP_IO_CAPABILITY_REPLY	0x042b
41117fa4b9dSJohan Hedberg struct hci_cp_io_capability_reply {
41217fa4b9dSJohan Hedberg 	bdaddr_t bdaddr;
41317fa4b9dSJohan Hedberg 	__u8     capability;
41417fa4b9dSJohan Hedberg 	__u8     oob_data;
41517fa4b9dSJohan Hedberg 	__u8     authentication;
41617fa4b9dSJohan Hedberg } __packed;
41717fa4b9dSJohan Hedberg 
418a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_REPLY		0x042c
419a5c29683SJohan Hedberg struct hci_cp_user_confirm_reply {
420a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
421a5c29683SJohan Hedberg } __packed;
422a5c29683SJohan Hedberg struct hci_rp_user_confirm_reply {
423a5c29683SJohan Hedberg 	__u8     status;
424a5c29683SJohan Hedberg 	bdaddr_t bdaddr;
425a5c29683SJohan Hedberg } __packed;
426a5c29683SJohan Hedberg 
427a5c29683SJohan Hedberg #define HCI_OP_USER_CONFIRM_NEG_REPLY	0x042d
428a5c29683SJohan Hedberg 
4292763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_REPLY	0x0430
4302763eda6SSzymon Janc struct hci_cp_remote_oob_data_reply {
4312763eda6SSzymon Janc 	bdaddr_t bdaddr;
4322763eda6SSzymon Janc 	__u8     hash[16];
4332763eda6SSzymon Janc 	__u8     randomizer[16];
4342763eda6SSzymon Janc } __packed;
4352763eda6SSzymon Janc 
4362763eda6SSzymon Janc #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY	0x0433
4372763eda6SSzymon Janc struct hci_cp_remote_oob_data_neg_reply {
4382763eda6SSzymon Janc 	bdaddr_t bdaddr;
4392763eda6SSzymon Janc } __packed;
4402763eda6SSzymon Janc 
44103b555e1SJohan Hedberg #define HCI_OP_IO_CAPABILITY_NEG_REPLY	0x0434
44203b555e1SJohan Hedberg struct hci_cp_io_capability_neg_reply {
44303b555e1SJohan Hedberg 	bdaddr_t bdaddr;
44403b555e1SJohan Hedberg 	__u8     reason;
44503b555e1SJohan Hedberg } __packed;
44603b555e1SJohan Hedberg 
447a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_MODE		0x0803
448a9de9248SMarcel Holtmann struct hci_cp_sniff_mode {
449a9de9248SMarcel Holtmann 	__le16   handle;
450a9de9248SMarcel Holtmann 	__le16   max_interval;
451a9de9248SMarcel Holtmann 	__le16   min_interval;
452a9de9248SMarcel Holtmann 	__le16   attempt;
453a9de9248SMarcel Holtmann 	__le16   timeout;
45466c853ccSGustavo F. Padovan } __packed;
455a9de9248SMarcel Holtmann 
456a9de9248SMarcel Holtmann #define HCI_OP_EXIT_SNIFF_MODE		0x0804
457a9de9248SMarcel Holtmann struct hci_cp_exit_sniff_mode {
458a9de9248SMarcel Holtmann 	__le16   handle;
45966c853ccSGustavo F. Padovan } __packed;
460a9de9248SMarcel Holtmann 
461a9de9248SMarcel Holtmann #define HCI_OP_ROLE_DISCOVERY		0x0809
462a9de9248SMarcel Holtmann struct hci_cp_role_discovery {
463a9de9248SMarcel Holtmann 	__le16   handle;
46466c853ccSGustavo F. Padovan } __packed;
465a9de9248SMarcel Holtmann struct hci_rp_role_discovery {
466a9de9248SMarcel Holtmann 	__u8     status;
467a9de9248SMarcel Holtmann 	__le16   handle;
468a9de9248SMarcel Holtmann 	__u8     role;
46966c853ccSGustavo F. Padovan } __packed;
470a9de9248SMarcel Holtmann 
471a9de9248SMarcel Holtmann #define HCI_OP_SWITCH_ROLE		0x080b
472a9de9248SMarcel Holtmann struct hci_cp_switch_role {
473a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
474a9de9248SMarcel Holtmann 	__u8     role;
47566c853ccSGustavo F. Padovan } __packed;
476a9de9248SMarcel Holtmann 
477a9de9248SMarcel Holtmann #define HCI_OP_READ_LINK_POLICY		0x080c
478a9de9248SMarcel Holtmann struct hci_cp_read_link_policy {
479a9de9248SMarcel Holtmann 	__le16   handle;
48066c853ccSGustavo F. Padovan } __packed;
481a9de9248SMarcel Holtmann struct hci_rp_read_link_policy {
482a9de9248SMarcel Holtmann 	__u8     status;
483a9de9248SMarcel Holtmann 	__le16   handle;
484a9de9248SMarcel Holtmann 	__le16   policy;
48566c853ccSGustavo F. Padovan } __packed;
486a9de9248SMarcel Holtmann 
487a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LINK_POLICY	0x080d
488a9de9248SMarcel Holtmann struct hci_cp_write_link_policy {
489a9de9248SMarcel Holtmann 	__le16   handle;
490a9de9248SMarcel Holtmann 	__le16   policy;
49166c853ccSGustavo F. Padovan } __packed;
492a9de9248SMarcel Holtmann struct hci_rp_write_link_policy {
493a9de9248SMarcel Holtmann 	__u8     status;
494a9de9248SMarcel Holtmann 	__le16   handle;
49566c853ccSGustavo F. Padovan } __packed;
496a9de9248SMarcel Holtmann 
497e4e8e37cSMarcel Holtmann #define HCI_OP_READ_DEF_LINK_POLICY	0x080e
498e4e8e37cSMarcel Holtmann struct hci_rp_read_def_link_policy {
499e4e8e37cSMarcel Holtmann 	__u8     status;
500e4e8e37cSMarcel Holtmann 	__le16   policy;
50166c853ccSGustavo F. Padovan } __packed;
502e4e8e37cSMarcel Holtmann 
503e4e8e37cSMarcel Holtmann #define HCI_OP_WRITE_DEF_LINK_POLICY	0x080f
504e4e8e37cSMarcel Holtmann struct hci_cp_write_def_link_policy {
505e4e8e37cSMarcel Holtmann 	__le16   policy;
50666c853ccSGustavo F. Padovan } __packed;
507e4e8e37cSMarcel Holtmann 
508a9de9248SMarcel Holtmann #define HCI_OP_SNIFF_SUBRATE		0x0811
509a9de9248SMarcel Holtmann struct hci_cp_sniff_subrate {
510a9de9248SMarcel Holtmann 	__le16   handle;
511a9de9248SMarcel Holtmann 	__le16   max_latency;
512a9de9248SMarcel Holtmann 	__le16   min_remote_timeout;
513a9de9248SMarcel Holtmann 	__le16   min_local_timeout;
51466c853ccSGustavo F. Padovan } __packed;
515a9de9248SMarcel Holtmann 
516a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_MASK		0x0c01
517a9de9248SMarcel Holtmann struct hci_cp_set_event_mask {
518a9de9248SMarcel Holtmann 	__u8     mask[8];
51966c853ccSGustavo F. Padovan } __packed;
520a9de9248SMarcel Holtmann 
521a9de9248SMarcel Holtmann #define HCI_OP_RESET			0x0c03
522a9de9248SMarcel Holtmann 
523a9de9248SMarcel Holtmann #define HCI_OP_SET_EVENT_FLT		0x0c05
5241da177e4SLinus Torvalds struct hci_cp_set_event_flt {
5251da177e4SLinus Torvalds 	__u8     flt_type;
5261da177e4SLinus Torvalds 	__u8     cond_type;
5271da177e4SLinus Torvalds 	__u8     condition[0];
52866c853ccSGustavo F. Padovan } __packed;
5291da177e4SLinus Torvalds 
5301da177e4SLinus Torvalds /* Filter types */
5311da177e4SLinus Torvalds #define HCI_FLT_CLEAR_ALL	0x00
5321da177e4SLinus Torvalds #define HCI_FLT_INQ_RESULT	0x01
5331da177e4SLinus Torvalds #define HCI_FLT_CONN_SETUP	0x02
5341da177e4SLinus Torvalds 
5351da177e4SLinus Torvalds /* CONN_SETUP Condition types */
5361da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_ALL	0x00
5371da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_CLASS	0x01
5381da177e4SLinus Torvalds #define HCI_CONN_SETUP_ALLOW_BDADDR	0x02
5391da177e4SLinus Torvalds 
5401da177e4SLinus Torvalds /* CONN_SETUP Conditions */
5411da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_OFF	0x01
5421da177e4SLinus Torvalds #define HCI_CONN_SETUP_AUTO_ON	0x02
5431da177e4SLinus Torvalds 
544b0916ea0SJohan Hedberg #define HCI_OP_DELETE_STORED_LINK_KEY	0x0c12
545b0916ea0SJohan Hedberg struct hci_cp_delete_stored_link_key {
546b0916ea0SJohan Hedberg 	bdaddr_t bdaddr;
547b0916ea0SJohan Hedberg 	__u8     delete_all;
548b0916ea0SJohan Hedberg } __packed;
549b0916ea0SJohan Hedberg 
5501f6c6378SJohan Hedberg #define HCI_MAX_NAME_LENGTH		248
5511f6c6378SJohan Hedberg 
552a9de9248SMarcel Holtmann #define HCI_OP_WRITE_LOCAL_NAME		0x0c13
553a9de9248SMarcel Holtmann struct hci_cp_write_local_name {
5541f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
55566c853ccSGustavo F. Padovan } __packed;
556a9de9248SMarcel Holtmann 
557a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_NAME		0x0c14
558a9de9248SMarcel Holtmann struct hci_rp_read_local_name {
559a9de9248SMarcel Holtmann 	__u8     status;
5601f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
56166c853ccSGustavo F. Padovan } __packed;
562a9de9248SMarcel Holtmann 
563a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CA_TIMEOUT		0x0c16
564a9de9248SMarcel Holtmann 
565a9de9248SMarcel Holtmann #define HCI_OP_WRITE_PG_TIMEOUT		0x0c18
566a9de9248SMarcel Holtmann 
567a9de9248SMarcel Holtmann #define HCI_OP_WRITE_SCAN_ENABLE	0x0c1a
568a9de9248SMarcel Holtmann 	#define SCAN_DISABLED		0x00
569a9de9248SMarcel Holtmann 	#define SCAN_INQUIRY		0x01
570a9de9248SMarcel Holtmann 	#define SCAN_PAGE		0x02
571a9de9248SMarcel Holtmann 
572a9de9248SMarcel Holtmann #define HCI_OP_READ_AUTH_ENABLE		0x0c1f
573a9de9248SMarcel Holtmann 
574a9de9248SMarcel Holtmann #define HCI_OP_WRITE_AUTH_ENABLE	0x0c20
575a9de9248SMarcel Holtmann 	#define AUTH_DISABLED		0x00
576a9de9248SMarcel Holtmann 	#define AUTH_ENABLED		0x01
577a9de9248SMarcel Holtmann 
578a9de9248SMarcel Holtmann #define HCI_OP_READ_ENCRYPT_MODE	0x0c21
579a9de9248SMarcel Holtmann 
580a9de9248SMarcel Holtmann #define HCI_OP_WRITE_ENCRYPT_MODE	0x0c22
581a9de9248SMarcel Holtmann 	#define ENCRYPT_DISABLED	0x00
582a9de9248SMarcel Holtmann 	#define ENCRYPT_P2P		0x01
583a9de9248SMarcel Holtmann 	#define ENCRYPT_BOTH		0x02
584a9de9248SMarcel Holtmann 
585a9de9248SMarcel Holtmann #define HCI_OP_READ_CLASS_OF_DEV	0x0c23
586a9de9248SMarcel Holtmann struct hci_rp_read_class_of_dev {
5871da177e4SLinus Torvalds 	__u8     status;
5881da177e4SLinus Torvalds 	__u8     dev_class[3];
58966c853ccSGustavo F. Padovan } __packed;
5901da177e4SLinus Torvalds 
591a9de9248SMarcel Holtmann #define HCI_OP_WRITE_CLASS_OF_DEV	0x0c24
592a9de9248SMarcel Holtmann struct hci_cp_write_class_of_dev {
5931da177e4SLinus Torvalds 	__u8     dev_class[3];
59466c853ccSGustavo F. Padovan } __packed;
5951da177e4SLinus Torvalds 
596a9de9248SMarcel Holtmann #define HCI_OP_READ_VOICE_SETTING	0x0c25
5971da177e4SLinus Torvalds struct hci_rp_read_voice_setting {
5981da177e4SLinus Torvalds 	__u8     status;
5991ebb9252SMarcel Holtmann 	__le16   voice_setting;
60066c853ccSGustavo F. Padovan } __packed;
6011da177e4SLinus Torvalds 
602a9de9248SMarcel Holtmann #define HCI_OP_WRITE_VOICE_SETTING	0x0c26
6031da177e4SLinus Torvalds struct hci_cp_write_voice_setting {
6041ebb9252SMarcel Holtmann 	__le16   voice_setting;
60566c853ccSGustavo F. Padovan } __packed;
6061da177e4SLinus Torvalds 
607a9de9248SMarcel Holtmann #define HCI_OP_HOST_BUFFER_SIZE		0x0c33
6081da177e4SLinus Torvalds struct hci_cp_host_buffer_size {
6091ebb9252SMarcel Holtmann 	__le16   acl_mtu;
6101da177e4SLinus Torvalds 	__u8     sco_mtu;
6111ebb9252SMarcel Holtmann 	__le16   acl_max_pkt;
6121ebb9252SMarcel Holtmann 	__le16   sco_max_pkt;
61366c853ccSGustavo F. Padovan } __packed;
6141da177e4SLinus Torvalds 
615d5859e22SJohan Hedberg #define HCI_OP_WRITE_INQUIRY_MODE	0x0c45
616d5859e22SJohan Hedberg 
617*80a1e1dbSJohan Hedberg #define HCI_MAX_EIR_LENGTH		240
618*80a1e1dbSJohan Hedberg 
619*80a1e1dbSJohan Hedberg #define HCI_OP_WRITE_EIR		0x0c52
620*80a1e1dbSJohan Hedberg struct hci_cp_write_eir {
621*80a1e1dbSJohan Hedberg 	uint8_t		fec;
622*80a1e1dbSJohan Hedberg 	uint8_t		data[HCI_MAX_EIR_LENGTH];
623*80a1e1dbSJohan Hedberg } __packed;
624*80a1e1dbSJohan Hedberg 
625333140b5SMarcel Holtmann #define HCI_OP_READ_SSP_MODE		0x0c55
626333140b5SMarcel Holtmann struct hci_rp_read_ssp_mode {
627333140b5SMarcel Holtmann 	__u8     status;
628333140b5SMarcel Holtmann 	__u8     mode;
62966c853ccSGustavo F. Padovan } __packed;
630333140b5SMarcel Holtmann 
631333140b5SMarcel Holtmann #define HCI_OP_WRITE_SSP_MODE		0x0c56
632333140b5SMarcel Holtmann struct hci_cp_write_ssp_mode {
633333140b5SMarcel Holtmann 	__u8     mode;
63466c853ccSGustavo F. Padovan } __packed;
635333140b5SMarcel Holtmann 
636c35938b2SSzymon Janc #define HCI_OP_READ_LOCAL_OOB_DATA		0x0c57
637c35938b2SSzymon Janc struct hci_rp_read_local_oob_data {
638c35938b2SSzymon Janc 	__u8     status;
639c35938b2SSzymon Janc 	__u8     hash[16];
640c35938b2SSzymon Janc 	__u8     randomizer[16];
641c35938b2SSzymon Janc } __packed;
642c35938b2SSzymon Janc 
643d5859e22SJohan Hedberg #define HCI_OP_READ_INQ_RSP_TX_POWER	0x0c58
644d5859e22SJohan Hedberg 
645a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_VERSION	0x1001
646a9de9248SMarcel Holtmann struct hci_rp_read_local_version {
6471da177e4SLinus Torvalds 	__u8     status;
648a9de9248SMarcel Holtmann 	__u8     hci_ver;
649a9de9248SMarcel Holtmann 	__le16   hci_rev;
650a9de9248SMarcel Holtmann 	__u8     lmp_ver;
651a9de9248SMarcel Holtmann 	__le16   manufacturer;
652a9de9248SMarcel Holtmann 	__le16   lmp_subver;
65366c853ccSGustavo F. Padovan } __packed;
6541da177e4SLinus Torvalds 
655a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_COMMANDS	0x1002
656a9de9248SMarcel Holtmann struct hci_rp_read_local_commands {
6571da177e4SLinus Torvalds 	__u8     status;
658a9de9248SMarcel Holtmann 	__u8     commands[64];
65966c853ccSGustavo F. Padovan } __packed;
6601da177e4SLinus Torvalds 
661a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_FEATURES	0x1003
662a9de9248SMarcel Holtmann struct hci_rp_read_local_features {
663a9de9248SMarcel Holtmann 	__u8     status;
664a9de9248SMarcel Holtmann 	__u8     features[8];
66566c853ccSGustavo F. Padovan } __packed;
666a9de9248SMarcel Holtmann 
667a9de9248SMarcel Holtmann #define HCI_OP_READ_LOCAL_EXT_FEATURES	0x1004
668a9de9248SMarcel Holtmann struct hci_rp_read_local_ext_features {
669a9de9248SMarcel Holtmann 	__u8     status;
670a9de9248SMarcel Holtmann 	__u8     page;
671a9de9248SMarcel Holtmann 	__u8     max_page;
672a9de9248SMarcel Holtmann 	__u8     features[8];
67366c853ccSGustavo F. Padovan } __packed;
674a9de9248SMarcel Holtmann 
675a9de9248SMarcel Holtmann #define HCI_OP_READ_BUFFER_SIZE		0x1005
676a9de9248SMarcel Holtmann struct hci_rp_read_buffer_size {
677a9de9248SMarcel Holtmann 	__u8     status;
678a9de9248SMarcel Holtmann 	__le16   acl_mtu;
679a9de9248SMarcel Holtmann 	__u8     sco_mtu;
680a9de9248SMarcel Holtmann 	__le16   acl_max_pkt;
681a9de9248SMarcel Holtmann 	__le16   sco_max_pkt;
68266c853ccSGustavo F. Padovan } __packed;
683a9de9248SMarcel Holtmann 
684a9de9248SMarcel Holtmann #define HCI_OP_READ_BD_ADDR		0x1009
685a9de9248SMarcel Holtmann struct hci_rp_read_bd_addr {
686a9de9248SMarcel Holtmann 	__u8     status;
6871da177e4SLinus Torvalds 	bdaddr_t bdaddr;
68866c853ccSGustavo F. Padovan } __packed;
6891da177e4SLinus Torvalds 
69063185f64SVille Tervo #define HCI_OP_LE_SET_EVENT_MASK	0x2001
69163185f64SVille Tervo struct hci_cp_le_set_event_mask {
69263185f64SVille Tervo 	__u8     mask[8];
69363185f64SVille Tervo } __packed;
69463185f64SVille Tervo 
69563185f64SVille Tervo #define HCI_OP_LE_READ_BUFFER_SIZE	0x2002
69663185f64SVille Tervo struct hci_rp_le_read_buffer_size {
69763185f64SVille Tervo 	__u8     status;
69863185f64SVille Tervo 	__le16   le_mtu;
69963185f64SVille Tervo 	__u8     le_max_pkt;
70063185f64SVille Tervo } __packed;
70163185f64SVille Tervo 
70263185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN		0x200d
70363185f64SVille Tervo struct hci_cp_le_create_conn {
70463185f64SVille Tervo 	__le16   scan_interval;
70563185f64SVille Tervo 	__le16   scan_window;
70663185f64SVille Tervo 	__u8     filter_policy;
70763185f64SVille Tervo 	__u8     peer_addr_type;
70863185f64SVille Tervo 	bdaddr_t peer_addr;
70963185f64SVille Tervo 	__u8     own_address_type;
71063185f64SVille Tervo 	__le16   conn_interval_min;
71163185f64SVille Tervo 	__le16   conn_interval_max;
71263185f64SVille Tervo 	__le16   conn_latency;
71363185f64SVille Tervo 	__le16   supervision_timeout;
71463185f64SVille Tervo 	__le16   min_ce_len;
71563185f64SVille Tervo 	__le16   max_ce_len;
71663185f64SVille Tervo } __packed;
71763185f64SVille Tervo 
71863185f64SVille Tervo #define HCI_OP_LE_CREATE_CONN_CANCEL	0x200e
71963185f64SVille Tervo 
7202ce603ebSClaudio Takahasi #define HCI_OP_LE_CONN_UPDATE		0x2013
7212ce603ebSClaudio Takahasi struct hci_cp_le_conn_update {
7222ce603ebSClaudio Takahasi 	__le16   handle;
7232ce603ebSClaudio Takahasi 	__le16   conn_interval_min;
7242ce603ebSClaudio Takahasi 	__le16   conn_interval_max;
7252ce603ebSClaudio Takahasi 	__le16   conn_latency;
7262ce603ebSClaudio Takahasi 	__le16   supervision_timeout;
7272ce603ebSClaudio Takahasi 	__le16   min_ce_len;
7282ce603ebSClaudio Takahasi 	__le16   max_ce_len;
7292ce603ebSClaudio Takahasi } __packed;
7302ce603ebSClaudio Takahasi 
7311da177e4SLinus Torvalds /* ---- HCI Events ---- */
7321da177e4SLinus Torvalds #define HCI_EV_INQUIRY_COMPLETE		0x01
7331da177e4SLinus Torvalds 
7341da177e4SLinus Torvalds #define HCI_EV_INQUIRY_RESULT		0x02
7351da177e4SLinus Torvalds struct inquiry_info {
7361da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7371da177e4SLinus Torvalds 	__u8     pscan_rep_mode;
7381da177e4SLinus Torvalds 	__u8     pscan_period_mode;
7391da177e4SLinus Torvalds 	__u8     pscan_mode;
7401da177e4SLinus Torvalds 	__u8     dev_class[3];
7411ebb9252SMarcel Holtmann 	__le16   clock_offset;
74266c853ccSGustavo F. Padovan } __packed;
7431da177e4SLinus Torvalds 
7441da177e4SLinus Torvalds #define HCI_EV_CONN_COMPLETE		0x03
7451da177e4SLinus Torvalds struct hci_ev_conn_complete {
7461da177e4SLinus Torvalds 	__u8     status;
7471ebb9252SMarcel Holtmann 	__le16   handle;
7481da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7491da177e4SLinus Torvalds 	__u8     link_type;
7501da177e4SLinus Torvalds 	__u8     encr_mode;
75166c853ccSGustavo F. Padovan } __packed;
7521da177e4SLinus Torvalds 
7531da177e4SLinus Torvalds #define HCI_EV_CONN_REQUEST		0x04
7541da177e4SLinus Torvalds struct hci_ev_conn_request {
7551da177e4SLinus Torvalds 	bdaddr_t bdaddr;
7561da177e4SLinus Torvalds 	__u8     dev_class[3];
7571da177e4SLinus Torvalds 	__u8     link_type;
75866c853ccSGustavo F. Padovan } __packed;
7591da177e4SLinus Torvalds 
7601da177e4SLinus Torvalds #define HCI_EV_DISCONN_COMPLETE		0x05
7611da177e4SLinus Torvalds struct hci_ev_disconn_complete {
7621da177e4SLinus Torvalds 	__u8     status;
7631ebb9252SMarcel Holtmann 	__le16   handle;
7641da177e4SLinus Torvalds 	__u8     reason;
76566c853ccSGustavo F. Padovan } __packed;
7661da177e4SLinus Torvalds 
7671da177e4SLinus Torvalds #define HCI_EV_AUTH_COMPLETE		0x06
7681da177e4SLinus Torvalds struct hci_ev_auth_complete {
7691da177e4SLinus Torvalds 	__u8     status;
7701ebb9252SMarcel Holtmann 	__le16   handle;
77166c853ccSGustavo F. Padovan } __packed;
7721da177e4SLinus Torvalds 
773a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_NAME		0x07
774a9de9248SMarcel Holtmann struct hci_ev_remote_name {
775a9de9248SMarcel Holtmann 	__u8     status;
776a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
7771f6c6378SJohan Hedberg 	__u8     name[HCI_MAX_NAME_LENGTH];
77866c853ccSGustavo F. Padovan } __packed;
779a9de9248SMarcel Holtmann 
7801da177e4SLinus Torvalds #define HCI_EV_ENCRYPT_CHANGE		0x08
7811da177e4SLinus Torvalds struct hci_ev_encrypt_change {
7821da177e4SLinus Torvalds 	__u8     status;
7831ebb9252SMarcel Holtmann 	__le16   handle;
7841da177e4SLinus Torvalds 	__u8     encrypt;
78566c853ccSGustavo F. Padovan } __packed;
7861da177e4SLinus Torvalds 
787a9de9248SMarcel Holtmann #define HCI_EV_CHANGE_LINK_KEY_COMPLETE	0x09
788a9de9248SMarcel Holtmann struct hci_ev_change_link_key_complete {
7891da177e4SLinus Torvalds 	__u8     status;
7901ebb9252SMarcel Holtmann 	__le16   handle;
79166c853ccSGustavo F. Padovan } __packed;
7921da177e4SLinus Torvalds 
793a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_FEATURES		0x0b
794a9de9248SMarcel Holtmann struct hci_ev_remote_features {
795a9de9248SMarcel Holtmann 	__u8     status;
796a9de9248SMarcel Holtmann 	__le16   handle;
797a9de9248SMarcel Holtmann 	__u8     features[8];
79866c853ccSGustavo F. Padovan } __packed;
799a9de9248SMarcel Holtmann 
800a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_VERSION		0x0c
801a9de9248SMarcel Holtmann struct hci_ev_remote_version {
802a9de9248SMarcel Holtmann 	__u8     status;
803a9de9248SMarcel Holtmann 	__le16   handle;
804a9de9248SMarcel Holtmann 	__u8     lmp_ver;
805a9de9248SMarcel Holtmann 	__le16   manufacturer;
806a9de9248SMarcel Holtmann 	__le16   lmp_subver;
80766c853ccSGustavo F. Padovan } __packed;
808a9de9248SMarcel Holtmann 
809a9de9248SMarcel Holtmann #define HCI_EV_QOS_SETUP_COMPLETE	0x0d
8101da177e4SLinus Torvalds struct hci_qos {
8111da177e4SLinus Torvalds 	__u8     service_type;
8121da177e4SLinus Torvalds 	__u32    token_rate;
8131da177e4SLinus Torvalds 	__u32    peak_bandwidth;
8141da177e4SLinus Torvalds 	__u32    latency;
8151da177e4SLinus Torvalds 	__u32    delay_variation;
81666c853ccSGustavo F. Padovan } __packed;
8171da177e4SLinus Torvalds struct hci_ev_qos_setup_complete {
8181da177e4SLinus Torvalds 	__u8     status;
8191ebb9252SMarcel Holtmann 	__le16   handle;
8201da177e4SLinus Torvalds 	struct   hci_qos qos;
82166c853ccSGustavo F. Padovan } __packed;
8221da177e4SLinus Torvalds 
823a9de9248SMarcel Holtmann #define HCI_EV_CMD_COMPLETE		0x0e
8241da177e4SLinus Torvalds struct hci_ev_cmd_complete {
8251da177e4SLinus Torvalds 	__u8     ncmd;
8261ebb9252SMarcel Holtmann 	__le16   opcode;
82766c853ccSGustavo F. Padovan } __packed;
8281da177e4SLinus Torvalds 
829a9de9248SMarcel Holtmann #define HCI_EV_CMD_STATUS		0x0f
8301da177e4SLinus Torvalds struct hci_ev_cmd_status {
8311da177e4SLinus Torvalds 	__u8     status;
8321da177e4SLinus Torvalds 	__u8     ncmd;
8331ebb9252SMarcel Holtmann 	__le16   opcode;
83466c853ccSGustavo F. Padovan } __packed;
8351da177e4SLinus Torvalds 
8361da177e4SLinus Torvalds #define HCI_EV_ROLE_CHANGE		0x12
8371da177e4SLinus Torvalds struct hci_ev_role_change {
8381da177e4SLinus Torvalds 	__u8     status;
8391da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8401da177e4SLinus Torvalds 	__u8     role;
84166c853ccSGustavo F. Padovan } __packed;
8421da177e4SLinus Torvalds 
843a9de9248SMarcel Holtmann #define HCI_EV_NUM_COMP_PKTS		0x13
844a9de9248SMarcel Holtmann struct hci_ev_num_comp_pkts {
845a9de9248SMarcel Holtmann 	__u8     num_hndl;
846a9de9248SMarcel Holtmann 	/* variable length part */
84766c853ccSGustavo F. Padovan } __packed;
848a9de9248SMarcel Holtmann 
8491da177e4SLinus Torvalds #define HCI_EV_MODE_CHANGE		0x14
8501da177e4SLinus Torvalds struct hci_ev_mode_change {
8511da177e4SLinus Torvalds 	__u8     status;
8521ebb9252SMarcel Holtmann 	__le16   handle;
8531da177e4SLinus Torvalds 	__u8     mode;
8541ebb9252SMarcel Holtmann 	__le16   interval;
85566c853ccSGustavo F. Padovan } __packed;
8561da177e4SLinus Torvalds 
8571da177e4SLinus Torvalds #define HCI_EV_PIN_CODE_REQ		0x16
8581da177e4SLinus Torvalds struct hci_ev_pin_code_req {
8591da177e4SLinus Torvalds 	bdaddr_t bdaddr;
86066c853ccSGustavo F. Padovan } __packed;
8611da177e4SLinus Torvalds 
8621da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_REQ		0x17
8631da177e4SLinus Torvalds struct hci_ev_link_key_req {
8641da177e4SLinus Torvalds 	bdaddr_t bdaddr;
86566c853ccSGustavo F. Padovan } __packed;
8661da177e4SLinus Torvalds 
8671da177e4SLinus Torvalds #define HCI_EV_LINK_KEY_NOTIFY		0x18
8681da177e4SLinus Torvalds struct hci_ev_link_key_notify {
8691da177e4SLinus Torvalds 	bdaddr_t bdaddr;
8701da177e4SLinus Torvalds 	__u8     link_key[16];
8711da177e4SLinus Torvalds 	__u8     key_type;
87266c853ccSGustavo F. Padovan } __packed;
8731da177e4SLinus Torvalds 
874a9de9248SMarcel Holtmann #define HCI_EV_CLOCK_OFFSET		0x1c
8751da177e4SLinus Torvalds struct hci_ev_clock_offset {
8761da177e4SLinus Torvalds 	__u8     status;
8771ebb9252SMarcel Holtmann 	__le16   handle;
8781ebb9252SMarcel Holtmann 	__le16   clock_offset;
87966c853ccSGustavo F. Padovan } __packed;
8801da177e4SLinus Torvalds 
881a8746417SMarcel Holtmann #define HCI_EV_PKT_TYPE_CHANGE		0x1d
882a8746417SMarcel Holtmann struct hci_ev_pkt_type_change {
883a8746417SMarcel Holtmann 	__u8     status;
884a8746417SMarcel Holtmann 	__le16   handle;
885a8746417SMarcel Holtmann 	__le16   pkt_type;
88666c853ccSGustavo F. Padovan } __packed;
887a8746417SMarcel Holtmann 
88885a1e930SMarcel Holtmann #define HCI_EV_PSCAN_REP_MODE		0x20
88985a1e930SMarcel Holtmann struct hci_ev_pscan_rep_mode {
89085a1e930SMarcel Holtmann 	bdaddr_t bdaddr;
89185a1e930SMarcel Holtmann 	__u8     pscan_rep_mode;
89266c853ccSGustavo F. Padovan } __packed;
89385a1e930SMarcel Holtmann 
894a9de9248SMarcel Holtmann #define HCI_EV_INQUIRY_RESULT_WITH_RSSI	0x22
895a9de9248SMarcel Holtmann struct inquiry_info_with_rssi {
896a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
897a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
898a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
899a9de9248SMarcel Holtmann 	__u8     dev_class[3];
900a9de9248SMarcel Holtmann 	__le16   clock_offset;
901a9de9248SMarcel Holtmann 	__s8     rssi;
90266c853ccSGustavo F. Padovan } __packed;
903a9de9248SMarcel Holtmann struct inquiry_info_with_rssi_and_pscan_mode {
904a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
905a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
906a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
907a9de9248SMarcel Holtmann 	__u8     pscan_mode;
908a9de9248SMarcel Holtmann 	__u8     dev_class[3];
909a9de9248SMarcel Holtmann 	__le16   clock_offset;
910a9de9248SMarcel Holtmann 	__s8     rssi;
91166c853ccSGustavo F. Padovan } __packed;
912a9de9248SMarcel Holtmann 
913a9de9248SMarcel Holtmann #define HCI_EV_REMOTE_EXT_FEATURES	0x23
914a9de9248SMarcel Holtmann struct hci_ev_remote_ext_features {
915a9de9248SMarcel Holtmann 	__u8     status;
916a9de9248SMarcel Holtmann 	__le16   handle;
917a9de9248SMarcel Holtmann 	__u8     page;
918a9de9248SMarcel Holtmann 	__u8     max_page;
919a9de9248SMarcel Holtmann 	__u8     features[8];
92066c853ccSGustavo F. Padovan } __packed;
921a9de9248SMarcel Holtmann 
922a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_COMPLETE	0x2c
923a9de9248SMarcel Holtmann struct hci_ev_sync_conn_complete {
924a9de9248SMarcel Holtmann 	__u8     status;
925a9de9248SMarcel Holtmann 	__le16   handle;
926a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
927a9de9248SMarcel Holtmann 	__u8     link_type;
928a9de9248SMarcel Holtmann 	__u8     tx_interval;
929a9de9248SMarcel Holtmann 	__u8     retrans_window;
930a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
931a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
932a9de9248SMarcel Holtmann 	__u8     air_mode;
93366c853ccSGustavo F. Padovan } __packed;
934a9de9248SMarcel Holtmann 
935a9de9248SMarcel Holtmann #define HCI_EV_SYNC_CONN_CHANGED	0x2d
936a9de9248SMarcel Holtmann struct hci_ev_sync_conn_changed {
937a9de9248SMarcel Holtmann 	__u8     status;
938a9de9248SMarcel Holtmann 	__le16   handle;
939a9de9248SMarcel Holtmann 	__u8     tx_interval;
940a9de9248SMarcel Holtmann 	__u8     retrans_window;
941a9de9248SMarcel Holtmann 	__le16   rx_pkt_len;
942a9de9248SMarcel Holtmann 	__le16   tx_pkt_len;
94366c853ccSGustavo F. Padovan } __packed;
944a9de9248SMarcel Holtmann 
945a9de9248SMarcel Holtmann #define HCI_EV_SNIFF_SUBRATE		0x2e
94604837f64SMarcel Holtmann struct hci_ev_sniff_subrate {
94704837f64SMarcel Holtmann 	__u8     status;
94804837f64SMarcel Holtmann 	__le16   handle;
94904837f64SMarcel Holtmann 	__le16   max_tx_latency;
95004837f64SMarcel Holtmann 	__le16   max_rx_latency;
95104837f64SMarcel Holtmann 	__le16   max_remote_timeout;
95204837f64SMarcel Holtmann 	__le16   max_local_timeout;
95366c853ccSGustavo F. Padovan } __packed;
95404837f64SMarcel Holtmann 
955a9de9248SMarcel Holtmann #define HCI_EV_EXTENDED_INQUIRY_RESULT	0x2f
956a9de9248SMarcel Holtmann struct extended_inquiry_info {
957a9de9248SMarcel Holtmann 	bdaddr_t bdaddr;
958a9de9248SMarcel Holtmann 	__u8     pscan_rep_mode;
959a9de9248SMarcel Holtmann 	__u8     pscan_period_mode;
960a9de9248SMarcel Holtmann 	__u8     dev_class[3];
961a9de9248SMarcel Holtmann 	__le16   clock_offset;
962a9de9248SMarcel Holtmann 	__s8     rssi;
963a9de9248SMarcel Holtmann 	__u8     data[240];
96466c853ccSGustavo F. Padovan } __packed;
965a9de9248SMarcel Holtmann 
9660493684eSMarcel Holtmann #define HCI_EV_IO_CAPA_REQUEST		0x31
9670493684eSMarcel Holtmann struct hci_ev_io_capa_request {
9680493684eSMarcel Holtmann 	bdaddr_t bdaddr;
96966c853ccSGustavo F. Padovan } __packed;
9700493684eSMarcel Holtmann 
97103b555e1SJohan Hedberg #define HCI_EV_IO_CAPA_REPLY		0x32
97203b555e1SJohan Hedberg struct hci_ev_io_capa_reply {
97303b555e1SJohan Hedberg 	bdaddr_t bdaddr;
97403b555e1SJohan Hedberg 	__u8     capability;
97503b555e1SJohan Hedberg 	__u8     oob_data;
97603b555e1SJohan Hedberg 	__u8     authentication;
97703b555e1SJohan Hedberg } __packed;
97803b555e1SJohan Hedberg 
979a5c29683SJohan Hedberg #define HCI_EV_USER_CONFIRM_REQUEST	0x33
980a5c29683SJohan Hedberg struct hci_ev_user_confirm_req {
981a5c29683SJohan Hedberg 	bdaddr_t	bdaddr;
982a5c29683SJohan Hedberg 	__le32		passkey;
983a5c29683SJohan Hedberg } __packed;
984a5c29683SJohan Hedberg 
9852763eda6SSzymon Janc #define HCI_EV_REMOTE_OOB_DATA_REQUEST	0x35
9862763eda6SSzymon Janc struct hci_ev_remote_oob_data_request {
9872763eda6SSzymon Janc 	bdaddr_t bdaddr;
9882763eda6SSzymon Janc } __packed;
9892763eda6SSzymon Janc 
9900493684eSMarcel Holtmann #define HCI_EV_SIMPLE_PAIR_COMPLETE	0x36
9910493684eSMarcel Holtmann struct hci_ev_simple_pair_complete {
9920493684eSMarcel Holtmann 	__u8     status;
9930493684eSMarcel Holtmann 	bdaddr_t bdaddr;
99466c853ccSGustavo F. Padovan } __packed;
9950493684eSMarcel Holtmann 
99641a96212SMarcel Holtmann #define HCI_EV_REMOTE_HOST_FEATURES	0x3d
99741a96212SMarcel Holtmann struct hci_ev_remote_host_features {
99841a96212SMarcel Holtmann 	bdaddr_t bdaddr;
99941a96212SMarcel Holtmann 	__u8     features[8];
100066c853ccSGustavo F. Padovan } __packed;
100141a96212SMarcel Holtmann 
100263185f64SVille Tervo #define HCI_EV_LE_META			0x3e
100363185f64SVille Tervo struct hci_ev_le_meta {
100463185f64SVille Tervo 	__u8     subevent;
100563185f64SVille Tervo } __packed;
100663185f64SVille Tervo 
100763185f64SVille Tervo /* Low energy meta events */
100863185f64SVille Tervo #define HCI_EV_LE_CONN_COMPLETE		0x01
100963185f64SVille Tervo struct hci_ev_le_conn_complete {
101063185f64SVille Tervo 	__u8     status;
101163185f64SVille Tervo 	__le16   handle;
101263185f64SVille Tervo 	__u8     role;
101363185f64SVille Tervo 	__u8     bdaddr_type;
101463185f64SVille Tervo 	bdaddr_t bdaddr;
101563185f64SVille Tervo 	__le16   interval;
101663185f64SVille Tervo 	__le16   latency;
101763185f64SVille Tervo 	__le16   supervision_timeout;
101863185f64SVille Tervo 	__u8     clk_accurancy;
101963185f64SVille Tervo } __packed;
102063185f64SVille Tervo 
10211da177e4SLinus Torvalds /* Internal events generated by Bluetooth stack */
1022a9de9248SMarcel Holtmann #define HCI_EV_STACK_INTERNAL	0xfd
10231da177e4SLinus Torvalds struct hci_ev_stack_internal {
10241da177e4SLinus Torvalds 	__u16    type;
10251da177e4SLinus Torvalds 	__u8     data[0];
102666c853ccSGustavo F. Padovan } __packed;
10271da177e4SLinus Torvalds 
10281da177e4SLinus Torvalds #define HCI_EV_SI_DEVICE	0x01
10291da177e4SLinus Torvalds struct hci_ev_si_device {
10301da177e4SLinus Torvalds 	__u16    event;
10311da177e4SLinus Torvalds 	__u16    dev_id;
103266c853ccSGustavo F. Padovan } __packed;
10331da177e4SLinus Torvalds 
10341da177e4SLinus Torvalds #define HCI_EV_SI_SECURITY	0x02
10351da177e4SLinus Torvalds struct hci_ev_si_security {
10361da177e4SLinus Torvalds 	__u16    event;
10371da177e4SLinus Torvalds 	__u16    proto;
10381da177e4SLinus Torvalds 	__u16    subproto;
10391da177e4SLinus Torvalds 	__u8     incoming;
104066c853ccSGustavo F. Padovan } __packed;
10411da177e4SLinus Torvalds 
10421da177e4SLinus Torvalds /* ---- HCI Packet structures ---- */
10431da177e4SLinus Torvalds #define HCI_COMMAND_HDR_SIZE 3
10441da177e4SLinus Torvalds #define HCI_EVENT_HDR_SIZE   2
10451da177e4SLinus Torvalds #define HCI_ACL_HDR_SIZE     4
10461da177e4SLinus Torvalds #define HCI_SCO_HDR_SIZE     3
10471da177e4SLinus Torvalds 
10481da177e4SLinus Torvalds struct hci_command_hdr {
10491ebb9252SMarcel Holtmann 	__le16	opcode;		/* OCF & OGF */
10501da177e4SLinus Torvalds 	__u8	plen;
105166c853ccSGustavo F. Padovan } __packed;
10521da177e4SLinus Torvalds 
10531da177e4SLinus Torvalds struct hci_event_hdr {
10541da177e4SLinus Torvalds 	__u8	evt;
10551da177e4SLinus Torvalds 	__u8	plen;
105666c853ccSGustavo F. Padovan } __packed;
10571da177e4SLinus Torvalds 
10581da177e4SLinus Torvalds struct hci_acl_hdr {
10591ebb9252SMarcel Holtmann 	__le16	handle;		/* Handle & Flags(PB, BC) */
10601ebb9252SMarcel Holtmann 	__le16	dlen;
106166c853ccSGustavo F. Padovan } __packed;
10621da177e4SLinus Torvalds 
10631da177e4SLinus Torvalds struct hci_sco_hdr {
10641ebb9252SMarcel Holtmann 	__le16	handle;
10651da177e4SLinus Torvalds 	__u8	dlen;
106666c853ccSGustavo F. Padovan } __packed;
10671da177e4SLinus Torvalds 
10682a123b86SArnaldo Carvalho de Melo #ifdef __KERNEL__
10692a123b86SArnaldo Carvalho de Melo #include <linux/skbuff.h>
10702a123b86SArnaldo Carvalho de Melo static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
10712a123b86SArnaldo Carvalho de Melo {
10722a123b86SArnaldo Carvalho de Melo 	return (struct hci_event_hdr *) skb->data;
10732a123b86SArnaldo Carvalho de Melo }
10742a123b86SArnaldo Carvalho de Melo 
10752a123b86SArnaldo Carvalho de Melo static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
10762a123b86SArnaldo Carvalho de Melo {
10772a123b86SArnaldo Carvalho de Melo 	return (struct hci_acl_hdr *) skb->data;
10782a123b86SArnaldo Carvalho de Melo }
10792a123b86SArnaldo Carvalho de Melo 
10802a123b86SArnaldo Carvalho de Melo static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
10812a123b86SArnaldo Carvalho de Melo {
10822a123b86SArnaldo Carvalho de Melo 	return (struct hci_sco_hdr *) skb->data;
10832a123b86SArnaldo Carvalho de Melo }
10842a123b86SArnaldo Carvalho de Melo #endif
10852a123b86SArnaldo Carvalho de Melo 
10861da177e4SLinus Torvalds /* Command opcode pack/unpack */
10871da177e4SLinus Torvalds #define hci_opcode_pack(ogf, ocf)	(__u16) ((ocf & 0x03ff)|(ogf << 10))
10881da177e4SLinus Torvalds #define hci_opcode_ogf(op)		(op >> 10)
10891da177e4SLinus Torvalds #define hci_opcode_ocf(op)		(op & 0x03ff)
10901da177e4SLinus Torvalds 
10911da177e4SLinus Torvalds /* ACL handle and flags pack/unpack */
10921da177e4SLinus Torvalds #define hci_handle_pack(h, f)	(__u16) ((h & 0x0fff)|(f << 12))
10931da177e4SLinus Torvalds #define hci_handle(h)		(h & 0x0fff)
10941da177e4SLinus Torvalds #define hci_flags(h)		(h >> 12)
10951da177e4SLinus Torvalds 
10961da177e4SLinus Torvalds /* ---- HCI Sockets ---- */
10971da177e4SLinus Torvalds 
10981da177e4SLinus Torvalds /* Socket options */
10991da177e4SLinus Torvalds #define HCI_DATA_DIR	1
11001da177e4SLinus Torvalds #define HCI_FILTER	2
11011da177e4SLinus Torvalds #define HCI_TIME_STAMP	3
11021da177e4SLinus Torvalds 
11031da177e4SLinus Torvalds /* CMSG flags */
11041da177e4SLinus Torvalds #define HCI_CMSG_DIR	0x0001
11051da177e4SLinus Torvalds #define HCI_CMSG_TSTAMP	0x0002
11061da177e4SLinus Torvalds 
11071da177e4SLinus Torvalds struct sockaddr_hci {
11081da177e4SLinus Torvalds 	sa_family_t    hci_family;
11091da177e4SLinus Torvalds 	unsigned short hci_dev;
1110c02178d2SJohan Hedberg 	unsigned short hci_channel;
11111da177e4SLinus Torvalds };
11121da177e4SLinus Torvalds #define HCI_DEV_NONE	0xffff
11131da177e4SLinus Torvalds 
1114c02178d2SJohan Hedberg #define HCI_CHANNEL_RAW		0
1115c02178d2SJohan Hedberg #define HCI_CHANNEL_CONTROL	1
1116c02178d2SJohan Hedberg 
11171da177e4SLinus Torvalds struct hci_filter {
11181da177e4SLinus Torvalds 	unsigned long type_mask;
11191da177e4SLinus Torvalds 	unsigned long event_mask[2];
1120905f3ed6SAl Viro 	__le16 opcode;
11211da177e4SLinus Torvalds };
11221da177e4SLinus Torvalds 
11231da177e4SLinus Torvalds struct hci_ufilter {
11241da177e4SLinus Torvalds 	__u32  type_mask;
11251da177e4SLinus Torvalds 	__u32  event_mask[2];
1126905f3ed6SAl Viro 	__le16 opcode;
11271da177e4SLinus Torvalds };
11281da177e4SLinus Torvalds 
11291da177e4SLinus Torvalds #define HCI_FLT_TYPE_BITS	31
11301da177e4SLinus Torvalds #define HCI_FLT_EVENT_BITS	63
11311da177e4SLinus Torvalds #define HCI_FLT_OGF_BITS	63
11321da177e4SLinus Torvalds #define HCI_FLT_OCF_BITS	127
11331da177e4SLinus Torvalds 
11341da177e4SLinus Torvalds /* ---- HCI Ioctl requests structures ---- */
11351da177e4SLinus Torvalds struct hci_dev_stats {
11361da177e4SLinus Torvalds 	__u32 err_rx;
11371da177e4SLinus Torvalds 	__u32 err_tx;
11381da177e4SLinus Torvalds 	__u32 cmd_tx;
11391da177e4SLinus Torvalds 	__u32 evt_rx;
11401da177e4SLinus Torvalds 	__u32 acl_tx;
11411da177e4SLinus Torvalds 	__u32 acl_rx;
11421da177e4SLinus Torvalds 	__u32 sco_tx;
11431da177e4SLinus Torvalds 	__u32 sco_rx;
11441da177e4SLinus Torvalds 	__u32 byte_rx;
11451da177e4SLinus Torvalds 	__u32 byte_tx;
11461da177e4SLinus Torvalds };
11471da177e4SLinus Torvalds 
11481da177e4SLinus Torvalds struct hci_dev_info {
11491da177e4SLinus Torvalds 	__u16 dev_id;
11501da177e4SLinus Torvalds 	char  name[8];
11511da177e4SLinus Torvalds 
11521da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11531da177e4SLinus Torvalds 
11541da177e4SLinus Torvalds 	__u32 flags;
11551da177e4SLinus Torvalds 	__u8  type;
11561da177e4SLinus Torvalds 
11571da177e4SLinus Torvalds 	__u8  features[8];
11581da177e4SLinus Torvalds 
11591da177e4SLinus Torvalds 	__u32 pkt_type;
11601da177e4SLinus Torvalds 	__u32 link_policy;
11611da177e4SLinus Torvalds 	__u32 link_mode;
11621da177e4SLinus Torvalds 
11631da177e4SLinus Torvalds 	__u16 acl_mtu;
11641da177e4SLinus Torvalds 	__u16 acl_pkts;
11651da177e4SLinus Torvalds 	__u16 sco_mtu;
11661da177e4SLinus Torvalds 	__u16 sco_pkts;
11671da177e4SLinus Torvalds 
11681da177e4SLinus Torvalds 	struct hci_dev_stats stat;
11691da177e4SLinus Torvalds };
11701da177e4SLinus Torvalds 
11711da177e4SLinus Torvalds struct hci_conn_info {
11721da177e4SLinus Torvalds 	__u16    handle;
11731da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11741da177e4SLinus Torvalds 	__u8     type;
11751da177e4SLinus Torvalds 	__u8     out;
11761da177e4SLinus Torvalds 	__u16    state;
11771da177e4SLinus Torvalds 	__u32    link_mode;
11781da177e4SLinus Torvalds };
11791da177e4SLinus Torvalds 
11801da177e4SLinus Torvalds struct hci_dev_req {
11811da177e4SLinus Torvalds 	__u16  dev_id;
11821da177e4SLinus Torvalds 	__u32  dev_opt;
11831da177e4SLinus Torvalds };
11841da177e4SLinus Torvalds 
11851da177e4SLinus Torvalds struct hci_dev_list_req {
11861da177e4SLinus Torvalds 	__u16  dev_num;
11871da177e4SLinus Torvalds 	struct hci_dev_req dev_req[0];	/* hci_dev_req structures */
11881da177e4SLinus Torvalds };
11891da177e4SLinus Torvalds 
11901da177e4SLinus Torvalds struct hci_conn_list_req {
11911da177e4SLinus Torvalds 	__u16  dev_id;
11921da177e4SLinus Torvalds 	__u16  conn_num;
11931da177e4SLinus Torvalds 	struct hci_conn_info conn_info[0];
11941da177e4SLinus Torvalds };
11951da177e4SLinus Torvalds 
11961da177e4SLinus Torvalds struct hci_conn_info_req {
11971da177e4SLinus Torvalds 	bdaddr_t bdaddr;
11981da177e4SLinus Torvalds 	__u8     type;
11991da177e4SLinus Torvalds 	struct   hci_conn_info conn_info[0];
12001da177e4SLinus Torvalds };
12011da177e4SLinus Torvalds 
120240be492fSMarcel Holtmann struct hci_auth_info_req {
120340be492fSMarcel Holtmann 	bdaddr_t bdaddr;
120440be492fSMarcel Holtmann 	__u8     type;
120540be492fSMarcel Holtmann };
120640be492fSMarcel Holtmann 
12071da177e4SLinus Torvalds struct hci_inquiry_req {
12081da177e4SLinus Torvalds 	__u16 dev_id;
12091da177e4SLinus Torvalds 	__u16 flags;
12101da177e4SLinus Torvalds 	__u8  lap[3];
12111da177e4SLinus Torvalds 	__u8  length;
12121da177e4SLinus Torvalds 	__u8  num_rsp;
12131da177e4SLinus Torvalds };
12141da177e4SLinus Torvalds #define IREQ_CACHE_FLUSH 0x0001
12151da177e4SLinus Torvalds 
12161da177e4SLinus Torvalds #endif /* __HCI_H */
1217