blob: d88448f8451051d8541b77f17bd2b8b02bdd3cfa [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
Duy Truonge833aca2013-02-12 13:35:08 -08003 Copyright (c) 2000-2001, 2010-2012 The Linux Foundation. All rights reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#define HCI_MAX_ACL_SIZE 1500
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#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
33/* HCI dev events */
34#define HCI_DEV_REG 1
35#define HCI_DEV_UNREG 2
36#define HCI_DEV_UP 3
37#define HCI_DEV_DOWN 4
38#define HCI_DEV_SUSPEND 5
39#define HCI_DEV_RESUME 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#define HCI_DEV_WRITE 7
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/* HCI notify events */
43#define HCI_NOTIFY_CONN_ADD 1
44#define HCI_NOTIFY_CONN_DEL 2
45#define HCI_NOTIFY_VOICE_SETTING 3
46
Marcel Holtmannc13854ce2010-02-08 15:27:07 +010047/* HCI bus types */
Marcel Holtmann0ac53932006-07-08 13:57:15 +020048#define HCI_VIRTUAL 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#define HCI_USB 1
50#define HCI_PCCARD 2
51#define HCI_UART 3
52#define HCI_RS232 4
53#define HCI_PCI 5
Marcel Holtmann0ac53932006-07-08 13:57:15 +020054#define HCI_SDIO 6
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#define HCI_SMD 7
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Marcel Holtmann943da252010-02-13 02:28:41 +010057/* HCI controller types */
58#define HCI_BREDR 0x00
David Vrabel8f1e1742010-08-09 17:38:10 -040059#define HCI_AMP 0x01
Marcel Holtmann943da252010-02-13 02:28:41 +010060
Linus Torvalds1da177e2005-04-16 15:20:36 -070061/* HCI device quirks */
62enum {
Marcel Holtmann7a9d4022008-11-30 12:17:26 +010063 HCI_QUIRK_NO_RESET,
Marcel Holtmannda1f5192006-07-03 10:02:29 +020064 HCI_QUIRK_RAW_DEVICE,
65 HCI_QUIRK_FIXUP_BUFFER_SIZE
Linus Torvalds1da177e2005-04-16 15:20:36 -070066};
67
68/* HCI device flags */
69enum {
70 HCI_UP,
71 HCI_INIT,
72 HCI_RUNNING,
73
74 HCI_PSCAN,
75 HCI_ISCAN,
76 HCI_AUTH,
77 HCI_ENCRYPT,
78 HCI_INQUIRY,
79
80 HCI_RAW,
Johan Hedbergab81cbf2010-12-15 13:53:18 +020081
82 HCI_SETUP,
83 HCI_AUTO_OFF,
Johan Hedbergebc99fe2011-01-04 11:54:26 +020084 HCI_MGMT,
Johan Hedbergc542a062011-01-26 13:11:03 +020085 HCI_PAIRABLE,
Johan Hedberg1aff6f02011-01-13 21:56:52 +020086 HCI_SERVICE_CACHE,
Johan Hedberg55ed8ca2011-01-17 14:41:05 +020087 HCI_LINK_KEYS,
88 HCI_DEBUG_KEYS,
Gustavo F. Padovan10572132011-03-16 15:36:29 -030089
90 HCI_RESET,
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
92
93/* HCI ioctl defines */
94#define HCIDEVUP _IOW('H', 201, int)
95#define HCIDEVDOWN _IOW('H', 202, int)
96#define HCIDEVRESET _IOW('H', 203, int)
97#define HCIDEVRESTAT _IOW('H', 204, int)
98
99#define HCIGETDEVLIST _IOR('H', 210, int)
100#define HCIGETDEVINFO _IOR('H', 211, int)
101#define HCIGETCONNLIST _IOR('H', 212, int)
102#define HCIGETCONNINFO _IOR('H', 213, int)
Marcel Holtmann40be4922008-07-14 20:13:50 +0200103#define HCIGETAUTHINFO _IOR('H', 215, int)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104#define HCISETAUTHINFO _IOR('H', 216, int)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106#define HCISETRAW _IOW('H', 220, int)
107#define HCISETSCAN _IOW('H', 221, int)
108#define HCISETAUTH _IOW('H', 222, int)
109#define HCISETENCRYPT _IOW('H', 223, int)
110#define HCISETPTYPE _IOW('H', 224, int)
111#define HCISETLINKPOL _IOW('H', 225, int)
112#define HCISETLINKMODE _IOW('H', 226, int)
113#define HCISETACLMTU _IOW('H', 227, int)
114#define HCISETSCOMTU _IOW('H', 228, int)
115
Johan Hedbergf0358562010-05-18 13:20:32 +0200116#define HCIBLOCKADDR _IOW('H', 230, int)
117#define HCIUNBLOCKADDR _IOW('H', 231, int)
118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119#define HCIINQUIRY _IOR('H', 240, int)
120
121/* HCI timeouts */
Mallikarjuna GBe38d4812013-01-10 23:54:29 +0530122#define HCI_DISCONN_AUTH_FAILED_TIMEOUT (10) /* 10 ms */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200123#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
124#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
Marcel Holtmann052b30b2009-04-26 20:01:22 +0200125#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200126#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
127#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
Brian Gix6e4531c2011-10-28 16:12:08 -0700128#define HCI_CMD_TIMEOUT (5000) /* 5 seconds */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200130/* HCI data types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131#define HCI_COMMAND_PKT 0x01
132#define HCI_ACLDATA_PKT 0x02
133#define HCI_SCODATA_PKT 0x03
134#define HCI_EVENT_PKT 0x04
135#define HCI_VENDOR_PKT 0xff
136
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200137/* HCI packet types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138#define HCI_DM1 0x0008
139#define HCI_DM3 0x0400
140#define HCI_DM5 0x4000
141#define HCI_DH1 0x0010
142#define HCI_DH3 0x0800
143#define HCI_DH5 0x8000
144
145#define HCI_HV1 0x0020
146#define HCI_HV2 0x0040
147#define HCI_HV3 0x0080
148
149#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
150#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
151
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200152/* eSCO packet types */
153#define ESCO_HV1 0x0001
154#define ESCO_HV2 0x0002
155#define ESCO_HV3 0x0004
156#define ESCO_EV3 0x0008
157#define ESCO_EV4 0x0010
158#define ESCO_EV5 0x0020
Marcel Holtmannefc76882009-02-06 09:13:37 +0100159#define ESCO_2EV3 0x0040
160#define ESCO_3EV3 0x0080
161#define ESCO_2EV5 0x0100
162#define ESCO_3EV5 0x0200
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200163
Kun Han Kim15b911f2011-07-08 09:30:28 -0700164#define ESCO_WBS (ESCO_EV3 | (EDR_ESCO_MASK ^ ESCO_2EV3))
165
Nick Pellybbcda3b2010-02-11 11:54:28 -0800166#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
167#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
168#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \
169 EDR_ESCO_MASK)
Marcel Holtmanna8746412008-07-14 20:13:46 +0200170
Kun Han Kim15b911f2011-07-08 09:30:28 -0700171/* Air Coding Format */
172#define ACF_CVSD 0x0000;
173#define ACF_ULAW 0x0001;
174#define ACF_ALAW 0x0002;
175#define ACF_TRANS 0x0003;
176
177/* Retransmission Effort */
178#define RE_NO_RETRANS 0x00;
179#define RE_POWER_CONSUMP 0x01;
180#define RE_LINK_QUALITY 0x02;
181#define RE_DONT_CARE 0xFF;
182
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183/* ACL flags */
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200184#define ACL_START_NO_FLUSH 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185#define ACL_CONT 0x01
186#define ACL_START 0x02
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700187#define ACL_COMPLETE 0x03
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188#define ACL_ACTIVE_BCAST 0x04
189#define ACL_PICO_BCAST 0x08
190
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191#define ACL_PB_MASK (ACL_CONT | ACL_START)
192
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193/* 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 Hedbergd5859e22011-01-25 01:19:58 +0200228#define LMP_LE 0x40
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200229
Marcel Holtmann04837f62006-07-03 10:02:33 +0200230#define LMP_SNIFF_SUBR 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200231#define LMP_PAUSE_ENC 0x04
Marcel Holtmannefc76882009-02-06 09:13:37 +0100232#define LMP_EDR_ESCO_2M 0x20
233#define LMP_EDR_ESCO_3M 0x40
234#define LMP_EDR_3S_ESCO 0x80
Marcel Holtmann04837f62006-07-03 10:02:33 +0200235
Johan Hedbergd5859e22011-01-25 01:19:58 +0200236#define LMP_EXT_INQ 0x01
Marcel Holtmann769be972008-07-14 20:13:49 +0200237#define LMP_SIMPLE_PAIR 0x08
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200238#define LMP_NO_FLUSH 0x40
Marcel Holtmann769be972008-07-14 20:13:49 +0200239
Johan Hedbergd5859e22011-01-25 01:19:58 +0200240#define LMP_LSTO 0x01
241#define LMP_INQ_TX_PWR 0x02
Andre Guedesc006aa02011-06-30 19:20:55 -0300242
Marcel Holtmann04837f62006-07-03 10:02:33 +0200243/* Connection modes */
244#define HCI_CM_ACTIVE 0x0000
245#define HCI_CM_HOLD 0x0001
246#define HCI_CM_SNIFF 0x0002
247#define HCI_CM_PARK 0x0003
248
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249/* Link policies */
250#define HCI_LP_RSWITCH 0x0001
251#define HCI_LP_HOLD 0x0002
252#define HCI_LP_SNIFF 0x0004
253#define HCI_LP_PARK 0x0008
254
Marcel Holtmann04837f62006-07-03 10:02:33 +0200255/* Link modes */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256#define HCI_LM_ACCEPT 0x8000
257#define HCI_LM_MASTER 0x0001
258#define HCI_LM_AUTH 0x0002
259#define HCI_LM_ENCRYPT 0x0004
260#define HCI_LM_TRUSTED 0x0008
261#define HCI_LM_RELIABLE 0x0010
262#define HCI_LM_SECURE 0x0020
263
Marcel Holtmann40be4922008-07-14 20:13:50 +0200264/* Authentication types */
265#define HCI_AT_NO_BONDING 0x00
266#define HCI_AT_NO_BONDING_MITM 0x01
267#define HCI_AT_DEDICATED_BONDING 0x02
268#define HCI_AT_DEDICATED_BONDING_MITM 0x03
269#define HCI_AT_GENERAL_BONDING 0x04
270#define HCI_AT_GENERAL_BONDING_MITM 0x05
271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272/* Flow control modes */
273#define HCI_PACKET_BASED_FLOW_CTL_MODE 0x00
274#define HCI_BLOCK_BASED_FLOW_CTL_MODE 0x01
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200275
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276/* ----- HCI Commands ---- */
Ville Tervo6bd32322011-02-16 16:32:41 +0200277#define HCI_OP_NOP 0x0000
278
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200279#define HCI_OP_INQUIRY 0x0401
280struct hci_cp_inquiry {
281 __u8 lap[3];
282 __u8 length;
283 __u8 num_rsp;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300284} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200286#define HCI_OP_INQUIRY_CANCEL 0x0402
287
288#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
289
290#define HCI_OP_CREATE_CONN 0x0405
291struct hci_cp_create_conn {
292 bdaddr_t bdaddr;
293 __le16 pkt_type;
294 __u8 pscan_rep_mode;
295 __u8 pscan_mode;
296 __le16 clock_offset;
297 __u8 role_switch;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300298} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200300#define HCI_OP_DISCONNECT 0x0406
301struct hci_cp_disconnect {
302 __le16 handle;
303 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300304} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200306#define HCI_OP_ADD_SCO 0x0407
307struct hci_cp_add_sco {
308 __le16 handle;
309 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300310} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200311
312#define HCI_OP_CREATE_CONN_CANCEL 0x0408
313struct hci_cp_create_conn_cancel {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300315} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200317#define HCI_OP_ACCEPT_CONN_REQ 0x0409
318struct hci_cp_accept_conn_req {
319 bdaddr_t bdaddr;
320 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300321} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200323#define HCI_OP_REJECT_CONN_REQ 0x040a
324struct hci_cp_reject_conn_req {
325 bdaddr_t bdaddr;
326 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300327} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200329#define HCI_OP_LINK_KEY_REPLY 0x040b
330struct hci_cp_link_key_reply {
331 bdaddr_t bdaddr;
332 __u8 link_key[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300333} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700335struct hci_rp_link_key_reply {
336 __u8 status;
337 bdaddr_t bdaddr;
338} __packed;
339
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200340#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
341struct hci_cp_link_key_neg_reply {
342 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300343} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200345#define HCI_OP_PIN_CODE_REPLY 0x040d
346struct hci_cp_pin_code_reply {
347 bdaddr_t bdaddr;
348 __u8 pin_len;
349 __u8 pin_code[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300350} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200351struct hci_rp_pin_code_reply {
352 __u8 status;
353 bdaddr_t bdaddr;
354} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200355
356#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
357struct hci_cp_pin_code_neg_reply {
358 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300359} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200360struct hci_rp_pin_code_neg_reply {
361 __u8 status;
362 bdaddr_t bdaddr;
363} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200364
365#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
366struct hci_cp_change_conn_ptype {
367 __le16 handle;
368 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300369} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200370
371#define HCI_OP_AUTH_REQUESTED 0x0411
372struct hci_cp_auth_requested {
373 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300374} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200375
376#define HCI_OP_SET_CONN_ENCRYPT 0x0413
377struct hci_cp_set_conn_encrypt {
378 __le16 handle;
379 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300380} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200381
382#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
383struct hci_cp_change_conn_link_key {
384 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300385} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200386
387#define HCI_OP_REMOTE_NAME_REQ 0x0419
388struct hci_cp_remote_name_req {
389 bdaddr_t bdaddr;
390 __u8 pscan_rep_mode;
391 __u8 pscan_mode;
392 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300393} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200394
395#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
396struct hci_cp_remote_name_req_cancel {
397 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300398} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200399
400#define HCI_OP_READ_REMOTE_FEATURES 0x041b
401struct hci_cp_read_remote_features {
402 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300403} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200404
405#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
406struct hci_cp_read_remote_ext_features {
407 __le16 handle;
408 __u8 page;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300409} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200410
411#define HCI_OP_READ_REMOTE_VERSION 0x041d
412struct hci_cp_read_remote_version {
413 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300414} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200415
Mallikarjuna GB8e71da12012-11-21 17:01:05 +0530416#define HCI_OP_READ_CLOCK_OFFSET 0x041f
417struct hci_cp_read_clock_offset {
418 __le16 handle;
419} __packed;
420
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200421#define HCI_OP_SETUP_SYNC_CONN 0x0428
422struct hci_cp_setup_sync_conn {
423 __le16 handle;
424 __le32 tx_bandwidth;
425 __le32 rx_bandwidth;
426 __le16 max_latency;
427 __le16 voice_setting;
428 __u8 retrans_effort;
429 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300430} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200431
432#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
433struct hci_cp_accept_sync_conn_req {
434 bdaddr_t bdaddr;
435 __le32 tx_bandwidth;
436 __le32 rx_bandwidth;
437 __le16 max_latency;
438 __le16 content_format;
439 __u8 retrans_effort;
440 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300441} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200442
443#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
444struct hci_cp_reject_sync_conn_req {
445 bdaddr_t bdaddr;
446 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300447} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200448
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200449#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
450struct hci_cp_io_capability_reply {
451 bdaddr_t bdaddr;
452 __u8 capability;
453 __u8 oob_data;
454 __u8 authentication;
455} __packed;
456
Johan Hedberga5c29682011-02-19 12:05:57 -0300457#define HCI_OP_USER_CONFIRM_REPLY 0x042c
458struct hci_cp_user_confirm_reply {
459 bdaddr_t bdaddr;
460} __packed;
461struct hci_rp_user_confirm_reply {
462 __u8 status;
463 bdaddr_t bdaddr;
464} __packed;
465
466#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
467
Szymon Janc2763eda2011-03-22 13:12:22 +0100468#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
469struct hci_cp_remote_oob_data_reply {
470 bdaddr_t bdaddr;
471 __u8 hash[16];
472 __u8 randomizer[16];
473} __packed;
474
475#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
476struct hci_cp_remote_oob_data_neg_reply {
477 bdaddr_t bdaddr;
478} __packed;
479
Johan Hedberg03b555e2011-01-04 15:40:05 +0200480#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
481struct hci_cp_io_capability_neg_reply {
482 bdaddr_t bdaddr;
483 __u8 reason;
484} __packed;
485
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700486#define HCI_OP_CREATE_PHYS_LINK 0x0435
487struct hci_cp_create_phys_link {
488 __u8 phy_handle;
489 __u8 key_len;
490 __u8 type;
491 __u8 data[32];
492} __packed;
493
494#define HCI_OP_ACCEPT_PHYS_LINK 0x0436
495struct hci_cp_accept_phys_link {
496 __u8 phy_handle;
497 __u8 key_len;
498 __u8 type;
499 __u8 data[32];
500} __packed;
501
502#define HCI_OP_DISCONN_PHYS_LINK 0x0437
503struct hci_cp_disconn_phys_link {
504 __u8 phy_handle;
505 __u8 reason;
506} __packed;
507
508struct hci_ext_fs {
509 __u8 id;
510 __u8 type;
511 __le16 max_sdu;
512 __le32 sdu_arr_time;
513 __le32 acc_latency;
514 __le32 flush_to;
515} __packed;
516
517#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
518#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
519struct hci_cp_create_logical_link {
520 __u8 phy_handle;
521 struct hci_ext_fs tx_fs;
522 struct hci_ext_fs rx_fs;
523} __packed;
524
525#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
526struct hci_cp_disconn_logical_link {
527 __le16 log_handle;
528} __packed;
529
530#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
531struct hci_cp_logical_link_cancel {
532 __u8 phy_handle;
533 __u8 flow_spec_id;
534} __packed;
535
536struct hci_rp_logical_link_cancel {
537 __u8 status;
538 __u8 phy_handle;
539 __u8 flow_spec_id;
540} __packed;
541
542#define HCI_OP_FLOW_SPEC_MODIFY 0x043c
543struct hci_cp_flow_spec_modify {
544 __le16 log_handle;
545 struct hci_ext_fs tx_fs;
546 struct hci_ext_fs rx_fs;
547} __packed;
548
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200549#define HCI_OP_SNIFF_MODE 0x0803
550struct hci_cp_sniff_mode {
551 __le16 handle;
552 __le16 max_interval;
553 __le16 min_interval;
554 __le16 attempt;
555 __le16 timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300556} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200557
558#define HCI_OP_EXIT_SNIFF_MODE 0x0804
559struct hci_cp_exit_sniff_mode {
560 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300561} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200562
563#define HCI_OP_ROLE_DISCOVERY 0x0809
564struct hci_cp_role_discovery {
565 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300566} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200567struct hci_rp_role_discovery {
568 __u8 status;
569 __le16 handle;
570 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300571} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200572
573#define HCI_OP_SWITCH_ROLE 0x080b
574struct hci_cp_switch_role {
575 bdaddr_t bdaddr;
576 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300577} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200578
579#define HCI_OP_READ_LINK_POLICY 0x080c
580struct hci_cp_read_link_policy {
581 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300582} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200583struct hci_rp_read_link_policy {
584 __u8 status;
585 __le16 handle;
586 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300587} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200588
589#define HCI_OP_WRITE_LINK_POLICY 0x080d
590struct hci_cp_write_link_policy {
591 __le16 handle;
592 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300593} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200594struct hci_rp_write_link_policy {
595 __u8 status;
596 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300597} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200598
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200599#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
600struct hci_rp_read_def_link_policy {
601 __u8 status;
602 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300603} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200604
605#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
606struct hci_cp_write_def_link_policy {
607 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300608} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200609
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200610#define HCI_OP_SNIFF_SUBRATE 0x0811
611struct hci_cp_sniff_subrate {
612 __le16 handle;
613 __le16 max_latency;
614 __le16 min_remote_timeout;
615 __le16 min_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300616} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200617
618#define HCI_OP_SET_EVENT_MASK 0x0c01
619struct hci_cp_set_event_mask {
620 __u8 mask[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300621} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200622
623#define HCI_OP_RESET 0x0c03
624
625#define HCI_OP_SET_EVENT_FLT 0x0c05
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626struct hci_cp_set_event_flt {
627 __u8 flt_type;
628 __u8 cond_type;
629 __u8 condition[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300630} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631
632/* Filter types */
633#define HCI_FLT_CLEAR_ALL 0x00
634#define HCI_FLT_INQ_RESULT 0x01
635#define HCI_FLT_CONN_SETUP 0x02
636
637/* CONN_SETUP Condition types */
638#define HCI_CONN_SETUP_ALLOW_ALL 0x00
639#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
640#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
641
642/* CONN_SETUP Conditions */
643#define HCI_CONN_SETUP_AUTO_OFF 0x01
644#define HCI_CONN_SETUP_AUTO_ON 0x02
645
Johan Hedbergb0916ea2011-01-10 13:44:55 +0200646#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
647struct hci_cp_delete_stored_link_key {
648 bdaddr_t bdaddr;
649 __u8 delete_all;
650} __packed;
651
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200652#define HCI_MAX_NAME_LENGTH 248
653
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200654#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
655struct hci_cp_write_local_name {
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200656 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300657} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200658
659#define HCI_OP_READ_LOCAL_NAME 0x0c14
660struct hci_rp_read_local_name {
661 __u8 status;
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200662 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300663} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200664
665#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
666
667#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
668
Andrei Emeltchenko70f230202010-12-01 16:58:25 +0200669#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200670 #define SCAN_DISABLED 0x00
671 #define SCAN_INQUIRY 0x01
672 #define SCAN_PAGE 0x02
673
674#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
675
676#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
677 #define AUTH_DISABLED 0x00
678 #define AUTH_ENABLED 0x01
679
680#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
681
682#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
683 #define ENCRYPT_DISABLED 0x00
684 #define ENCRYPT_P2P 0x01
685 #define ENCRYPT_BOTH 0x02
686
687#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
688struct hci_rp_read_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 __u8 status;
690 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300691} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200693#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
694struct hci_cp_write_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300696} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700697
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200698#define HCI_OP_READ_VOICE_SETTING 0x0c25
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699struct hci_rp_read_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800700 __u8 status;
701 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300702} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200704#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705struct hci_cp_write_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800706 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300707} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
Srinivas Krovvidi10734192011-12-29 07:29:11 +0530709#define HCI_OP_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0c28
710struct hci_cp_write_automatic_flush_timeout {
711 __le16 handle;
712 __le16 timeout;
713} __packed;
714
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200715#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800717 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800719 __le16 acl_max_pkt;
720 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300721} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722
Brian Gix8a7f1642011-10-17 17:39:46 -0700723#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
724struct hci_cp_write_current_iac_lap {
725 __u8 num_current_iac;
726 __u8 lap[6];
727} __packed;
728
Johan Hedbergd5859e22011-01-25 01:19:58 +0200729#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
730
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300731#define HCI_MAX_EIR_LENGTH 240
732
733#define HCI_OP_WRITE_EIR 0x0c52
734struct hci_cp_write_eir {
735 uint8_t fec;
736 uint8_t data[HCI_MAX_EIR_LENGTH];
737} __packed;
738
Marcel Holtmann333140b2008-07-14 20:13:48 +0200739#define HCI_OP_READ_SSP_MODE 0x0c55
740struct hci_rp_read_ssp_mode {
741 __u8 status;
742 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300743} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200744
745#define HCI_OP_WRITE_SSP_MODE 0x0c56
746struct hci_cp_write_ssp_mode {
747 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300748} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200749
Szymon Jancc35938b2011-03-22 13:12:21 +0100750#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
751struct hci_rp_read_local_oob_data {
752 __u8 status;
753 __u8 hash[16];
754 __u8 randomizer[16];
755} __packed;
756
Johan Hedbergd5859e22011-01-25 01:19:58 +0200757#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
758
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700759#define HCI_OP_READ_LL_TIMEOUT 0x0c61
760struct hci_rp_read_ll_timeout {
761 __u8 status;
762 __le16 timeout;
763} __packed;
764
765#define HCI_OP_WRITE_LL_TIMEOUT 0x0c62
766struct hci_cp_write_ll_timeout {
767 __le16 timeout;
768} __packed;
769
770#define HCI_OP_SET_EVENT_MASK_PAGE2 0x0c63
771struct hci_cp_set_event_mask_page2 {
772 __u8 mask[8];
773} __packed;
774
775#define HCI_OP_READ_LOCATION_DATA 0x0c64
776struct hci_rp_read_location_data {
777 __u8 status;
778 __u8 loc_dom_aware;
779 __u8 loc_dom;
780 __u8 loc_dom_opts;
781 __u8 loc_opts;
782} __packed;
783
784#define HCI_OP_WRITE_LOCATION_DATA 0x0c65
785struct hci_cp_write_location_data {
786 __u8 loc_dom_aware;
787 __u8 loc_dom;
788 __u8 loc_dom_opts;
789 __u8 loc_opts;
790} __packed;
791
792#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
793struct hci_rp_read_flow_control_mode {
794 __u8 status;
795 __u8 mode;
796} __packed;
797
798#define HCI_OP_WRITE_FLOW_CONTROL_MODE 0x0c67
799struct hci_cp_write_flow_control_mode {
800 __u8 mode;
801} __packed;
802
803#define HCI_OP_READ_BE_FLUSH_TIMEOUT 0x0c69
804struct hci_cp_read_be_flush_timeout {
805 __le16 log_handle;
806} __packed;
807
808struct hci_rp_read_be_flush_timeout {
809 __u8 status;
810 __le32 timeout;
811} __packed;
812
813#define HCI_OP_WRITE_BE_FLUSH_TIMEOUT 0x0c6a
814struct hci_cp_write_be_flush_timeout {
815 __le16 log_handle;
816 __le32 timeout;
817} __packed;
818
819#define HCI_OP_SHORT_RANGE_MODE 0x0c6b
820struct hci_cp_short_range_mode {
821 __u8 phy_handle;
822 __u8 mode;
Andre Guedese326af42011-06-30 19:20:53 -0300823} __packed;
824
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200825#define HCI_OP_READ_LOCAL_VERSION 0x1001
826struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200828 __u8 hci_ver;
829 __le16 hci_rev;
830 __u8 lmp_ver;
831 __le16 manufacturer;
832 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300833} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200835#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
836struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200838 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300839} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200841#define HCI_OP_READ_LOCAL_FEATURES 0x1003
842struct hci_rp_read_local_features {
843 __u8 status;
844 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300845} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200846
847#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
848struct hci_rp_read_local_ext_features {
849 __u8 status;
850 __u8 page;
851 __u8 max_page;
852 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300853} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200854
855#define HCI_OP_READ_BUFFER_SIZE 0x1005
856struct hci_rp_read_buffer_size {
857 __u8 status;
858 __le16 acl_mtu;
859 __u8 sco_mtu;
860 __le16 acl_max_pkt;
861 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300862} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200863
864#define HCI_OP_READ_BD_ADDR 0x1009
865struct hci_rp_read_bd_addr {
866 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300868} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
871struct hci_rp_read_data_block_size {
872 __u8 status;
873 __le16 max_acl_len;
874 __le16 data_block_len;
875 __le16 num_blocks;
876} __packed;
877
Archana Ramachandran26a752b2011-12-20 11:27:40 -0800878#define HCI_OP_READ_RSSI 0x1405
879struct hci_cp_read_rssi {
880 __le16 handle;
881} __packed;
882
883struct hci_rp_read_rssi {
884 __u8 status;
885 __le16 handle;
886 __s8 rssi;
887} __packed;
888
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700889#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
890struct hci_rp_read_local_amp_info {
891 __u8 status;
892 __u8 amp_status;
893 __le32 total_bw;
894 __le32 max_bw;
895 __le32 min_latency;
896 __le32 max_pdu;
897 __u8 amp_type;
898 __le16 pal_cap;
899 __le16 max_assoc_size;
900 __le32 max_flush_to;
901 __le32 be_flush_to;
902} __packed;
903
904#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
905struct hci_cp_read_local_amp_assoc {
906 __u8 phy_handle;
907 __le16 len_so_far;
908 __le16 max_len;
909} __packed;
910
911struct hci_rp_read_local_amp_assoc {
912 __u8 status;
913 __u8 phy_handle;
914 __le16 rem_len;
915 __u8 frag[248];
916} __packed;
917
918#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
919struct hci_cp_write_remote_amp_assoc {
920 __u8 phy_handle;
921 __le16 len_so_far;
922 __le16 rem_len;
923 __u8 frag[248];
924} __packed;
925
926struct hci_rp_write_remote_amp_assoc {
927 __u8 status;
928 __u8 phy_handle;
929} __packed;
930
Ville Tervo63185f62011-02-10 22:38:46 -0300931#define HCI_OP_LE_SET_EVENT_MASK 0x2001
932struct hci_cp_le_set_event_mask {
933 __u8 mask[8];
934} __packed;
935
936#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
937struct hci_rp_le_read_buffer_size {
938 __u8 status;
939 __le16 le_mtu;
940 __u8 le_max_pkt;
941} __packed;
942
Brian Gixa68668b2011-08-11 15:49:36 -0700943#define HCI_OP_LE_SET_SCAN_PARAMETERS 0x200b
944struct hci_cp_le_set_scan_parameters {
945 __u8 type;
946 __le16 interval;
947 __le16 window;
948 __u8 own_bdaddr_type;
949 __u8 filter;
950} __packed;
951
Andre Guedes726e1332011-05-26 16:23:52 -0300952#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
Brian Gixa68668b2011-08-11 15:49:36 -0700953struct hci_cp_le_set_scan_enable {
954 __u8 enable;
955 __u8 filter_dup;
956} __packed;
Andre Guedes726e1332011-05-26 16:23:52 -0300957
Ville Tervo63185f62011-02-10 22:38:46 -0300958#define HCI_OP_LE_CREATE_CONN 0x200d
959struct hci_cp_le_create_conn {
960 __le16 scan_interval;
961 __le16 scan_window;
962 __u8 filter_policy;
963 __u8 peer_addr_type;
964 bdaddr_t peer_addr;
965 __u8 own_address_type;
966 __le16 conn_interval_min;
967 __le16 conn_interval_max;
968 __le16 conn_latency;
969 __le16 supervision_timeout;
970 __le16 min_ce_len;
971 __le16 max_ce_len;
972} __packed;
973
974#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
975
Sunny Kapdi320598f2012-07-30 14:52:56 -0700976#define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200F
977struct hci_rp_le_read_white_list_size {
978 __u8 status;
979 __u8 size;
980} __packed;
981
982#define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010
983
984#define HCI_OP_LE_ADD_DEV_WHITE_LIST 0x2011
985struct hci_cp_le_add_dev_white_list {
986 __u8 addr_type;
987 bdaddr_t addr;
988} __packed;
989
990#define HCI_OP_LE_REMOVE_DEV_WHITE_LIST 0x2012
991struct hci_cp_le_remove_dev_white_list {
992 __u8 addr_type;
993 bdaddr_t addr;
994} __packed;
995
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200996#define HCI_OP_LE_CONN_UPDATE 0x2013
997struct hci_cp_le_conn_update {
998 __le16 handle;
999 __le16 conn_interval_min;
1000 __le16 conn_interval_max;
1001 __le16 conn_latency;
1002 __le16 supervision_timeout;
1003 __le16 min_ce_len;
1004 __le16 max_ce_len;
1005} __packed;
1006
Brian Gixa68668b2011-08-11 15:49:36 -07001007#define HCI_OP_LE_ENCRYPT 0x2017
1008struct hci_cp_le_encrypt {
1009 __u8 key[16];
1010 __u8 data[16];
1011} __packed;
1012struct hci_cp_le_encrypt_reply {
1013 __u8 status;
1014 __u8 encrypted[16];
1015} __packed;
1016
Vinicius Costa Gomes735038c2011-06-09 18:50:47 -03001017#define HCI_OP_LE_START_ENC 0x2019
1018struct hci_cp_le_start_enc {
1019 __le16 handle;
1020 __u8 rand[8];
1021 __le16 ediv;
1022 __u8 ltk[16];
1023} __packed;
1024
1025#define HCI_OP_LE_LTK_REPLY 0x201a
1026struct hci_cp_le_ltk_reply {
1027 __le16 handle;
1028 __u8 ltk[16];
1029} __packed;
1030struct hci_rp_le_ltk_reply {
1031 __u8 status;
1032 __le16 handle;
1033} __packed;
1034
1035#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
1036struct hci_cp_le_ltk_neg_reply {
1037 __le16 handle;
1038} __packed;
1039struct hci_rp_le_ltk_neg_reply {
1040 __u8 status;
1041 __le16 handle;
1042} __packed;
1043
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001045#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001047#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048struct inquiry_info {
1049 bdaddr_t bdaddr;
1050 __u8 pscan_rep_mode;
1051 __u8 pscan_period_mode;
1052 __u8 pscan_mode;
1053 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001054 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001055} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001056
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001057#define HCI_EV_CONN_COMPLETE 0x03
1058struct hci_ev_conn_complete {
1059 __u8 status;
1060 __le16 handle;
1061 bdaddr_t bdaddr;
1062 __u8 link_type;
1063 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001064} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001065
1066#define HCI_EV_CONN_REQUEST 0x04
1067struct hci_ev_conn_request {
1068 bdaddr_t bdaddr;
1069 __u8 dev_class[3];
1070 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001071} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001072
1073#define HCI_EV_DISCONN_COMPLETE 0x05
1074struct hci_ev_disconn_complete {
1075 __u8 status;
1076 __le16 handle;
1077 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001078} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001079
1080#define HCI_EV_AUTH_COMPLETE 0x06
1081struct hci_ev_auth_complete {
1082 __u8 status;
1083 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001084} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001085
1086#define HCI_EV_REMOTE_NAME 0x07
1087struct hci_ev_remote_name {
1088 __u8 status;
1089 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001090 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001091} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001092
1093#define HCI_EV_ENCRYPT_CHANGE 0x08
1094struct hci_ev_encrypt_change {
1095 __u8 status;
1096 __le16 handle;
1097 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001098} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001099
1100#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1101struct hci_ev_change_link_key_complete {
1102 __u8 status;
1103 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001104} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001105
1106#define HCI_EV_REMOTE_FEATURES 0x0b
1107struct hci_ev_remote_features {
1108 __u8 status;
1109 __le16 handle;
1110 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001111} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001112
1113#define HCI_EV_REMOTE_VERSION 0x0c
1114struct hci_ev_remote_version {
1115 __u8 status;
1116 __le16 handle;
1117 __u8 lmp_ver;
1118 __le16 manufacturer;
1119 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001120} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001121
1122#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1123struct hci_qos {
1124 __u8 service_type;
1125 __u32 token_rate;
1126 __u32 peak_bandwidth;
1127 __u32 latency;
1128 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001129} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001130struct hci_ev_qos_setup_complete {
1131 __u8 status;
1132 __le16 handle;
1133 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001134} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001135
1136#define HCI_EV_CMD_COMPLETE 0x0e
1137struct hci_ev_cmd_complete {
1138 __u8 ncmd;
1139 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001140} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001141
1142#define HCI_EV_CMD_STATUS 0x0f
1143struct hci_ev_cmd_status {
1144 __u8 status;
1145 __u8 ncmd;
1146 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001147} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001148
1149#define HCI_EV_ROLE_CHANGE 0x12
1150struct hci_ev_role_change {
1151 __u8 status;
1152 bdaddr_t bdaddr;
1153 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001154} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001155
1156#define HCI_EV_NUM_COMP_PKTS 0x13
1157struct hci_ev_num_comp_pkts {
1158 __u8 num_hndl;
1159 /* variable length part */
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001160} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001161
1162#define HCI_EV_MODE_CHANGE 0x14
1163struct hci_ev_mode_change {
1164 __u8 status;
1165 __le16 handle;
1166 __u8 mode;
1167 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001168} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001169
1170#define HCI_EV_PIN_CODE_REQ 0x16
1171struct hci_ev_pin_code_req {
1172 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001173} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001174
1175#define HCI_EV_LINK_KEY_REQ 0x17
1176struct hci_ev_link_key_req {
1177 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001178} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001179
1180#define HCI_EV_LINK_KEY_NOTIFY 0x18
1181struct hci_ev_link_key_notify {
1182 bdaddr_t bdaddr;
1183 __u8 link_key[16];
1184 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001185} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001186
1187#define HCI_EV_CLOCK_OFFSET 0x1c
1188struct hci_ev_clock_offset {
1189 __u8 status;
1190 __le16 handle;
1191 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001192} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001193
Marcel Holtmanna8746412008-07-14 20:13:46 +02001194#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1195struct hci_ev_pkt_type_change {
1196 __u8 status;
1197 __le16 handle;
1198 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001199} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001200
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001201#define HCI_EV_PSCAN_REP_MODE 0x20
1202struct hci_ev_pscan_rep_mode {
1203 bdaddr_t bdaddr;
1204 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001205} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001206
Linus Torvalds1da177e2005-04-16 15:20:36 -07001207#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1208struct inquiry_info_with_rssi {
1209 bdaddr_t bdaddr;
1210 __u8 pscan_rep_mode;
1211 __u8 pscan_period_mode;
1212 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001213 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001214 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001215} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001216struct inquiry_info_with_rssi_and_pscan_mode {
1217 bdaddr_t bdaddr;
1218 __u8 pscan_rep_mode;
1219 __u8 pscan_period_mode;
1220 __u8 pscan_mode;
1221 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001222 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001223 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001224} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001225
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001226#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1227struct hci_ev_remote_ext_features {
1228 __u8 status;
1229 __le16 handle;
1230 __u8 page;
1231 __u8 max_page;
1232 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001233} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001234
1235#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1236struct hci_ev_sync_conn_complete {
1237 __u8 status;
1238 __le16 handle;
1239 bdaddr_t bdaddr;
1240 __u8 link_type;
1241 __u8 tx_interval;
1242 __u8 retrans_window;
1243 __le16 rx_pkt_len;
1244 __le16 tx_pkt_len;
1245 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001246} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001247
1248#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1249struct hci_ev_sync_conn_changed {
1250 __u8 status;
1251 __le16 handle;
1252 __u8 tx_interval;
1253 __u8 retrans_window;
1254 __le16 rx_pkt_len;
1255 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001256} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001257
1258#define HCI_EV_SNIFF_SUBRATE 0x2e
1259struct hci_ev_sniff_subrate {
1260 __u8 status;
1261 __le16 handle;
1262 __le16 max_tx_latency;
1263 __le16 max_rx_latency;
1264 __le16 max_remote_timeout;
1265 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001266} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001267
1268#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001269struct extended_inquiry_info {
1270 bdaddr_t bdaddr;
1271 __u8 pscan_rep_mode;
1272 __u8 pscan_period_mode;
1273 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001274 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001275 __s8 rssi;
1276 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001277} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001278
Marcel Holtmann04936842008-07-14 20:13:48 +02001279#define HCI_EV_IO_CAPA_REQUEST 0x31
1280struct hci_ev_io_capa_request {
1281 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001282} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001283
Johan Hedberg03b555e2011-01-04 15:40:05 +02001284#define HCI_EV_IO_CAPA_REPLY 0x32
1285struct hci_ev_io_capa_reply {
1286 bdaddr_t bdaddr;
1287 __u8 capability;
1288 __u8 oob_data;
1289 __u8 authentication;
1290} __packed;
1291
Johan Hedberga5c29682011-02-19 12:05:57 -03001292#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1293struct hci_ev_user_confirm_req {
1294 bdaddr_t bdaddr;
1295 __le32 passkey;
1296} __packed;
1297
Brian Gixa68668b2011-08-11 15:49:36 -07001298#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1299struct hci_ev_user_passkey_request {
1300 bdaddr_t bdaddr;
1301} __packed;
1302
Szymon Janc2763eda2011-03-22 13:12:22 +01001303#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1304struct hci_ev_remote_oob_data_request {
1305 bdaddr_t bdaddr;
1306} __packed;
1307
Marcel Holtmann04936842008-07-14 20:13:48 +02001308#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1309struct hci_ev_simple_pair_complete {
1310 __u8 status;
1311 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001312} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001313
Brian Gixa68668b2011-08-11 15:49:36 -07001314#define HCI_EV_USER_PASSKEY_NOTIFICATION 0x3b
1315struct hci_ev_user_passkey_notification {
1316 bdaddr_t bdaddr;
1317 __le32 passkey;
1318} __packed;
1319
Marcel Holtmann41a96212008-07-14 20:13:48 +02001320#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1321struct hci_ev_remote_host_features {
1322 bdaddr_t bdaddr;
1323 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001324} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001325
Ville Tervo63185f62011-02-10 22:38:46 -03001326#define HCI_EV_LE_META 0x3e
1327struct hci_ev_le_meta {
1328 __u8 subevent;
1329} __packed;
1330
1331/* Low energy meta events */
1332#define HCI_EV_LE_CONN_COMPLETE 0x01
1333struct hci_ev_le_conn_complete {
1334 __u8 status;
1335 __le16 handle;
1336 __u8 role;
1337 __u8 bdaddr_type;
1338 bdaddr_t bdaddr;
1339 __le16 interval;
1340 __le16 latency;
1341 __le16 supervision_timeout;
1342 __u8 clk_accurancy;
1343} __packed;
1344
Anderson Briglia1c3cc1182011-05-26 16:23:49 -03001345#define ADV_IND 0x00
1346#define ADV_DIRECT_IND 0x01
1347#define ADV_SCAN_IND 0x02
1348#define ADV_NONCONN_IND 0x03
1349#define ADV_SCAN_RSP 0x04
1350
1351#define ADDR_LE_DEV_PUBLIC 0x00
1352#define ADDR_LE_DEV_RANDOM 0x01
1353
1354#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1355struct hci_ev_le_advertising_info {
1356 __u8 evt_type;
1357 __u8 bdaddr_type;
1358 bdaddr_t bdaddr;
1359 __u8 length;
1360 __u8 data[0];
1361} __packed;
1362
Sunny Kapdia42b5022012-07-05 22:48:31 -07001363#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
1364struct hci_ev_le_conn_update_complete {
1365 __u8 status;
1366 __le16 handle;
1367 __le16 interval;
1368 __le16 latency;
1369 __le16 supervision_timeout;
1370} __packed;
1371
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001372#define HCI_EV_LE_LTK_REQ 0x05
1373struct hci_ev_le_ltk_req {
1374 __le16 handle;
1375 __u8 random[8];
1376 __le16 ediv;
1377} __packed;
1378
1379#define HCI_EV_PHYS_LINK_COMPLETE 0x40
1380struct hci_ev_phys_link_complete {
1381 __u8 status;
1382 __u8 phy_handle;
1383} __packed;
1384
1385#define HCI_EV_CHANNEL_SELECTED 0x41
1386struct hci_ev_channel_selected {
1387 __u8 phy_handle;
1388} __packed;
1389
1390#define HCI_EV_DISCONN_PHYS_LINK_COMPLETE 0x42
1391struct hci_ev_disconn_phys_link_complete {
1392 __u8 status;
1393 __u8 phy_handle;
1394 __u8 reason;
1395} __packed;
1396
1397#define HCI_EV_LOG_LINK_COMPLETE 0x45
1398struct hci_ev_log_link_complete {
1399 __u8 status;
1400 __le16 log_handle;
1401 __u8 phy_handle;
1402 __u8 flow_spec_id;
1403} __packed;
1404
1405#define HCI_EV_DISCONN_LOG_LINK_COMPLETE 0x46
1406struct hci_ev_disconn_log_link_complete {
1407 __u8 status;
1408 __le16 log_handle;
1409 __u8 reason;
1410} __packed;
1411
1412#define HCI_EV_FLOW_SPEC_MODIFY_COMPLETE 0x47
1413struct hci_ev_flow_spec_modify_complete {
1414 __u8 status;
1415 __le16 log_handle;
1416} __packed;
1417
1418#define HCI_EV_NUM_COMP_BLOCKS 0x48
1419struct hci_ev_num_comp_blocks {
1420 __le16 total_num_blocks;
1421 __u8 num_hndl;
1422 /* variable length part */
1423} __packed;
1424
1425#define HCI_EV_SHORT_RANGE_MODE_COMPLETE 0x4c
1426struct hci_ev_short_range_mode_complete {
1427 __u8 status;
1428 __u8 phy_handle;
1429 __u8 mode;
1430} __packed;
1431
1432#define HCI_EV_AMP_STATUS_CHANGE 0x4d
1433struct hci_ev_amp_status_change {
1434 __u8 status;
1435 __u8 amp_status;
1436} __packed;
1437
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001439#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440struct hci_ev_stack_internal {
1441 __u16 type;
1442 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001443} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001445#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446struct hci_ev_si_device {
1447 __u16 event;
1448 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001449} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450
1451#define HCI_EV_SI_SECURITY 0x02
1452struct hci_ev_si_security {
1453 __u16 event;
1454 __u16 proto;
1455 __u16 subproto;
1456 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001457} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458
1459/* ---- HCI Packet structures ---- */
1460#define HCI_COMMAND_HDR_SIZE 3
1461#define HCI_EVENT_HDR_SIZE 2
1462#define HCI_ACL_HDR_SIZE 4
1463#define HCI_SCO_HDR_SIZE 3
1464
1465struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001466 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001467 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001468} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001469
1470struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001471 __u8 evt;
1472 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001473} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474
1475struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001476 __le16 handle; /* Handle & Flags(PB, BC) */
1477 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001478} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479
1480struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001481 __le16 handle;
1482 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001483} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001485#ifdef __KERNEL__
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001486#include <linux/skbuff.h>
1487static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1488{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001489 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001490}
1491
1492static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1493{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001494 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001495}
1496
1497static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1498{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001499 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001500}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001501#endif
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001502
Linus Torvalds1da177e2005-04-16 15:20:36 -07001503/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001504#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001505#define hci_opcode_ogf(op) (op >> 10)
1506#define hci_opcode_ocf(op) (op & 0x03ff)
1507
1508/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001509#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001510#define hci_handle(h) (h & 0x0fff)
1511#define hci_flags(h) (h >> 12)
1512
1513/* ---- HCI Sockets ---- */
1514
1515/* Socket options */
1516#define HCI_DATA_DIR 1
1517#define HCI_FILTER 2
1518#define HCI_TIME_STAMP 3
1519
1520/* CMSG flags */
1521#define HCI_CMSG_DIR 0x0001
1522#define HCI_CMSG_TSTAMP 0x0002
1523
1524struct sockaddr_hci {
1525 sa_family_t hci_family;
1526 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001527 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001528};
1529#define HCI_DEV_NONE 0xffff
1530
Johan Hedbergc02178d2010-12-08 00:21:05 +02001531#define HCI_CHANNEL_RAW 0
1532#define HCI_CHANNEL_CONTROL 1
1533
Linus Torvalds1da177e2005-04-16 15:20:36 -07001534struct hci_filter {
1535 unsigned long type_mask;
1536 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001537 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538};
1539
1540struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001541 __u32 type_mask;
1542 __u32 event_mask[2];
1543 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001544};
1545
1546#define HCI_FLT_TYPE_BITS 31
1547#define HCI_FLT_EVENT_BITS 63
1548#define HCI_FLT_OGF_BITS 63
1549#define HCI_FLT_OCF_BITS 127
1550
1551/* ---- HCI Ioctl requests structures ---- */
1552struct hci_dev_stats {
1553 __u32 err_rx;
1554 __u32 err_tx;
1555 __u32 cmd_tx;
1556 __u32 evt_rx;
1557 __u32 acl_tx;
1558 __u32 acl_rx;
1559 __u32 sco_tx;
1560 __u32 sco_rx;
1561 __u32 byte_rx;
1562 __u32 byte_tx;
1563};
1564
1565struct hci_dev_info {
1566 __u16 dev_id;
1567 char name[8];
1568
1569 bdaddr_t bdaddr;
1570
1571 __u32 flags;
1572 __u8 type;
1573
1574 __u8 features[8];
1575
1576 __u32 pkt_type;
1577 __u32 link_policy;
1578 __u32 link_mode;
1579
1580 __u16 acl_mtu;
1581 __u16 acl_pkts;
1582 __u16 sco_mtu;
1583 __u16 sco_pkts;
1584
1585 struct hci_dev_stats stat;
1586};
1587
1588struct hci_conn_info {
1589 __u16 handle;
1590 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001591 __u8 type;
1592 __u8 out;
1593 __u16 state;
1594 __u32 link_mode;
Nick Pellyc1728492009-12-09 00:15:41 -08001595 __u32 mtu;
1596 __u32 cnt;
1597 __u32 pkts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001598 __u8 pending_sec_level;
1599 __u8 ssp_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001600};
1601
1602struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001603 __u16 dev_id;
1604 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001605};
1606
1607struct hci_dev_list_req {
1608 __u16 dev_num;
1609 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1610};
1611
1612struct hci_conn_list_req {
1613 __u16 dev_id;
1614 __u16 conn_num;
1615 struct hci_conn_info conn_info[0];
1616};
1617
1618struct hci_conn_info_req {
1619 bdaddr_t bdaddr;
1620 __u8 type;
1621 struct hci_conn_info conn_info[0];
1622};
1623
Marcel Holtmann40be4922008-07-14 20:13:50 +02001624struct hci_auth_info_req {
1625 bdaddr_t bdaddr;
1626 __u8 type;
1627};
1628
Linus Torvalds1da177e2005-04-16 15:20:36 -07001629struct hci_inquiry_req {
1630 __u16 dev_id;
1631 __u16 flags;
1632 __u8 lap[3];
1633 __u8 length;
1634 __u8 num_rsp;
1635};
1636#define IREQ_CACHE_FLUSH 0x0001
1637
1638#endif /* __HCI_H */