blob: ccd723e0f783e34a14a382e116a72e2a0369becb [file] [log] [blame]
Andrei Emeltchenkobe218712010-12-01 16:58:26 +02001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
10
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
Andrei Emeltchenkobe218712010-12-01 16:58:26 +020015 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
Andrei Emeltchenkobe218712010-12-01 16:58:26 +020020 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 SOFTWARE IS DISCLAIMED.
23*/
24
25#ifndef __HCI_H
26#define __HCI_H
27
28#define HCI_MAX_ACL_SIZE 1024
29#define HCI_MAX_SCO_SIZE 255
30#define HCI_MAX_EVENT_SIZE 260
31#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
32
Andrei Emeltchenko9b3b4462012-05-23 11:31:20 +030033#define HCI_LINK_KEY_SIZE 16
Andrei Emeltchenko523e93c2012-05-25 15:09:26 +030034#define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE)
Andrei Emeltchenko9b3b4462012-05-23 11:31:20 +030035
Linus Torvalds1da177e2005-04-16 15:20:36 -070036/* HCI dev events */
37#define HCI_DEV_REG 1
38#define HCI_DEV_UNREG 2
39#define HCI_DEV_UP 3
40#define HCI_DEV_DOWN 4
41#define HCI_DEV_SUSPEND 5
42#define HCI_DEV_RESUME 6
43
44/* HCI notify events */
45#define HCI_NOTIFY_CONN_ADD 1
46#define HCI_NOTIFY_CONN_DEL 2
47#define HCI_NOTIFY_VOICE_SETTING 3
48
Marcel Holtmannc13854c2010-02-08 15:27:07 +010049/* HCI bus types */
Marcel Holtmann0ac53932006-07-08 13:57:15 +020050#define HCI_VIRTUAL 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070051#define HCI_USB 1
52#define HCI_PCCARD 2
53#define HCI_UART 3
54#define HCI_RS232 4
55#define HCI_PCI 5
Marcel Holtmann0ac53932006-07-08 13:57:15 +020056#define HCI_SDIO 6
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Marcel Holtmann943da252010-02-13 02:28:41 +010058/* HCI controller types */
59#define HCI_BREDR 0x00
David Vrabel8f1e1742010-08-09 17:38:10 -040060#define HCI_AMP 0x01
Marcel Holtmann943da252010-02-13 02:28:41 +010061
Andrei Emeltchenko8598d062012-05-29 13:59:09 +030062/* First BR/EDR Controller shall have ID = 0 */
63#define HCI_BREDR_ID 0
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065/* HCI device quirks */
66enum {
Szymon Janca6c511c2012-05-23 12:35:46 +020067 HCI_QUIRK_RESET_ON_CLOSE,
Marcel Holtmannda1f5192006-07-03 10:02:29 +020068 HCI_QUIRK_RAW_DEVICE,
69 HCI_QUIRK_FIXUP_BUFFER_SIZE
Linus Torvalds1da177e2005-04-16 15:20:36 -070070};
71
72/* HCI device flags */
73enum {
74 HCI_UP,
75 HCI_INIT,
76 HCI_RUNNING,
77
78 HCI_PSCAN,
79 HCI_ISCAN,
80 HCI_AUTH,
81 HCI_ENCRYPT,
82 HCI_INQUIRY,
83
84 HCI_RAW,
Johan Hedbergab81cbf2010-12-15 13:53:18 +020085
Gustavo F. Padovan10572132011-03-16 15:36:29 -030086 HCI_RESET,
Linus Torvalds1da177e2005-04-16 15:20:36 -070087};
88
Andre Guedesd23264a2011-11-25 20:53:38 -030089/*
90 * BR/EDR and/or LE controller flags: the flags defined here should represent
91 * states from the controller.
92 */
93enum {
Johan Hedberga8b2d5c2012-01-08 23:11:15 +020094 HCI_SETUP,
95 HCI_AUTO_OFF,
96 HCI_MGMT,
97 HCI_PAIRABLE,
98 HCI_SERVICE_CACHE,
99 HCI_LINK_KEYS,
100 HCI_DEBUG_KEYS,
Johan Hovold94324962012-03-15 14:48:41 +0100101 HCI_UNREGISTER,
Johan Hedberga8b2d5c2012-01-08 23:11:15 +0200102
Andre Guedesd23264a2011-11-25 20:53:38 -0300103 HCI_LE_SCAN,
Johan Hedberg84bde9d2012-01-25 14:21:06 +0200104 HCI_SSP_ENABLED,
Johan Hedberg6d80dfd2012-02-20 23:50:38 +0200105 HCI_HS_ENABLED,
Johan Hedberg06199cf2012-02-22 16:37:11 +0200106 HCI_LE_ENABLED,
Johan Hedberg5e5282b2012-02-21 16:01:30 +0200107 HCI_CONNECTABLE,
108 HCI_DISCOVERABLE,
Johan Hedberg47990ea2012-02-22 11:58:37 +0200109 HCI_LINK_SECURITY,
Johan Hedbergc95f0ba2012-02-23 22:54:38 +0200110 HCI_PENDING_CLASS,
Andre Guedes21693c12012-03-21 00:03:36 -0300111 HCI_PERIODIC_INQ,
Andre Guedesd23264a2011-11-25 20:53:38 -0300112};
113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114/* HCI ioctl defines */
115#define HCIDEVUP _IOW('H', 201, int)
116#define HCIDEVDOWN _IOW('H', 202, int)
117#define HCIDEVRESET _IOW('H', 203, int)
118#define HCIDEVRESTAT _IOW('H', 204, int)
119
120#define HCIGETDEVLIST _IOR('H', 210, int)
121#define HCIGETDEVINFO _IOR('H', 211, int)
122#define HCIGETCONNLIST _IOR('H', 212, int)
123#define HCIGETCONNINFO _IOR('H', 213, int)
Marcel Holtmann40be4922008-07-14 20:13:50 +0200124#define HCIGETAUTHINFO _IOR('H', 215, int)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125
126#define HCISETRAW _IOW('H', 220, int)
127#define HCISETSCAN _IOW('H', 221, int)
128#define HCISETAUTH _IOW('H', 222, int)
129#define HCISETENCRYPT _IOW('H', 223, int)
130#define HCISETPTYPE _IOW('H', 224, int)
131#define HCISETLINKPOL _IOW('H', 225, int)
132#define HCISETLINKMODE _IOW('H', 226, int)
133#define HCISETACLMTU _IOW('H', 227, int)
134#define HCISETSCOMTU _IOW('H', 228, int)
135
Johan Hedbergf0358562010-05-18 13:20:32 +0200136#define HCIBLOCKADDR _IOW('H', 230, int)
137#define HCIUNBLOCKADDR _IOW('H', 231, int)
138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139#define HCIINQUIRY _IOR('H', 240, int)
140
141/* HCI timeouts */
Andrei Emeltchenko5f246e82012-06-11 11:13:07 +0300142#define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
143#define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */
144#define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */
Andrei Emeltchenko9345d402012-06-15 10:36:42 +0300145#define HCI_CMD_TIMEOUT msecs_to_jiffies(1000) /* 1 second */
Andrei Emeltchenko5f246e82012-06-11 11:13:07 +0300146#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
Andrei Emeltchenko9345d402012-06-15 10:36:42 +0300147#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200149/* HCI data types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#define HCI_COMMAND_PKT 0x01
151#define HCI_ACLDATA_PKT 0x02
152#define HCI_SCODATA_PKT 0x03
153#define HCI_EVENT_PKT 0x04
154#define HCI_VENDOR_PKT 0xff
155
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200156/* HCI packet types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157#define HCI_DM1 0x0008
158#define HCI_DM3 0x0400
159#define HCI_DM5 0x4000
160#define HCI_DH1 0x0010
161#define HCI_DH3 0x0800
162#define HCI_DH5 0x8000
163
164#define HCI_HV1 0x0020
165#define HCI_HV2 0x0040
166#define HCI_HV3 0x0080
167
168#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
169#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
170
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200171/* eSCO packet types */
172#define ESCO_HV1 0x0001
173#define ESCO_HV2 0x0002
174#define ESCO_HV3 0x0004
175#define ESCO_EV3 0x0008
176#define ESCO_EV4 0x0010
177#define ESCO_EV5 0x0020
Marcel Holtmannefc76882009-02-06 09:13:37 +0100178#define ESCO_2EV3 0x0040
179#define ESCO_3EV3 0x0080
180#define ESCO_2EV5 0x0100
181#define ESCO_3EV5 0x0200
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200182
Marcel Holtmanna8746412008-07-14 20:13:46 +0200183#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
Marcel Holtmannefc76882009-02-06 09:13:37 +0100184#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
Marcel Holtmanna8746412008-07-14 20:13:46 +0200185
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186/* ACL flags */
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200187#define ACL_START_NO_FLUSH 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188#define ACL_CONT 0x01
189#define ACL_START 0x02
190#define ACL_ACTIVE_BCAST 0x04
191#define ACL_PICO_BCAST 0x08
192
193/* Baseband links */
194#define SCO_LINK 0x00
195#define ACL_LINK 0x01
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200196#define ESCO_LINK 0x02
Ville Tervofcd89c02011-02-10 22:38:47 -0300197/* Low Energy links do not have defined link type. Use invented one */
198#define LE_LINK 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199
200/* LMP features */
201#define LMP_3SLOT 0x01
202#define LMP_5SLOT 0x02
203#define LMP_ENCRYPT 0x04
204#define LMP_SOFFSET 0x08
205#define LMP_TACCURACY 0x10
206#define LMP_RSWITCH 0x20
207#define LMP_HOLD 0x40
Marcel Holtmann04837f62006-07-03 10:02:33 +0200208#define LMP_SNIFF 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210#define LMP_PARK 0x01
211#define LMP_RSSI 0x02
212#define LMP_QUALITY 0x04
213#define LMP_SCO 0x08
214#define LMP_HV2 0x10
215#define LMP_HV3 0x20
216#define LMP_ULAW 0x40
217#define LMP_ALAW 0x80
218
219#define LMP_CVSD 0x01
220#define LMP_PSCHEME 0x02
221#define LMP_PCONTROL 0x04
222
Johan Hedbergd5859e22011-01-25 01:19:58 +0200223#define LMP_RSSI_INQ 0x40
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200224#define LMP_ESCO 0x80
225
226#define LMP_EV4 0x01
227#define LMP_EV5 0x02
Johan Hedberg69ab39e2011-12-15 00:47:35 +0200228#define LMP_NO_BREDR 0x20
Johan Hedbergd5859e22011-01-25 01:19:58 +0200229#define LMP_LE 0x40
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200230
Marcel Holtmann04837f62006-07-03 10:02:33 +0200231#define LMP_SNIFF_SUBR 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200232#define LMP_PAUSE_ENC 0x04
Marcel Holtmannefc76882009-02-06 09:13:37 +0100233#define LMP_EDR_ESCO_2M 0x20
234#define LMP_EDR_ESCO_3M 0x40
235#define LMP_EDR_3S_ESCO 0x80
Marcel Holtmann04837f62006-07-03 10:02:33 +0200236
Johan Hedbergd5859e22011-01-25 01:19:58 +0200237#define LMP_EXT_INQ 0x01
Andre Guedese6100a22011-06-30 19:20:54 -0300238#define LMP_SIMUL_LE_BR 0x02
Marcel Holtmann769be972008-07-14 20:13:49 +0200239#define LMP_SIMPLE_PAIR 0x08
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200240#define LMP_NO_FLUSH 0x40
Marcel Holtmann769be972008-07-14 20:13:49 +0200241
Johan Hedbergd5859e22011-01-25 01:19:58 +0200242#define LMP_LSTO 0x01
243#define LMP_INQ_TX_PWR 0x02
Andre Guedes971e3a42011-06-30 19:20:52 -0300244#define LMP_EXTFEATURES 0x80
Johan Hedbergd5859e22011-01-25 01:19:58 +0200245
Andre Guedeseead27d2011-06-30 19:20:55 -0300246/* Extended LMP features */
Johan Hedbergcc2c04e2012-02-28 02:03:24 +0200247#define LMP_HOST_SSP 0x01
248#define LMP_HOST_LE 0x02
249#define LMP_HOST_LE_BREDR 0x04
Andre Guedeseead27d2011-06-30 19:20:55 -0300250
Marcel Holtmann04837f62006-07-03 10:02:33 +0200251/* Connection modes */
252#define HCI_CM_ACTIVE 0x0000
253#define HCI_CM_HOLD 0x0001
254#define HCI_CM_SNIFF 0x0002
255#define HCI_CM_PARK 0x0003
256
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257/* Link policies */
258#define HCI_LP_RSWITCH 0x0001
259#define HCI_LP_HOLD 0x0002
260#define HCI_LP_SNIFF 0x0004
261#define HCI_LP_PARK 0x0008
262
Marcel Holtmann04837f62006-07-03 10:02:33 +0200263/* Link modes */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264#define HCI_LM_ACCEPT 0x8000
265#define HCI_LM_MASTER 0x0001
266#define HCI_LM_AUTH 0x0002
267#define HCI_LM_ENCRYPT 0x0004
268#define HCI_LM_TRUSTED 0x0008
269#define HCI_LM_RELIABLE 0x0010
270#define HCI_LM_SECURE 0x0020
271
Marcel Holtmann40be4922008-07-14 20:13:50 +0200272/* Authentication types */
273#define HCI_AT_NO_BONDING 0x00
274#define HCI_AT_NO_BONDING_MITM 0x01
275#define HCI_AT_DEDICATED_BONDING 0x02
276#define HCI_AT_DEDICATED_BONDING_MITM 0x03
277#define HCI_AT_GENERAL_BONDING 0x04
278#define HCI_AT_GENERAL_BONDING_MITM 0x05
279
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200280/* Link Key types */
281#define HCI_LK_COMBINATION 0x00
282#define HCI_LK_LOCAL_UNIT 0x01
283#define HCI_LK_REMOTE_UNIT 0x02
284#define HCI_LK_DEBUG_COMBINATION 0x03
285#define HCI_LK_UNAUTH_COMBINATION 0x04
286#define HCI_LK_AUTH_COMBINATION 0x05
287#define HCI_LK_CHANGED_COMBINATION 0x06
Vinicius Costa Gomesb899efa2012-02-02 21:08:00 -0300288/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
289#define HCI_SMP_STK 0x80
290#define HCI_SMP_STK_SLAVE 0x81
291#define HCI_SMP_LTK 0x82
292#define HCI_SMP_LTK_SLAVE 0x83
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200293
Andrei Emeltchenko9f5a0d72011-11-07 14:20:25 +0200294/* ---- HCI Error Codes ---- */
295#define HCI_ERROR_AUTH_FAILURE 0x05
296#define HCI_ERROR_REJ_BAD_ADDR 0x0f
297#define HCI_ERROR_REMOTE_USER_TERM 0x13
298#define HCI_ERROR_LOCAL_HOST_TERM 0x16
299#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
300
Andrei Emeltchenko2455a3e2011-12-19 16:31:28 +0200301/* Flow control modes */
302#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
303#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
304
Johan Hedberg32748db2011-12-30 14:57:23 +0200305/* Extended Inquiry Response field types */
306#define EIR_FLAGS 0x01 /* flags */
307#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
308#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
309#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
310#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
311#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
312#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
313#define EIR_NAME_SHORT 0x08 /* shortened local name */
314#define EIR_NAME_COMPLETE 0x09 /* complete local name */
315#define EIR_TX_POWER 0x0A /* transmit power level */
Johan Hedberg9ec9fc82012-01-15 20:46:33 +0200316#define EIR_CLASS_OF_DEV 0x0D /* Class of Device */
317#define EIR_SSP_HASH_C 0x0E /* Simple Pairing Hash C */
318#define EIR_SSP_RAND_R 0x0F /* Simple Pairing Randomizer R */
Johan Hedberg32748db2011-12-30 14:57:23 +0200319#define EIR_DEVICE_ID 0x10 /* device ID */
320
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321/* ----- HCI Commands ---- */
Ville Tervo6bd32322011-02-16 16:32:41 +0200322#define HCI_OP_NOP 0x0000
323
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200324#define HCI_OP_INQUIRY 0x0401
325struct hci_cp_inquiry {
326 __u8 lap[3];
327 __u8 length;
328 __u8 num_rsp;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300329} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200331#define HCI_OP_INQUIRY_CANCEL 0x0402
332
Andre Guedes79d6e062012-03-21 00:03:35 -0300333#define HCI_OP_PERIODIC_INQ 0x0403
334
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200335#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
336
337#define HCI_OP_CREATE_CONN 0x0405
338struct hci_cp_create_conn {
339 bdaddr_t bdaddr;
340 __le16 pkt_type;
341 __u8 pscan_rep_mode;
342 __u8 pscan_mode;
343 __le16 clock_offset;
344 __u8 role_switch;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300345} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200347#define HCI_OP_DISCONNECT 0x0406
348struct hci_cp_disconnect {
349 __le16 handle;
350 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300351} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200353#define HCI_OP_ADD_SCO 0x0407
354struct hci_cp_add_sco {
355 __le16 handle;
356 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300357} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200358
359#define HCI_OP_CREATE_CONN_CANCEL 0x0408
360struct hci_cp_create_conn_cancel {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300362} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200364#define HCI_OP_ACCEPT_CONN_REQ 0x0409
365struct hci_cp_accept_conn_req {
366 bdaddr_t bdaddr;
367 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300368} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200370#define HCI_OP_REJECT_CONN_REQ 0x040a
371struct hci_cp_reject_conn_req {
372 bdaddr_t bdaddr;
373 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300374} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200376#define HCI_OP_LINK_KEY_REPLY 0x040b
377struct hci_cp_link_key_reply {
378 bdaddr_t bdaddr;
Andrei Emeltchenko9b3b4462012-05-23 11:31:20 +0300379 __u8 link_key[HCI_LINK_KEY_SIZE];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300380} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700381
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200382#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
383struct hci_cp_link_key_neg_reply {
384 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300385} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200387#define HCI_OP_PIN_CODE_REPLY 0x040d
388struct hci_cp_pin_code_reply {
389 bdaddr_t bdaddr;
390 __u8 pin_len;
391 __u8 pin_code[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300392} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200393struct hci_rp_pin_code_reply {
394 __u8 status;
395 bdaddr_t bdaddr;
396} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200397
398#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
399struct hci_cp_pin_code_neg_reply {
400 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300401} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200402struct hci_rp_pin_code_neg_reply {
403 __u8 status;
404 bdaddr_t bdaddr;
405} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200406
407#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
408struct hci_cp_change_conn_ptype {
409 __le16 handle;
410 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300411} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200412
413#define HCI_OP_AUTH_REQUESTED 0x0411
414struct hci_cp_auth_requested {
415 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300416} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200417
418#define HCI_OP_SET_CONN_ENCRYPT 0x0413
419struct hci_cp_set_conn_encrypt {
420 __le16 handle;
421 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300422} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200423
424#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
425struct hci_cp_change_conn_link_key {
426 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300427} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200428
429#define HCI_OP_REMOTE_NAME_REQ 0x0419
430struct hci_cp_remote_name_req {
431 bdaddr_t bdaddr;
432 __u8 pscan_rep_mode;
433 __u8 pscan_mode;
434 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300435} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200436
437#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
438struct hci_cp_remote_name_req_cancel {
439 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300440} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200441
442#define HCI_OP_READ_REMOTE_FEATURES 0x041b
443struct hci_cp_read_remote_features {
444 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300445} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200446
447#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
448struct hci_cp_read_remote_ext_features {
449 __le16 handle;
450 __u8 page;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300451} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200452
453#define HCI_OP_READ_REMOTE_VERSION 0x041d
454struct hci_cp_read_remote_version {
455 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300456} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200457
458#define HCI_OP_SETUP_SYNC_CONN 0x0428
459struct hci_cp_setup_sync_conn {
460 __le16 handle;
461 __le32 tx_bandwidth;
462 __le32 rx_bandwidth;
463 __le16 max_latency;
464 __le16 voice_setting;
465 __u8 retrans_effort;
466 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300467} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200468
469#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
470struct hci_cp_accept_sync_conn_req {
471 bdaddr_t bdaddr;
472 __le32 tx_bandwidth;
473 __le32 rx_bandwidth;
474 __le16 max_latency;
475 __le16 content_format;
476 __u8 retrans_effort;
477 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300478} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200479
480#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
481struct hci_cp_reject_sync_conn_req {
482 bdaddr_t bdaddr;
483 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300484} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200485
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200486#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
487struct hci_cp_io_capability_reply {
488 bdaddr_t bdaddr;
489 __u8 capability;
490 __u8 oob_data;
491 __u8 authentication;
492} __packed;
493
Johan Hedberga5c29682011-02-19 12:05:57 -0300494#define HCI_OP_USER_CONFIRM_REPLY 0x042c
495struct hci_cp_user_confirm_reply {
496 bdaddr_t bdaddr;
497} __packed;
498struct hci_rp_user_confirm_reply {
499 __u8 status;
500 bdaddr_t bdaddr;
501} __packed;
502
503#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
504
Brian Gix9ad40192011-11-12 22:01:11 -0800505#define HCI_OP_USER_PASSKEY_REPLY 0x042e
506struct hci_cp_user_passkey_reply {
507 bdaddr_t bdaddr;
508 __le32 passkey;
509} __packed;
510
511#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f
512
Szymon Janc2763eda2011-03-22 13:12:22 +0100513#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
514struct hci_cp_remote_oob_data_reply {
515 bdaddr_t bdaddr;
516 __u8 hash[16];
517 __u8 randomizer[16];
518} __packed;
519
520#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
521struct hci_cp_remote_oob_data_neg_reply {
522 bdaddr_t bdaddr;
523} __packed;
524
Johan Hedberg03b555e2011-01-04 15:40:05 +0200525#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
526struct hci_cp_io_capability_neg_reply {
527 bdaddr_t bdaddr;
528 __u8 reason;
529} __packed;
530
Andrei Emeltchenko523e93c2012-05-25 15:09:26 +0300531#define HCI_OP_CREATE_PHY_LINK 0x0435
532struct hci_cp_create_phy_link {
533 __u8 phy_handle;
534 __u8 key_len;
535 __u8 key_type;
536 __u8 key[HCI_AMP_LINK_KEY_SIZE];
537} __packed;
538
539#define HCI_OP_ACCEPT_PHY_LINK 0x0436
540struct hci_cp_accept_phy_link {
541 __u8 phy_handle;
542 __u8 key_len;
543 __u8 key_type;
544 __u8 key[HCI_AMP_LINK_KEY_SIZE];
545} __packed;
546
547#define HCI_OP_DISCONN_PHY_LINK 0x0437
548struct hci_cp_disconn_phy_link {
549 __u8 phy_handle;
550 __u8 reason;
551} __packed;
552
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200553#define HCI_OP_SNIFF_MODE 0x0803
554struct hci_cp_sniff_mode {
555 __le16 handle;
556 __le16 max_interval;
557 __le16 min_interval;
558 __le16 attempt;
559 __le16 timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300560} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200561
562#define HCI_OP_EXIT_SNIFF_MODE 0x0804
563struct hci_cp_exit_sniff_mode {
564 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300565} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200566
567#define HCI_OP_ROLE_DISCOVERY 0x0809
568struct hci_cp_role_discovery {
569 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300570} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200571struct hci_rp_role_discovery {
572 __u8 status;
573 __le16 handle;
574 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300575} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200576
577#define HCI_OP_SWITCH_ROLE 0x080b
578struct hci_cp_switch_role {
579 bdaddr_t bdaddr;
580 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300581} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200582
583#define HCI_OP_READ_LINK_POLICY 0x080c
584struct hci_cp_read_link_policy {
585 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300586} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200587struct hci_rp_read_link_policy {
588 __u8 status;
589 __le16 handle;
590 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300591} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200592
593#define HCI_OP_WRITE_LINK_POLICY 0x080d
594struct hci_cp_write_link_policy {
595 __le16 handle;
596 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300597} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200598struct hci_rp_write_link_policy {
599 __u8 status;
600 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300601} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200602
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200603#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
604struct hci_rp_read_def_link_policy {
605 __u8 status;
606 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300607} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200608
609#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
610struct hci_cp_write_def_link_policy {
611 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300612} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200613
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200614#define HCI_OP_SNIFF_SUBRATE 0x0811
615struct hci_cp_sniff_subrate {
616 __le16 handle;
617 __le16 max_latency;
618 __le16 min_remote_timeout;
619 __le16 min_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300620} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200621
622#define HCI_OP_SET_EVENT_MASK 0x0c01
623struct hci_cp_set_event_mask {
624 __u8 mask[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300625} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200626
627#define HCI_OP_RESET 0x0c03
628
629#define HCI_OP_SET_EVENT_FLT 0x0c05
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630struct hci_cp_set_event_flt {
631 __u8 flt_type;
632 __u8 cond_type;
633 __u8 condition[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300634} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635
636/* Filter types */
637#define HCI_FLT_CLEAR_ALL 0x00
638#define HCI_FLT_INQ_RESULT 0x01
639#define HCI_FLT_CONN_SETUP 0x02
640
641/* CONN_SETUP Condition types */
642#define HCI_CONN_SETUP_ALLOW_ALL 0x00
643#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
644#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
645
646/* CONN_SETUP Conditions */
647#define HCI_CONN_SETUP_AUTO_OFF 0x01
648#define HCI_CONN_SETUP_AUTO_ON 0x02
649
Johan Hedbergb0916ea2011-01-10 13:44:55 +0200650#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
651struct hci_cp_delete_stored_link_key {
652 bdaddr_t bdaddr;
653 __u8 delete_all;
654} __packed;
655
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200656#define HCI_MAX_NAME_LENGTH 248
657
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200658#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
659struct hci_cp_write_local_name {
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200660 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300661} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200662
663#define HCI_OP_READ_LOCAL_NAME 0x0c14
664struct hci_rp_read_local_name {
665 __u8 status;
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200666 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300667} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200668
669#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
670
671#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
672
Andrei Emeltchenko70f230202010-12-01 16:58:25 +0200673#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200674 #define SCAN_DISABLED 0x00
675 #define SCAN_INQUIRY 0x01
676 #define SCAN_PAGE 0x02
677
678#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
679
680#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
681 #define AUTH_DISABLED 0x00
682 #define AUTH_ENABLED 0x01
683
684#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
685
686#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
687 #define ENCRYPT_DISABLED 0x00
688 #define ENCRYPT_P2P 0x01
689 #define ENCRYPT_BOTH 0x02
690
691#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
692struct hci_rp_read_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 __u8 status;
694 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300695} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200697#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
698struct hci_cp_write_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300700} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200702#define HCI_OP_READ_VOICE_SETTING 0x0c25
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703struct hci_rp_read_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800704 __u8 status;
705 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300706} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700707
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200708#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709struct hci_cp_write_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800710 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300711} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200713#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800715 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800717 __le16 acl_max_pkt;
718 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300719} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720
Johan Hedbergd5859e22011-01-25 01:19:58 +0200721#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
722
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300723#define HCI_MAX_EIR_LENGTH 240
724
725#define HCI_OP_WRITE_EIR 0x0c52
726struct hci_cp_write_eir {
Gustavo F. Padovanf64b9932012-03-06 23:48:33 -0300727 __u8 fec;
728 __u8 data[HCI_MAX_EIR_LENGTH];
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300729} __packed;
730
Marcel Holtmann333140b2008-07-14 20:13:48 +0200731#define HCI_OP_READ_SSP_MODE 0x0c55
732struct hci_rp_read_ssp_mode {
733 __u8 status;
734 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300735} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200736
737#define HCI_OP_WRITE_SSP_MODE 0x0c56
738struct hci_cp_write_ssp_mode {
739 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300740} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200741
Szymon Jancc35938b2011-03-22 13:12:21 +0100742#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
743struct hci_rp_read_local_oob_data {
744 __u8 status;
745 __u8 hash[16];
746 __u8 randomizer[16];
747} __packed;
748
Johan Hedbergd5859e22011-01-25 01:19:58 +0200749#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
Marcel Holtmann91c4e9b2012-03-11 19:27:21 -0700750struct hci_rp_read_inq_rsp_tx_power {
751 __u8 status;
752 __s8 tx_power;
753} __packed;
Johan Hedbergd5859e22011-01-25 01:19:58 +0200754
Andrei Emeltchenko1e89cff2011-11-24 14:52:02 +0200755#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
756struct hci_rp_read_flow_control_mode {
757 __u8 status;
758 __u8 mode;
759} __packed;
760
Andre Guedesf9b49302011-06-30 19:20:53 -0300761#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
762struct hci_cp_write_le_host_supported {
Gustavo F. Padovanf64b9932012-03-06 23:48:33 -0300763 __u8 le;
764 __u8 simul;
Andre Guedesf9b49302011-06-30 19:20:53 -0300765} __packed;
766
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200767#define HCI_OP_READ_LOCAL_VERSION 0x1001
768struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200770 __u8 hci_ver;
771 __le16 hci_rev;
772 __u8 lmp_ver;
773 __le16 manufacturer;
774 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300775} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200777#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
778struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200780 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300781} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200783#define HCI_OP_READ_LOCAL_FEATURES 0x1003
784struct hci_rp_read_local_features {
785 __u8 status;
786 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300787} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200788
789#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
Andre Guedes971e3a42011-06-30 19:20:52 -0300790struct hci_cp_read_local_ext_features {
791 __u8 page;
792} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200793struct hci_rp_read_local_ext_features {
794 __u8 status;
795 __u8 page;
796 __u8 max_page;
797 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300798} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200799
800#define HCI_OP_READ_BUFFER_SIZE 0x1005
801struct hci_rp_read_buffer_size {
802 __u8 status;
803 __le16 acl_mtu;
804 __u8 sco_mtu;
805 __le16 acl_max_pkt;
806 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300807} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200808
809#define HCI_OP_READ_BD_ADDR 0x1009
810struct hci_rp_read_bd_addr {
811 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300813} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814
Andrei Emeltchenko350ee4c2011-12-07 15:56:51 +0200815#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
816struct hci_rp_read_data_block_size {
817 __u8 status;
818 __le16 max_acl_len;
819 __le16 block_len;
820 __le16 num_blocks;
821} __packed;
822
Antti Julkuf6422ec2011-06-22 13:11:56 +0300823#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
824struct hci_cp_write_page_scan_activity {
825 __le16 interval;
826 __le16 window;
827} __packed;
828
829#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
830 #define PAGE_SCAN_TYPE_STANDARD 0x00
831 #define PAGE_SCAN_TYPE_INTERLACED 0x01
832
Andrei Emeltchenko928abaa2011-10-12 10:53:57 +0300833#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
834struct hci_rp_read_local_amp_info {
835 __u8 status;
836 __u8 amp_status;
837 __le32 total_bw;
838 __le32 max_bw;
839 __le32 min_latency;
840 __le32 max_pdu;
841 __u8 amp_type;
842 __le16 pal_cap;
843 __le16 max_assoc_size;
844 __le32 max_flush_to;
845 __le32 be_flush_to;
846} __packed;
847
Andrei Emeltchenko523e93c2012-05-25 15:09:26 +0300848#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
849struct hci_cp_read_local_amp_assoc {
850 __u8 phy_handle;
851 __le16 len_so_far;
852 __le16 max_len;
853} __packed;
854struct hci_rp_read_local_amp_assoc {
855 __u8 status;
856 __u8 phy_handle;
857 __le16 rem_len;
858 __u8 frag[0];
859} __packed;
860
861#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
862struct hci_cp_write_remote_amp_assoc {
863 __u8 phy_handle;
864 __le16 len_so_far;
865 __le16 rem_len;
866 __u8 frag[0];
867} __packed;
868struct hci_rp_write_remote_amp_assoc {
869 __u8 status;
870 __u8 phy_handle;
871} __packed;
872
Ville Tervo63185f62011-02-10 22:38:46 -0300873#define HCI_OP_LE_SET_EVENT_MASK 0x2001
874struct hci_cp_le_set_event_mask {
875 __u8 mask[8];
876} __packed;
877
878#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
879struct hci_rp_le_read_buffer_size {
880 __u8 status;
881 __le16 le_mtu;
882 __u8 le_max_pkt;
883} __packed;
884
Andre Guedes07f7fa52011-12-02 21:13:31 +0900885#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
886struct hci_cp_le_set_scan_param {
887 __u8 type;
888 __le16 interval;
889 __le16 window;
890 __u8 own_address_type;
891 __u8 filter_policy;
892} __packed;
893
Andrei Emeltchenko68a8aea2011-12-19 16:14:18 +0200894#define LE_SCANNING_DISABLED 0x00
895#define LE_SCANNING_ENABLED 0x01
896
Andre Guedeseb9d91f2011-05-26 16:23:52 -0300897#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
898struct hci_cp_le_set_scan_enable {
899 __u8 enable;
900 __u8 filter_dup;
901} __packed;
902
Ville Tervo63185f62011-02-10 22:38:46 -0300903#define HCI_OP_LE_CREATE_CONN 0x200d
904struct hci_cp_le_create_conn {
905 __le16 scan_interval;
906 __le16 scan_window;
907 __u8 filter_policy;
908 __u8 peer_addr_type;
909 bdaddr_t peer_addr;
910 __u8 own_address_type;
911 __le16 conn_interval_min;
912 __le16 conn_interval_max;
913 __le16 conn_latency;
914 __le16 supervision_timeout;
915 __le16 min_ce_len;
916 __le16 max_ce_len;
917} __packed;
918
919#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
920
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200921#define HCI_OP_LE_CONN_UPDATE 0x2013
922struct hci_cp_le_conn_update {
923 __le16 handle;
924 __le16 conn_interval_min;
925 __le16 conn_interval_max;
926 __le16 conn_latency;
927 __le16 supervision_timeout;
928 __le16 min_ce_len;
929 __le16 max_ce_len;
930} __packed;
931
Vinicius Costa Gomesa7a595f2011-06-09 18:50:47 -0300932#define HCI_OP_LE_START_ENC 0x2019
933struct hci_cp_le_start_enc {
934 __le16 handle;
935 __u8 rand[8];
936 __le16 ediv;
937 __u8 ltk[16];
938} __packed;
939
940#define HCI_OP_LE_LTK_REPLY 0x201a
941struct hci_cp_le_ltk_reply {
942 __le16 handle;
943 __u8 ltk[16];
944} __packed;
945struct hci_rp_le_ltk_reply {
946 __u8 status;
947 __le16 handle;
948} __packed;
949
950#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
951struct hci_cp_le_ltk_neg_reply {
952 __le16 handle;
953} __packed;
954struct hci_rp_le_ltk_neg_reply {
955 __u8 status;
956 __le16 handle;
957} __packed;
958
Linus Torvalds1da177e2005-04-16 15:20:36 -0700959/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200960#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -0700961
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200962#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -0700963struct inquiry_info {
964 bdaddr_t bdaddr;
965 __u8 pscan_rep_mode;
966 __u8 pscan_period_mode;
967 __u8 pscan_mode;
968 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800969 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300970} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700971
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200972#define HCI_EV_CONN_COMPLETE 0x03
973struct hci_ev_conn_complete {
974 __u8 status;
975 __le16 handle;
976 bdaddr_t bdaddr;
977 __u8 link_type;
978 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300979} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200980
981#define HCI_EV_CONN_REQUEST 0x04
982struct hci_ev_conn_request {
983 bdaddr_t bdaddr;
984 __u8 dev_class[3];
985 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300986} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200987
988#define HCI_EV_DISCONN_COMPLETE 0x05
989struct hci_ev_disconn_complete {
990 __u8 status;
991 __le16 handle;
992 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300993} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200994
995#define HCI_EV_AUTH_COMPLETE 0x06
996struct hci_ev_auth_complete {
997 __u8 status;
998 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300999} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001000
1001#define HCI_EV_REMOTE_NAME 0x07
1002struct hci_ev_remote_name {
1003 __u8 status;
1004 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001005 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001006} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001007
1008#define HCI_EV_ENCRYPT_CHANGE 0x08
1009struct hci_ev_encrypt_change {
1010 __u8 status;
1011 __le16 handle;
1012 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001013} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001014
1015#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1016struct hci_ev_change_link_key_complete {
1017 __u8 status;
1018 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001019} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001020
1021#define HCI_EV_REMOTE_FEATURES 0x0b
1022struct hci_ev_remote_features {
1023 __u8 status;
1024 __le16 handle;
1025 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001026} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001027
1028#define HCI_EV_REMOTE_VERSION 0x0c
1029struct hci_ev_remote_version {
1030 __u8 status;
1031 __le16 handle;
1032 __u8 lmp_ver;
1033 __le16 manufacturer;
1034 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001035} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001036
1037#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1038struct hci_qos {
1039 __u8 service_type;
1040 __u32 token_rate;
1041 __u32 peak_bandwidth;
1042 __u32 latency;
1043 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001044} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001045struct hci_ev_qos_setup_complete {
1046 __u8 status;
1047 __le16 handle;
1048 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001049} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001050
1051#define HCI_EV_CMD_COMPLETE 0x0e
1052struct hci_ev_cmd_complete {
1053 __u8 ncmd;
1054 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001055} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001056
1057#define HCI_EV_CMD_STATUS 0x0f
1058struct hci_ev_cmd_status {
1059 __u8 status;
1060 __u8 ncmd;
1061 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001062} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001063
1064#define HCI_EV_ROLE_CHANGE 0x12
1065struct hci_ev_role_change {
1066 __u8 status;
1067 bdaddr_t bdaddr;
1068 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001069} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001070
1071#define HCI_EV_NUM_COMP_PKTS 0x13
Andrei Emeltchenko613a1c02011-12-19 16:31:30 +02001072struct hci_comp_pkts_info {
1073 __le16 handle;
1074 __le16 count;
1075} __packed;
1076
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001077struct hci_ev_num_comp_pkts {
1078 __u8 num_hndl;
Andrei Emeltchenko613a1c02011-12-19 16:31:30 +02001079 struct hci_comp_pkts_info handles[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001080} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001081
1082#define HCI_EV_MODE_CHANGE 0x14
1083struct hci_ev_mode_change {
1084 __u8 status;
1085 __le16 handle;
1086 __u8 mode;
1087 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001088} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001089
1090#define HCI_EV_PIN_CODE_REQ 0x16
1091struct hci_ev_pin_code_req {
1092 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001093} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001094
1095#define HCI_EV_LINK_KEY_REQ 0x17
1096struct hci_ev_link_key_req {
1097 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001098} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001099
1100#define HCI_EV_LINK_KEY_NOTIFY 0x18
1101struct hci_ev_link_key_notify {
1102 bdaddr_t bdaddr;
Andrei Emeltchenko9b3b4462012-05-23 11:31:20 +03001103 __u8 link_key[HCI_LINK_KEY_SIZE];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001104 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001105} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001106
1107#define HCI_EV_CLOCK_OFFSET 0x1c
1108struct hci_ev_clock_offset {
1109 __u8 status;
1110 __le16 handle;
1111 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001112} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001113
Marcel Holtmanna8746412008-07-14 20:13:46 +02001114#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1115struct hci_ev_pkt_type_change {
1116 __u8 status;
1117 __le16 handle;
1118 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001119} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001120
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001121#define HCI_EV_PSCAN_REP_MODE 0x20
1122struct hci_ev_pscan_rep_mode {
1123 bdaddr_t bdaddr;
1124 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001125} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001126
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1128struct inquiry_info_with_rssi {
1129 bdaddr_t bdaddr;
1130 __u8 pscan_rep_mode;
1131 __u8 pscan_period_mode;
1132 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001133 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001135} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001136struct inquiry_info_with_rssi_and_pscan_mode {
1137 bdaddr_t bdaddr;
1138 __u8 pscan_rep_mode;
1139 __u8 pscan_period_mode;
1140 __u8 pscan_mode;
1141 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001142 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001143 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001144} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001146#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1147struct hci_ev_remote_ext_features {
1148 __u8 status;
1149 __le16 handle;
1150 __u8 page;
1151 __u8 max_page;
1152 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001153} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001154
1155#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1156struct hci_ev_sync_conn_complete {
1157 __u8 status;
1158 __le16 handle;
1159 bdaddr_t bdaddr;
1160 __u8 link_type;
1161 __u8 tx_interval;
1162 __u8 retrans_window;
1163 __le16 rx_pkt_len;
1164 __le16 tx_pkt_len;
1165 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001166} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001167
1168#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1169struct hci_ev_sync_conn_changed {
1170 __u8 status;
1171 __le16 handle;
1172 __u8 tx_interval;
1173 __u8 retrans_window;
1174 __le16 rx_pkt_len;
1175 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001176} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001177
1178#define HCI_EV_SNIFF_SUBRATE 0x2e
1179struct hci_ev_sniff_subrate {
1180 __u8 status;
1181 __le16 handle;
1182 __le16 max_tx_latency;
1183 __le16 max_rx_latency;
1184 __le16 max_remote_timeout;
1185 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001186} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001187
1188#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001189struct extended_inquiry_info {
1190 bdaddr_t bdaddr;
1191 __u8 pscan_rep_mode;
1192 __u8 pscan_period_mode;
1193 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001194 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001195 __s8 rssi;
1196 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001197} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001198
Johan Hedberg1c2e0042012-06-08 23:31:13 +08001199#define HCI_EV_KEY_REFRESH_COMPLETE 0x30
1200struct hci_ev_key_refresh_complete {
1201 __u8 status;
1202 __le16 handle;
1203} __packed;
1204
Marcel Holtmann04936842008-07-14 20:13:48 +02001205#define HCI_EV_IO_CAPA_REQUEST 0x31
1206struct hci_ev_io_capa_request {
1207 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001208} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001209
Johan Hedberg03b555e2011-01-04 15:40:05 +02001210#define HCI_EV_IO_CAPA_REPLY 0x32
1211struct hci_ev_io_capa_reply {
1212 bdaddr_t bdaddr;
1213 __u8 capability;
1214 __u8 oob_data;
1215 __u8 authentication;
1216} __packed;
1217
Johan Hedberga5c29682011-02-19 12:05:57 -03001218#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1219struct hci_ev_user_confirm_req {
1220 bdaddr_t bdaddr;
1221 __le32 passkey;
1222} __packed;
1223
Brian Gix9ad40192011-11-12 22:01:11 -08001224#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1225struct hci_ev_user_passkey_req {
1226 bdaddr_t bdaddr;
1227} __packed;
1228
Szymon Janc2763eda2011-03-22 13:12:22 +01001229#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1230struct hci_ev_remote_oob_data_request {
1231 bdaddr_t bdaddr;
1232} __packed;
1233
Marcel Holtmann04936842008-07-14 20:13:48 +02001234#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1235struct hci_ev_simple_pair_complete {
1236 __u8 status;
1237 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001238} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001239
Marcel Holtmann41a96212008-07-14 20:13:48 +02001240#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1241struct hci_ev_remote_host_features {
1242 bdaddr_t bdaddr;
1243 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001244} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001245
Ville Tervo63185f62011-02-10 22:38:46 -03001246#define HCI_EV_LE_META 0x3e
1247struct hci_ev_le_meta {
1248 __u8 subevent;
1249} __packed;
1250
Andrei Emeltchenko523e93c2012-05-25 15:09:26 +03001251#define HCI_EV_PHY_LINK_COMPLETE 0x40
1252struct hci_ev_phy_link_complete {
1253 __u8 status;
1254 __u8 phy_handle;
1255} __packed;
1256
1257#define HCI_EV_CHANNEL_SELECTED 0x41
1258struct hci_ev_channel_selected {
1259 __u8 phy_handle;
1260} __packed;
1261
1262#define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42
1263struct hci_ev_disconn_phy_link_complete {
1264 __u8 status;
1265 __u8 phy_handle;
1266 __u8 reason;
1267} __packed;
1268
1269#define HCI_EV_LOGICAL_LINK_COMPLETE 0x45
1270struct hci_ev_logical_link_complete {
1271 __u8 status;
1272 __le16 handle;
1273 __u8 phy_handle;
1274 __u8 flow_spec_id;
1275} __packed;
1276
1277#define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46
1278struct hci_ev_disconn_logical_link_complete {
1279 __u8 status;
1280 __le16 handle;
1281 __u8 reason;
1282} __packed;
1283
Andrei Emeltchenko25e89e92012-01-04 12:41:58 +02001284#define HCI_EV_NUM_COMP_BLOCKS 0x48
1285struct hci_comp_blocks_info {
1286 __le16 handle;
1287 __le16 pkts;
1288 __le16 blocks;
1289} __packed;
1290
1291struct hci_ev_num_comp_blocks {
1292 __le16 num_blocks;
1293 __u8 num_hndl;
1294 struct hci_comp_blocks_info handles[0];
1295} __packed;
1296
Ville Tervo63185f62011-02-10 22:38:46 -03001297/* Low energy meta events */
1298#define HCI_EV_LE_CONN_COMPLETE 0x01
1299struct hci_ev_le_conn_complete {
1300 __u8 status;
1301 __le16 handle;
1302 __u8 role;
1303 __u8 bdaddr_type;
1304 bdaddr_t bdaddr;
1305 __le16 interval;
1306 __le16 latency;
1307 __le16 supervision_timeout;
1308 __u8 clk_accurancy;
1309} __packed;
1310
Vinicius Costa Gomesa7a595f2011-06-09 18:50:47 -03001311#define HCI_EV_LE_LTK_REQ 0x05
1312struct hci_ev_le_ltk_req {
1313 __le16 handle;
1314 __u8 random[8];
1315 __le16 ediv;
1316} __packed;
1317
Anderson Briglia57a56fd2011-05-26 16:23:49 -03001318/* Advertising report event types */
1319#define ADV_IND 0x00
1320#define ADV_DIRECT_IND 0x01
1321#define ADV_SCAN_IND 0x02
1322#define ADV_NONCONN_IND 0x03
1323#define ADV_SCAN_RSP 0x04
1324
1325#define ADDR_LE_DEV_PUBLIC 0x00
1326#define ADDR_LE_DEV_RANDOM 0x01
1327
1328#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1329struct hci_ev_le_advertising_info {
1330 __u8 evt_type;
1331 __u8 bdaddr_type;
1332 bdaddr_t bdaddr;
1333 __u8 length;
1334 __u8 data[0];
1335} __packed;
1336
Linus Torvalds1da177e2005-04-16 15:20:36 -07001337/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001338#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001339struct hci_ev_stack_internal {
1340 __u16 type;
1341 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001342} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001343
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001344#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001345struct hci_ev_si_device {
1346 __u16 event;
1347 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001348} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001349
1350#define HCI_EV_SI_SECURITY 0x02
1351struct hci_ev_si_security {
1352 __u16 event;
1353 __u16 proto;
1354 __u16 subproto;
1355 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001356} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001357
1358/* ---- HCI Packet structures ---- */
1359#define HCI_COMMAND_HDR_SIZE 3
1360#define HCI_EVENT_HDR_SIZE 2
1361#define HCI_ACL_HDR_SIZE 4
1362#define HCI_SCO_HDR_SIZE 3
1363
1364struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001365 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001366 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001367} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001368
1369struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001370 __u8 evt;
1371 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001372} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001373
1374struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001375 __le16 handle; /* Handle & Flags(PB, BC) */
1376 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001377} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001378
1379struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001380 __le16 handle;
1381 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001382} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001383
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001384static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1385{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001386 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001387}
1388
1389static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1390{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001391 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001392}
1393
1394static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1395{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001396 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001397}
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001398
Linus Torvalds1da177e2005-04-16 15:20:36 -07001399/* Command opcode pack/unpack */
Gustavo Padovanc3c7ea62012-05-23 04:04:20 -03001400#define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10)))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401#define hci_opcode_ogf(op) (op >> 10)
1402#define hci_opcode_ocf(op) (op & 0x03ff)
1403
1404/* ACL handle and flags pack/unpack */
Gustavo Padovanc3c7ea62012-05-23 04:04:20 -03001405#define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12)))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406#define hci_handle(h) (h & 0x0fff)
1407#define hci_flags(h) (h >> 12)
1408
1409/* ---- HCI Sockets ---- */
1410
1411/* Socket options */
1412#define HCI_DATA_DIR 1
1413#define HCI_FILTER 2
1414#define HCI_TIME_STAMP 3
1415
1416/* CMSG flags */
1417#define HCI_CMSG_DIR 0x0001
1418#define HCI_CMSG_TSTAMP 0x0002
1419
1420struct sockaddr_hci {
1421 sa_family_t hci_family;
1422 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001423 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424};
1425#define HCI_DEV_NONE 0xffff
1426
Johan Hedbergc02178d2010-12-08 00:21:05 +02001427#define HCI_CHANNEL_RAW 0
Marcel Holtmanncd82e612012-02-20 20:34:38 +01001428#define HCI_CHANNEL_MONITOR 2
Gustavo Padovan66f3b912012-03-29 09:47:53 -03001429#define HCI_CHANNEL_CONTROL 3
Johan Hedbergc02178d2010-12-08 00:21:05 +02001430
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431struct hci_filter {
1432 unsigned long type_mask;
1433 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001434 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001435};
1436
1437struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001438 __u32 type_mask;
1439 __u32 event_mask[2];
1440 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001441};
1442
1443#define HCI_FLT_TYPE_BITS 31
1444#define HCI_FLT_EVENT_BITS 63
1445#define HCI_FLT_OGF_BITS 63
1446#define HCI_FLT_OCF_BITS 127
1447
1448/* ---- HCI Ioctl requests structures ---- */
1449struct hci_dev_stats {
1450 __u32 err_rx;
1451 __u32 err_tx;
1452 __u32 cmd_tx;
1453 __u32 evt_rx;
1454 __u32 acl_tx;
1455 __u32 acl_rx;
1456 __u32 sco_tx;
1457 __u32 sco_rx;
1458 __u32 byte_rx;
1459 __u32 byte_tx;
1460};
1461
1462struct hci_dev_info {
1463 __u16 dev_id;
1464 char name[8];
1465
1466 bdaddr_t bdaddr;
1467
1468 __u32 flags;
1469 __u8 type;
1470
1471 __u8 features[8];
1472
1473 __u32 pkt_type;
1474 __u32 link_policy;
1475 __u32 link_mode;
1476
1477 __u16 acl_mtu;
1478 __u16 acl_pkts;
1479 __u16 sco_mtu;
1480 __u16 sco_pkts;
1481
1482 struct hci_dev_stats stat;
1483};
1484
1485struct hci_conn_info {
1486 __u16 handle;
1487 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001488 __u8 type;
1489 __u8 out;
1490 __u16 state;
1491 __u32 link_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492};
1493
1494struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001495 __u16 dev_id;
1496 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001497};
1498
1499struct hci_dev_list_req {
1500 __u16 dev_num;
1501 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1502};
1503
1504struct hci_conn_list_req {
1505 __u16 dev_id;
1506 __u16 conn_num;
1507 struct hci_conn_info conn_info[0];
1508};
1509
1510struct hci_conn_info_req {
1511 bdaddr_t bdaddr;
1512 __u8 type;
1513 struct hci_conn_info conn_info[0];
1514};
1515
Marcel Holtmann40be4922008-07-14 20:13:50 +02001516struct hci_auth_info_req {
1517 bdaddr_t bdaddr;
1518 __u8 type;
1519};
1520
Linus Torvalds1da177e2005-04-16 15:20:36 -07001521struct hci_inquiry_req {
1522 __u16 dev_id;
1523 __u16 flags;
1524 __u8 lap[3];
1525 __u8 length;
1526 __u8 num_rsp;
1527};
1528#define IREQ_CACHE_FLUSH 0x0001
1529
Fabio Estevam8b281b92012-01-10 18:33:50 -02001530extern bool enable_hs;
Andrei Emeltchenko8830f512011-11-11 17:02:14 +02001531
Linus Torvalds1da177e2005-04-16 15:20:36 -07001532#endif /* __HCI_H */