blob: aa6aeb9d80f61ab90fea9c62b563774f3a335c09 [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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003 Copyright (c) 2000-2001, 2010-2011 Code Aurora Forum. 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 */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200122#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
123#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
Marcel Holtmann052b30b2009-04-26 20:01:22 +0200124#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200125#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
126#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
Ville Tervo6bd32322011-02-16 16:32:41 +0200127#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200129/* HCI data types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130#define HCI_COMMAND_PKT 0x01
131#define HCI_ACLDATA_PKT 0x02
132#define HCI_SCODATA_PKT 0x03
133#define HCI_EVENT_PKT 0x04
134#define HCI_VENDOR_PKT 0xff
135
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200136/* HCI packet types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137#define HCI_DM1 0x0008
138#define HCI_DM3 0x0400
139#define HCI_DM5 0x4000
140#define HCI_DH1 0x0010
141#define HCI_DH3 0x0800
142#define HCI_DH5 0x8000
143
144#define HCI_HV1 0x0020
145#define HCI_HV2 0x0040
146#define HCI_HV3 0x0080
147
148#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
149#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
150
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200151/* eSCO packet types */
152#define ESCO_HV1 0x0001
153#define ESCO_HV2 0x0002
154#define ESCO_HV3 0x0004
155#define ESCO_EV3 0x0008
156#define ESCO_EV4 0x0010
157#define ESCO_EV5 0x0020
Marcel Holtmannefc76882009-02-06 09:13:37 +0100158#define ESCO_2EV3 0x0040
159#define ESCO_3EV3 0x0080
160#define ESCO_2EV5 0x0100
161#define ESCO_3EV5 0x0200
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200162
Kun Han Kim15b911f2011-07-08 09:30:28 -0700163#define ESCO_WBS (ESCO_EV3 | (EDR_ESCO_MASK ^ ESCO_2EV3))
164
Nick Pellybbcda3b2010-02-11 11:54:28 -0800165#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
166#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
167#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \
168 EDR_ESCO_MASK)
Marcel Holtmanna8746412008-07-14 20:13:46 +0200169
Kun Han Kim15b911f2011-07-08 09:30:28 -0700170/* Air Coding Format */
171#define ACF_CVSD 0x0000;
172#define ACF_ULAW 0x0001;
173#define ACF_ALAW 0x0002;
174#define ACF_TRANS 0x0003;
175
176/* Retransmission Effort */
177#define RE_NO_RETRANS 0x00;
178#define RE_POWER_CONSUMP 0x01;
179#define RE_LINK_QUALITY 0x02;
180#define RE_DONT_CARE 0xFF;
181
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182/* ACL flags */
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200183#define ACL_START_NO_FLUSH 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184#define ACL_CONT 0x01
185#define ACL_START 0x02
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700186#define ACL_COMPLETE 0x03
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187#define ACL_ACTIVE_BCAST 0x04
188#define ACL_PICO_BCAST 0x08
189
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700190#define ACL_PB_MASK (ACL_CONT | ACL_START)
191
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192/* Baseband links */
193#define SCO_LINK 0x00
194#define ACL_LINK 0x01
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200195#define ESCO_LINK 0x02
Ville Tervofcd89c02011-02-10 22:38:47 -0300196/* Low Energy links do not have defined link type. Use invented one */
197#define LE_LINK 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198
199/* LMP features */
200#define LMP_3SLOT 0x01
201#define LMP_5SLOT 0x02
202#define LMP_ENCRYPT 0x04
203#define LMP_SOFFSET 0x08
204#define LMP_TACCURACY 0x10
205#define LMP_RSWITCH 0x20
206#define LMP_HOLD 0x40
Marcel Holtmann04837f62006-07-03 10:02:33 +0200207#define LMP_SNIFF 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
209#define LMP_PARK 0x01
210#define LMP_RSSI 0x02
211#define LMP_QUALITY 0x04
212#define LMP_SCO 0x08
213#define LMP_HV2 0x10
214#define LMP_HV3 0x20
215#define LMP_ULAW 0x40
216#define LMP_ALAW 0x80
217
218#define LMP_CVSD 0x01
219#define LMP_PSCHEME 0x02
220#define LMP_PCONTROL 0x04
221
Johan Hedbergd5859e22011-01-25 01:19:58 +0200222#define LMP_RSSI_INQ 0x40
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200223#define LMP_ESCO 0x80
224
225#define LMP_EV4 0x01
226#define LMP_EV5 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200227#define LMP_LE 0x40
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200228
Marcel Holtmann04837f62006-07-03 10:02:33 +0200229#define LMP_SNIFF_SUBR 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200230#define LMP_PAUSE_ENC 0x04
Marcel Holtmannefc76882009-02-06 09:13:37 +0100231#define LMP_EDR_ESCO_2M 0x20
232#define LMP_EDR_ESCO_3M 0x40
233#define LMP_EDR_3S_ESCO 0x80
Marcel Holtmann04837f62006-07-03 10:02:33 +0200234
Johan Hedbergd5859e22011-01-25 01:19:58 +0200235#define LMP_EXT_INQ 0x01
Marcel Holtmann769be972008-07-14 20:13:49 +0200236#define LMP_SIMPLE_PAIR 0x08
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200237#define LMP_NO_FLUSH 0x40
Marcel Holtmann769be972008-07-14 20:13:49 +0200238
Johan Hedbergd5859e22011-01-25 01:19:58 +0200239#define LMP_LSTO 0x01
240#define LMP_INQ_TX_PWR 0x02
Andre Guedesc006aa02011-06-30 19:20:55 -0300241
Marcel Holtmann04837f62006-07-03 10:02:33 +0200242/* Connection modes */
243#define HCI_CM_ACTIVE 0x0000
244#define HCI_CM_HOLD 0x0001
245#define HCI_CM_SNIFF 0x0002
246#define HCI_CM_PARK 0x0003
247
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248/* Link policies */
249#define HCI_LP_RSWITCH 0x0001
250#define HCI_LP_HOLD 0x0002
251#define HCI_LP_SNIFF 0x0004
252#define HCI_LP_PARK 0x0008
253
Marcel Holtmann04837f62006-07-03 10:02:33 +0200254/* Link modes */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255#define HCI_LM_ACCEPT 0x8000
256#define HCI_LM_MASTER 0x0001
257#define HCI_LM_AUTH 0x0002
258#define HCI_LM_ENCRYPT 0x0004
259#define HCI_LM_TRUSTED 0x0008
260#define HCI_LM_RELIABLE 0x0010
261#define HCI_LM_SECURE 0x0020
262
Marcel Holtmann40be4922008-07-14 20:13:50 +0200263/* Authentication types */
264#define HCI_AT_NO_BONDING 0x00
265#define HCI_AT_NO_BONDING_MITM 0x01
266#define HCI_AT_DEDICATED_BONDING 0x02
267#define HCI_AT_DEDICATED_BONDING_MITM 0x03
268#define HCI_AT_GENERAL_BONDING 0x04
269#define HCI_AT_GENERAL_BONDING_MITM 0x05
270
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700271/* Flow control modes */
272#define HCI_PACKET_BASED_FLOW_CTL_MODE 0x00
273#define HCI_BLOCK_BASED_FLOW_CTL_MODE 0x01
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275/* ----- HCI Commands ---- */
Ville Tervo6bd32322011-02-16 16:32:41 +0200276#define HCI_OP_NOP 0x0000
277
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200278#define HCI_OP_INQUIRY 0x0401
279struct hci_cp_inquiry {
280 __u8 lap[3];
281 __u8 length;
282 __u8 num_rsp;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300283} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200285#define HCI_OP_INQUIRY_CANCEL 0x0402
286
287#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
288
289#define HCI_OP_CREATE_CONN 0x0405
290struct hci_cp_create_conn {
291 bdaddr_t bdaddr;
292 __le16 pkt_type;
293 __u8 pscan_rep_mode;
294 __u8 pscan_mode;
295 __le16 clock_offset;
296 __u8 role_switch;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300297} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200299#define HCI_OP_DISCONNECT 0x0406
300struct hci_cp_disconnect {
301 __le16 handle;
302 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300303} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200305#define HCI_OP_ADD_SCO 0x0407
306struct hci_cp_add_sco {
307 __le16 handle;
308 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300309} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200310
311#define HCI_OP_CREATE_CONN_CANCEL 0x0408
312struct hci_cp_create_conn_cancel {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300314} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200316#define HCI_OP_ACCEPT_CONN_REQ 0x0409
317struct hci_cp_accept_conn_req {
318 bdaddr_t bdaddr;
319 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300320} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200322#define HCI_OP_REJECT_CONN_REQ 0x040a
323struct hci_cp_reject_conn_req {
324 bdaddr_t bdaddr;
325 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300326} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200328#define HCI_OP_LINK_KEY_REPLY 0x040b
329struct hci_cp_link_key_reply {
330 bdaddr_t bdaddr;
331 __u8 link_key[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300332} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334struct hci_rp_link_key_reply {
335 __u8 status;
336 bdaddr_t bdaddr;
337} __packed;
338
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200339#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
340struct hci_cp_link_key_neg_reply {
341 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300342} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200344#define HCI_OP_PIN_CODE_REPLY 0x040d
345struct hci_cp_pin_code_reply {
346 bdaddr_t bdaddr;
347 __u8 pin_len;
348 __u8 pin_code[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300349} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200350struct hci_rp_pin_code_reply {
351 __u8 status;
352 bdaddr_t bdaddr;
353} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200354
355#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
356struct hci_cp_pin_code_neg_reply {
357 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300358} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200359struct hci_rp_pin_code_neg_reply {
360 __u8 status;
361 bdaddr_t bdaddr;
362} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200363
364#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
365struct hci_cp_change_conn_ptype {
366 __le16 handle;
367 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300368} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200369
370#define HCI_OP_AUTH_REQUESTED 0x0411
371struct hci_cp_auth_requested {
372 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300373} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200374
375#define HCI_OP_SET_CONN_ENCRYPT 0x0413
376struct hci_cp_set_conn_encrypt {
377 __le16 handle;
378 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300379} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200380
381#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
382struct hci_cp_change_conn_link_key {
383 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300384} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200385
386#define HCI_OP_REMOTE_NAME_REQ 0x0419
387struct hci_cp_remote_name_req {
388 bdaddr_t bdaddr;
389 __u8 pscan_rep_mode;
390 __u8 pscan_mode;
391 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300392} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200393
394#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
395struct hci_cp_remote_name_req_cancel {
396 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300397} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200398
399#define HCI_OP_READ_REMOTE_FEATURES 0x041b
400struct hci_cp_read_remote_features {
401 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300402} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200403
404#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
405struct hci_cp_read_remote_ext_features {
406 __le16 handle;
407 __u8 page;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300408} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200409
410#define HCI_OP_READ_REMOTE_VERSION 0x041d
411struct hci_cp_read_remote_version {
412 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300413} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200414
415#define HCI_OP_SETUP_SYNC_CONN 0x0428
416struct hci_cp_setup_sync_conn {
417 __le16 handle;
418 __le32 tx_bandwidth;
419 __le32 rx_bandwidth;
420 __le16 max_latency;
421 __le16 voice_setting;
422 __u8 retrans_effort;
423 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300424} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200425
426#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
427struct hci_cp_accept_sync_conn_req {
428 bdaddr_t bdaddr;
429 __le32 tx_bandwidth;
430 __le32 rx_bandwidth;
431 __le16 max_latency;
432 __le16 content_format;
433 __u8 retrans_effort;
434 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300435} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200436
437#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
438struct hci_cp_reject_sync_conn_req {
439 bdaddr_t bdaddr;
440 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300441} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200442
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200443#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
444struct hci_cp_io_capability_reply {
445 bdaddr_t bdaddr;
446 __u8 capability;
447 __u8 oob_data;
448 __u8 authentication;
449} __packed;
450
Johan Hedberga5c29682011-02-19 12:05:57 -0300451#define HCI_OP_USER_CONFIRM_REPLY 0x042c
452struct hci_cp_user_confirm_reply {
453 bdaddr_t bdaddr;
454} __packed;
455struct hci_rp_user_confirm_reply {
456 __u8 status;
457 bdaddr_t bdaddr;
458} __packed;
459
460#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
461
Szymon Janc2763eda2011-03-22 13:12:22 +0100462#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
463struct hci_cp_remote_oob_data_reply {
464 bdaddr_t bdaddr;
465 __u8 hash[16];
466 __u8 randomizer[16];
467} __packed;
468
469#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
470struct hci_cp_remote_oob_data_neg_reply {
471 bdaddr_t bdaddr;
472} __packed;
473
Johan Hedberg03b555e2011-01-04 15:40:05 +0200474#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
475struct hci_cp_io_capability_neg_reply {
476 bdaddr_t bdaddr;
477 __u8 reason;
478} __packed;
479
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700480#define HCI_OP_CREATE_PHYS_LINK 0x0435
481struct hci_cp_create_phys_link {
482 __u8 phy_handle;
483 __u8 key_len;
484 __u8 type;
485 __u8 data[32];
486} __packed;
487
488#define HCI_OP_ACCEPT_PHYS_LINK 0x0436
489struct hci_cp_accept_phys_link {
490 __u8 phy_handle;
491 __u8 key_len;
492 __u8 type;
493 __u8 data[32];
494} __packed;
495
496#define HCI_OP_DISCONN_PHYS_LINK 0x0437
497struct hci_cp_disconn_phys_link {
498 __u8 phy_handle;
499 __u8 reason;
500} __packed;
501
502struct hci_ext_fs {
503 __u8 id;
504 __u8 type;
505 __le16 max_sdu;
506 __le32 sdu_arr_time;
507 __le32 acc_latency;
508 __le32 flush_to;
509} __packed;
510
511#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
512#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
513struct hci_cp_create_logical_link {
514 __u8 phy_handle;
515 struct hci_ext_fs tx_fs;
516 struct hci_ext_fs rx_fs;
517} __packed;
518
519#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
520struct hci_cp_disconn_logical_link {
521 __le16 log_handle;
522} __packed;
523
524#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
525struct hci_cp_logical_link_cancel {
526 __u8 phy_handle;
527 __u8 flow_spec_id;
528} __packed;
529
530struct hci_rp_logical_link_cancel {
531 __u8 status;
532 __u8 phy_handle;
533 __u8 flow_spec_id;
534} __packed;
535
536#define HCI_OP_FLOW_SPEC_MODIFY 0x043c
537struct hci_cp_flow_spec_modify {
538 __le16 log_handle;
539 struct hci_ext_fs tx_fs;
540 struct hci_ext_fs rx_fs;
541} __packed;
542
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200543#define HCI_OP_SNIFF_MODE 0x0803
544struct hci_cp_sniff_mode {
545 __le16 handle;
546 __le16 max_interval;
547 __le16 min_interval;
548 __le16 attempt;
549 __le16 timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300550} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200551
552#define HCI_OP_EXIT_SNIFF_MODE 0x0804
553struct hci_cp_exit_sniff_mode {
554 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300555} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200556
557#define HCI_OP_ROLE_DISCOVERY 0x0809
558struct hci_cp_role_discovery {
559 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300560} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200561struct hci_rp_role_discovery {
562 __u8 status;
563 __le16 handle;
564 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300565} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200566
567#define HCI_OP_SWITCH_ROLE 0x080b
568struct hci_cp_switch_role {
569 bdaddr_t bdaddr;
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_READ_LINK_POLICY 0x080c
574struct hci_cp_read_link_policy {
575 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300576} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200577struct hci_rp_read_link_policy {
578 __u8 status;
579 __le16 handle;
580 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300581} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200582
583#define HCI_OP_WRITE_LINK_POLICY 0x080d
584struct hci_cp_write_link_policy {
585 __le16 handle;
586 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300587} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200588struct hci_rp_write_link_policy {
589 __u8 status;
590 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300591} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200592
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200593#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
594struct hci_rp_read_def_link_policy {
595 __u8 status;
596 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300597} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200598
599#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
600struct hci_cp_write_def_link_policy {
601 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300602} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200603
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200604#define HCI_OP_SNIFF_SUBRATE 0x0811
605struct hci_cp_sniff_subrate {
606 __le16 handle;
607 __le16 max_latency;
608 __le16 min_remote_timeout;
609 __le16 min_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300610} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200611
612#define HCI_OP_SET_EVENT_MASK 0x0c01
613struct hci_cp_set_event_mask {
614 __u8 mask[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300615} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200616
617#define HCI_OP_RESET 0x0c03
618
619#define HCI_OP_SET_EVENT_FLT 0x0c05
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620struct hci_cp_set_event_flt {
621 __u8 flt_type;
622 __u8 cond_type;
623 __u8 condition[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300624} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625
626/* Filter types */
627#define HCI_FLT_CLEAR_ALL 0x00
628#define HCI_FLT_INQ_RESULT 0x01
629#define HCI_FLT_CONN_SETUP 0x02
630
631/* CONN_SETUP Condition types */
632#define HCI_CONN_SETUP_ALLOW_ALL 0x00
633#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
634#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
635
636/* CONN_SETUP Conditions */
637#define HCI_CONN_SETUP_AUTO_OFF 0x01
638#define HCI_CONN_SETUP_AUTO_ON 0x02
639
Johan Hedbergb0916ea2011-01-10 13:44:55 +0200640#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
641struct hci_cp_delete_stored_link_key {
642 bdaddr_t bdaddr;
643 __u8 delete_all;
644} __packed;
645
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200646#define HCI_MAX_NAME_LENGTH 248
647
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200648#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
649struct hci_cp_write_local_name {
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200650 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300651} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200652
653#define HCI_OP_READ_LOCAL_NAME 0x0c14
654struct hci_rp_read_local_name {
655 __u8 status;
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_WRITE_CA_TIMEOUT 0x0c16
660
661#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
662
Andrei Emeltchenko70f230202010-12-01 16:58:25 +0200663#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200664 #define SCAN_DISABLED 0x00
665 #define SCAN_INQUIRY 0x01
666 #define SCAN_PAGE 0x02
667
668#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
669
670#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
671 #define AUTH_DISABLED 0x00
672 #define AUTH_ENABLED 0x01
673
674#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
675
676#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
677 #define ENCRYPT_DISABLED 0x00
678 #define ENCRYPT_P2P 0x01
679 #define ENCRYPT_BOTH 0x02
680
681#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
682struct hci_rp_read_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 __u8 status;
684 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300685} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200687#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
688struct hci_cp_write_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300690} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200692#define HCI_OP_READ_VOICE_SETTING 0x0c25
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693struct hci_rp_read_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800694 __u8 status;
695 __le16 voice_setting;
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_WRITE_VOICE_SETTING 0x0c26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699struct hci_cp_write_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800700 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300701} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200703#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700704struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800705 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800707 __le16 acl_max_pkt;
708 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300709} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710
Johan Hedbergd5859e22011-01-25 01:19:58 +0200711#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
712
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300713#define HCI_MAX_EIR_LENGTH 240
714
715#define HCI_OP_WRITE_EIR 0x0c52
716struct hci_cp_write_eir {
717 uint8_t fec;
718 uint8_t data[HCI_MAX_EIR_LENGTH];
719} __packed;
720
Marcel Holtmann333140b2008-07-14 20:13:48 +0200721#define HCI_OP_READ_SSP_MODE 0x0c55
722struct hci_rp_read_ssp_mode {
723 __u8 status;
724 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300725} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200726
727#define HCI_OP_WRITE_SSP_MODE 0x0c56
728struct hci_cp_write_ssp_mode {
729 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300730} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200731
Szymon Jancc35938b2011-03-22 13:12:21 +0100732#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
733struct hci_rp_read_local_oob_data {
734 __u8 status;
735 __u8 hash[16];
736 __u8 randomizer[16];
737} __packed;
738
Johan Hedbergd5859e22011-01-25 01:19:58 +0200739#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
740
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700741#define HCI_OP_READ_LL_TIMEOUT 0x0c61
742struct hci_rp_read_ll_timeout {
743 __u8 status;
744 __le16 timeout;
745} __packed;
746
747#define HCI_OP_WRITE_LL_TIMEOUT 0x0c62
748struct hci_cp_write_ll_timeout {
749 __le16 timeout;
750} __packed;
751
752#define HCI_OP_SET_EVENT_MASK_PAGE2 0x0c63
753struct hci_cp_set_event_mask_page2 {
754 __u8 mask[8];
755} __packed;
756
757#define HCI_OP_READ_LOCATION_DATA 0x0c64
758struct hci_rp_read_location_data {
759 __u8 status;
760 __u8 loc_dom_aware;
761 __u8 loc_dom;
762 __u8 loc_dom_opts;
763 __u8 loc_opts;
764} __packed;
765
766#define HCI_OP_WRITE_LOCATION_DATA 0x0c65
767struct hci_cp_write_location_data {
768 __u8 loc_dom_aware;
769 __u8 loc_dom;
770 __u8 loc_dom_opts;
771 __u8 loc_opts;
772} __packed;
773
774#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
775struct hci_rp_read_flow_control_mode {
776 __u8 status;
777 __u8 mode;
778} __packed;
779
780#define HCI_OP_WRITE_FLOW_CONTROL_MODE 0x0c67
781struct hci_cp_write_flow_control_mode {
782 __u8 mode;
783} __packed;
784
785#define HCI_OP_READ_BE_FLUSH_TIMEOUT 0x0c69
786struct hci_cp_read_be_flush_timeout {
787 __le16 log_handle;
788} __packed;
789
790struct hci_rp_read_be_flush_timeout {
791 __u8 status;
792 __le32 timeout;
793} __packed;
794
795#define HCI_OP_WRITE_BE_FLUSH_TIMEOUT 0x0c6a
796struct hci_cp_write_be_flush_timeout {
797 __le16 log_handle;
798 __le32 timeout;
799} __packed;
800
801#define HCI_OP_SHORT_RANGE_MODE 0x0c6b
802struct hci_cp_short_range_mode {
803 __u8 phy_handle;
804 __u8 mode;
Andre Guedese326af42011-06-30 19:20:53 -0300805} __packed;
806
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200807#define HCI_OP_READ_LOCAL_VERSION 0x1001
808struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200810 __u8 hci_ver;
811 __le16 hci_rev;
812 __u8 lmp_ver;
813 __le16 manufacturer;
814 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300815} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200817#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
818struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200820 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300821} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200823#define HCI_OP_READ_LOCAL_FEATURES 0x1003
824struct hci_rp_read_local_features {
825 __u8 status;
826 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300827} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200828
829#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
830struct hci_rp_read_local_ext_features {
831 __u8 status;
832 __u8 page;
833 __u8 max_page;
834 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300835} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200836
837#define HCI_OP_READ_BUFFER_SIZE 0x1005
838struct hci_rp_read_buffer_size {
839 __u8 status;
840 __le16 acl_mtu;
841 __u8 sco_mtu;
842 __le16 acl_max_pkt;
843 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300844} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200845
846#define HCI_OP_READ_BD_ADDR 0x1009
847struct hci_rp_read_bd_addr {
848 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300850} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
853struct hci_rp_read_data_block_size {
854 __u8 status;
855 __le16 max_acl_len;
856 __le16 data_block_len;
857 __le16 num_blocks;
858} __packed;
859
860#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
861struct hci_rp_read_local_amp_info {
862 __u8 status;
863 __u8 amp_status;
864 __le32 total_bw;
865 __le32 max_bw;
866 __le32 min_latency;
867 __le32 max_pdu;
868 __u8 amp_type;
869 __le16 pal_cap;
870 __le16 max_assoc_size;
871 __le32 max_flush_to;
872 __le32 be_flush_to;
873} __packed;
874
875#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
876struct hci_cp_read_local_amp_assoc {
877 __u8 phy_handle;
878 __le16 len_so_far;
879 __le16 max_len;
880} __packed;
881
882struct hci_rp_read_local_amp_assoc {
883 __u8 status;
884 __u8 phy_handle;
885 __le16 rem_len;
886 __u8 frag[248];
887} __packed;
888
889#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
890struct hci_cp_write_remote_amp_assoc {
891 __u8 phy_handle;
892 __le16 len_so_far;
893 __le16 rem_len;
894 __u8 frag[248];
895} __packed;
896
897struct hci_rp_write_remote_amp_assoc {
898 __u8 status;
899 __u8 phy_handle;
900} __packed;
901
Ville Tervo63185f62011-02-10 22:38:46 -0300902#define HCI_OP_LE_SET_EVENT_MASK 0x2001
903struct hci_cp_le_set_event_mask {
904 __u8 mask[8];
905} __packed;
906
907#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
908struct hci_rp_le_read_buffer_size {
909 __u8 status;
910 __le16 le_mtu;
911 __u8 le_max_pkt;
912} __packed;
913
Brian Gixa68668b2011-08-11 15:49:36 -0700914#define HCI_OP_LE_SET_SCAN_PARAMETERS 0x200b
915struct hci_cp_le_set_scan_parameters {
916 __u8 type;
917 __le16 interval;
918 __le16 window;
919 __u8 own_bdaddr_type;
920 __u8 filter;
921} __packed;
922
Andre Guedes726e1332011-05-26 16:23:52 -0300923#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
Brian Gixa68668b2011-08-11 15:49:36 -0700924struct hci_cp_le_set_scan_enable {
925 __u8 enable;
926 __u8 filter_dup;
927} __packed;
Andre Guedes726e1332011-05-26 16:23:52 -0300928
Ville Tervo63185f62011-02-10 22:38:46 -0300929#define HCI_OP_LE_CREATE_CONN 0x200d
930struct hci_cp_le_create_conn {
931 __le16 scan_interval;
932 __le16 scan_window;
933 __u8 filter_policy;
934 __u8 peer_addr_type;
935 bdaddr_t peer_addr;
936 __u8 own_address_type;
937 __le16 conn_interval_min;
938 __le16 conn_interval_max;
939 __le16 conn_latency;
940 __le16 supervision_timeout;
941 __le16 min_ce_len;
942 __le16 max_ce_len;
943} __packed;
944
945#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
946
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200947#define HCI_OP_LE_CONN_UPDATE 0x2013
948struct hci_cp_le_conn_update {
949 __le16 handle;
950 __le16 conn_interval_min;
951 __le16 conn_interval_max;
952 __le16 conn_latency;
953 __le16 supervision_timeout;
954 __le16 min_ce_len;
955 __le16 max_ce_len;
956} __packed;
957
Brian Gixa68668b2011-08-11 15:49:36 -0700958#define HCI_OP_LE_ENCRYPT 0x2017
959struct hci_cp_le_encrypt {
960 __u8 key[16];
961 __u8 data[16];
962} __packed;
963struct hci_cp_le_encrypt_reply {
964 __u8 status;
965 __u8 encrypted[16];
966} __packed;
967
Vinicius Costa Gomes735038c2011-06-09 18:50:47 -0300968#define HCI_OP_LE_START_ENC 0x2019
969struct hci_cp_le_start_enc {
970 __le16 handle;
971 __u8 rand[8];
972 __le16 ediv;
973 __u8 ltk[16];
974} __packed;
975
976#define HCI_OP_LE_LTK_REPLY 0x201a
977struct hci_cp_le_ltk_reply {
978 __le16 handle;
979 __u8 ltk[16];
980} __packed;
981struct hci_rp_le_ltk_reply {
982 __u8 status;
983 __le16 handle;
984} __packed;
985
986#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
987struct hci_cp_le_ltk_neg_reply {
988 __le16 handle;
989} __packed;
990struct hci_rp_le_ltk_neg_reply {
991 __u8 status;
992 __le16 handle;
993} __packed;
994
Linus Torvalds1da177e2005-04-16 15:20:36 -0700995/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200996#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -0700997
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200998#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -0700999struct inquiry_info {
1000 bdaddr_t bdaddr;
1001 __u8 pscan_rep_mode;
1002 __u8 pscan_period_mode;
1003 __u8 pscan_mode;
1004 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001005 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001006} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001008#define HCI_EV_CONN_COMPLETE 0x03
1009struct hci_ev_conn_complete {
1010 __u8 status;
1011 __le16 handle;
1012 bdaddr_t bdaddr;
1013 __u8 link_type;
1014 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001015} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001016
1017#define HCI_EV_CONN_REQUEST 0x04
1018struct hci_ev_conn_request {
1019 bdaddr_t bdaddr;
1020 __u8 dev_class[3];
1021 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001022} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001023
1024#define HCI_EV_DISCONN_COMPLETE 0x05
1025struct hci_ev_disconn_complete {
1026 __u8 status;
1027 __le16 handle;
1028 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001029} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001030
1031#define HCI_EV_AUTH_COMPLETE 0x06
1032struct hci_ev_auth_complete {
1033 __u8 status;
1034 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001035} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001036
1037#define HCI_EV_REMOTE_NAME 0x07
1038struct hci_ev_remote_name {
1039 __u8 status;
1040 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001041 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001042} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001043
1044#define HCI_EV_ENCRYPT_CHANGE 0x08
1045struct hci_ev_encrypt_change {
1046 __u8 status;
1047 __le16 handle;
1048 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001049} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001050
1051#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1052struct hci_ev_change_link_key_complete {
1053 __u8 status;
1054 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001055} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001056
1057#define HCI_EV_REMOTE_FEATURES 0x0b
1058struct hci_ev_remote_features {
1059 __u8 status;
1060 __le16 handle;
1061 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001062} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001063
1064#define HCI_EV_REMOTE_VERSION 0x0c
1065struct hci_ev_remote_version {
1066 __u8 status;
1067 __le16 handle;
1068 __u8 lmp_ver;
1069 __le16 manufacturer;
1070 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001071} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001072
1073#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1074struct hci_qos {
1075 __u8 service_type;
1076 __u32 token_rate;
1077 __u32 peak_bandwidth;
1078 __u32 latency;
1079 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001080} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001081struct hci_ev_qos_setup_complete {
1082 __u8 status;
1083 __le16 handle;
1084 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001085} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001086
1087#define HCI_EV_CMD_COMPLETE 0x0e
1088struct hci_ev_cmd_complete {
1089 __u8 ncmd;
1090 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001091} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001092
1093#define HCI_EV_CMD_STATUS 0x0f
1094struct hci_ev_cmd_status {
1095 __u8 status;
1096 __u8 ncmd;
1097 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001098} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001099
1100#define HCI_EV_ROLE_CHANGE 0x12
1101struct hci_ev_role_change {
1102 __u8 status;
1103 bdaddr_t bdaddr;
1104 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001105} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001106
1107#define HCI_EV_NUM_COMP_PKTS 0x13
1108struct hci_ev_num_comp_pkts {
1109 __u8 num_hndl;
1110 /* variable length part */
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001111} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001112
1113#define HCI_EV_MODE_CHANGE 0x14
1114struct hci_ev_mode_change {
1115 __u8 status;
1116 __le16 handle;
1117 __u8 mode;
1118 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001119} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001120
1121#define HCI_EV_PIN_CODE_REQ 0x16
1122struct hci_ev_pin_code_req {
1123 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001124} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001125
1126#define HCI_EV_LINK_KEY_REQ 0x17
1127struct hci_ev_link_key_req {
1128 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001129} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001130
1131#define HCI_EV_LINK_KEY_NOTIFY 0x18
1132struct hci_ev_link_key_notify {
1133 bdaddr_t bdaddr;
1134 __u8 link_key[16];
1135 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001136} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001137
1138#define HCI_EV_CLOCK_OFFSET 0x1c
1139struct hci_ev_clock_offset {
1140 __u8 status;
1141 __le16 handle;
1142 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001143} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001144
Marcel Holtmanna8746412008-07-14 20:13:46 +02001145#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1146struct hci_ev_pkt_type_change {
1147 __u8 status;
1148 __le16 handle;
1149 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001150} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001151
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001152#define HCI_EV_PSCAN_REP_MODE 0x20
1153struct hci_ev_pscan_rep_mode {
1154 bdaddr_t bdaddr;
1155 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001156} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001157
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1159struct inquiry_info_with_rssi {
1160 bdaddr_t bdaddr;
1161 __u8 pscan_rep_mode;
1162 __u8 pscan_period_mode;
1163 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001164 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001166} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001167struct inquiry_info_with_rssi_and_pscan_mode {
1168 bdaddr_t bdaddr;
1169 __u8 pscan_rep_mode;
1170 __u8 pscan_period_mode;
1171 __u8 pscan_mode;
1172 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001173 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001174 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001175} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001176
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001177#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1178struct hci_ev_remote_ext_features {
1179 __u8 status;
1180 __le16 handle;
1181 __u8 page;
1182 __u8 max_page;
1183 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001184} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001185
1186#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1187struct hci_ev_sync_conn_complete {
1188 __u8 status;
1189 __le16 handle;
1190 bdaddr_t bdaddr;
1191 __u8 link_type;
1192 __u8 tx_interval;
1193 __u8 retrans_window;
1194 __le16 rx_pkt_len;
1195 __le16 tx_pkt_len;
1196 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001197} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001198
1199#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1200struct hci_ev_sync_conn_changed {
1201 __u8 status;
1202 __le16 handle;
1203 __u8 tx_interval;
1204 __u8 retrans_window;
1205 __le16 rx_pkt_len;
1206 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001207} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001208
1209#define HCI_EV_SNIFF_SUBRATE 0x2e
1210struct hci_ev_sniff_subrate {
1211 __u8 status;
1212 __le16 handle;
1213 __le16 max_tx_latency;
1214 __le16 max_rx_latency;
1215 __le16 max_remote_timeout;
1216 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001217} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001218
1219#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001220struct extended_inquiry_info {
1221 bdaddr_t bdaddr;
1222 __u8 pscan_rep_mode;
1223 __u8 pscan_period_mode;
1224 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001225 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001226 __s8 rssi;
1227 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001228} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001229
Marcel Holtmann04936842008-07-14 20:13:48 +02001230#define HCI_EV_IO_CAPA_REQUEST 0x31
1231struct hci_ev_io_capa_request {
1232 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001233} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001234
Johan Hedberg03b555e2011-01-04 15:40:05 +02001235#define HCI_EV_IO_CAPA_REPLY 0x32
1236struct hci_ev_io_capa_reply {
1237 bdaddr_t bdaddr;
1238 __u8 capability;
1239 __u8 oob_data;
1240 __u8 authentication;
1241} __packed;
1242
Johan Hedberga5c29682011-02-19 12:05:57 -03001243#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1244struct hci_ev_user_confirm_req {
1245 bdaddr_t bdaddr;
1246 __le32 passkey;
1247} __packed;
1248
Brian Gixa68668b2011-08-11 15:49:36 -07001249#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1250struct hci_ev_user_passkey_request {
1251 bdaddr_t bdaddr;
1252} __packed;
1253
Szymon Janc2763eda2011-03-22 13:12:22 +01001254#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1255struct hci_ev_remote_oob_data_request {
1256 bdaddr_t bdaddr;
1257} __packed;
1258
Marcel Holtmann04936842008-07-14 20:13:48 +02001259#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1260struct hci_ev_simple_pair_complete {
1261 __u8 status;
1262 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001263} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001264
Brian Gixa68668b2011-08-11 15:49:36 -07001265#define HCI_EV_USER_PASSKEY_NOTIFICATION 0x3b
1266struct hci_ev_user_passkey_notification {
1267 bdaddr_t bdaddr;
1268 __le32 passkey;
1269} __packed;
1270
Marcel Holtmann41a96212008-07-14 20:13:48 +02001271#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1272struct hci_ev_remote_host_features {
1273 bdaddr_t bdaddr;
1274 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001275} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001276
Ville Tervo63185f62011-02-10 22:38:46 -03001277#define HCI_EV_LE_META 0x3e
1278struct hci_ev_le_meta {
1279 __u8 subevent;
1280} __packed;
1281
1282/* Low energy meta events */
1283#define HCI_EV_LE_CONN_COMPLETE 0x01
1284struct hci_ev_le_conn_complete {
1285 __u8 status;
1286 __le16 handle;
1287 __u8 role;
1288 __u8 bdaddr_type;
1289 bdaddr_t bdaddr;
1290 __le16 interval;
1291 __le16 latency;
1292 __le16 supervision_timeout;
1293 __u8 clk_accurancy;
1294} __packed;
1295
Anderson Briglia1c3cc1182011-05-26 16:23:49 -03001296#define ADV_IND 0x00
1297#define ADV_DIRECT_IND 0x01
1298#define ADV_SCAN_IND 0x02
1299#define ADV_NONCONN_IND 0x03
1300#define ADV_SCAN_RSP 0x04
1301
1302#define ADDR_LE_DEV_PUBLIC 0x00
1303#define ADDR_LE_DEV_RANDOM 0x01
1304
1305#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1306struct hci_ev_le_advertising_info {
1307 __u8 evt_type;
1308 __u8 bdaddr_type;
1309 bdaddr_t bdaddr;
1310 __u8 length;
1311 __u8 data[0];
1312} __packed;
1313
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001314#define HCI_EV_LE_LTK_REQ 0x05
1315struct hci_ev_le_ltk_req {
1316 __le16 handle;
1317 __u8 random[8];
1318 __le16 ediv;
1319} __packed;
1320
1321#define HCI_EV_PHYS_LINK_COMPLETE 0x40
1322struct hci_ev_phys_link_complete {
1323 __u8 status;
1324 __u8 phy_handle;
1325} __packed;
1326
1327#define HCI_EV_CHANNEL_SELECTED 0x41
1328struct hci_ev_channel_selected {
1329 __u8 phy_handle;
1330} __packed;
1331
1332#define HCI_EV_DISCONN_PHYS_LINK_COMPLETE 0x42
1333struct hci_ev_disconn_phys_link_complete {
1334 __u8 status;
1335 __u8 phy_handle;
1336 __u8 reason;
1337} __packed;
1338
1339#define HCI_EV_LOG_LINK_COMPLETE 0x45
1340struct hci_ev_log_link_complete {
1341 __u8 status;
1342 __le16 log_handle;
1343 __u8 phy_handle;
1344 __u8 flow_spec_id;
1345} __packed;
1346
1347#define HCI_EV_DISCONN_LOG_LINK_COMPLETE 0x46
1348struct hci_ev_disconn_log_link_complete {
1349 __u8 status;
1350 __le16 log_handle;
1351 __u8 reason;
1352} __packed;
1353
1354#define HCI_EV_FLOW_SPEC_MODIFY_COMPLETE 0x47
1355struct hci_ev_flow_spec_modify_complete {
1356 __u8 status;
1357 __le16 log_handle;
1358} __packed;
1359
1360#define HCI_EV_NUM_COMP_BLOCKS 0x48
1361struct hci_ev_num_comp_blocks {
1362 __le16 total_num_blocks;
1363 __u8 num_hndl;
1364 /* variable length part */
1365} __packed;
1366
1367#define HCI_EV_SHORT_RANGE_MODE_COMPLETE 0x4c
1368struct hci_ev_short_range_mode_complete {
1369 __u8 status;
1370 __u8 phy_handle;
1371 __u8 mode;
1372} __packed;
1373
1374#define HCI_EV_AMP_STATUS_CHANGE 0x4d
1375struct hci_ev_amp_status_change {
1376 __u8 status;
1377 __u8 amp_status;
1378} __packed;
1379
Linus Torvalds1da177e2005-04-16 15:20:36 -07001380/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001381#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001382struct hci_ev_stack_internal {
1383 __u16 type;
1384 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001385} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001386
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001387#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388struct hci_ev_si_device {
1389 __u16 event;
1390 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001391} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001392
1393#define HCI_EV_SI_SECURITY 0x02
1394struct hci_ev_si_security {
1395 __u16 event;
1396 __u16 proto;
1397 __u16 subproto;
1398 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001399} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400
1401/* ---- HCI Packet structures ---- */
1402#define HCI_COMMAND_HDR_SIZE 3
1403#define HCI_EVENT_HDR_SIZE 2
1404#define HCI_ACL_HDR_SIZE 4
1405#define HCI_SCO_HDR_SIZE 3
1406
1407struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001408 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001409 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001410} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001411
1412struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001413 __u8 evt;
1414 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001415} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001416
1417struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001418 __le16 handle; /* Handle & Flags(PB, BC) */
1419 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001420} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001421
1422struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001423 __le16 handle;
1424 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001425} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001427#ifdef __KERNEL__
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001428#include <linux/skbuff.h>
1429static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1430{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001431 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001432}
1433
1434static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1435{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001436 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001437}
1438
1439static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1440{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001441 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001442}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001443#endif
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001444
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001446#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001447#define hci_opcode_ogf(op) (op >> 10)
1448#define hci_opcode_ocf(op) (op & 0x03ff)
1449
1450/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001451#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452#define hci_handle(h) (h & 0x0fff)
1453#define hci_flags(h) (h >> 12)
1454
1455/* ---- HCI Sockets ---- */
1456
1457/* Socket options */
1458#define HCI_DATA_DIR 1
1459#define HCI_FILTER 2
1460#define HCI_TIME_STAMP 3
1461
1462/* CMSG flags */
1463#define HCI_CMSG_DIR 0x0001
1464#define HCI_CMSG_TSTAMP 0x0002
1465
1466struct sockaddr_hci {
1467 sa_family_t hci_family;
1468 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001469 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001470};
1471#define HCI_DEV_NONE 0xffff
1472
Johan Hedbergc02178d2010-12-08 00:21:05 +02001473#define HCI_CHANNEL_RAW 0
1474#define HCI_CHANNEL_CONTROL 1
1475
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476struct hci_filter {
1477 unsigned long type_mask;
1478 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001479 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480};
1481
1482struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001483 __u32 type_mask;
1484 __u32 event_mask[2];
1485 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001486};
1487
1488#define HCI_FLT_TYPE_BITS 31
1489#define HCI_FLT_EVENT_BITS 63
1490#define HCI_FLT_OGF_BITS 63
1491#define HCI_FLT_OCF_BITS 127
1492
1493/* ---- HCI Ioctl requests structures ---- */
1494struct hci_dev_stats {
1495 __u32 err_rx;
1496 __u32 err_tx;
1497 __u32 cmd_tx;
1498 __u32 evt_rx;
1499 __u32 acl_tx;
1500 __u32 acl_rx;
1501 __u32 sco_tx;
1502 __u32 sco_rx;
1503 __u32 byte_rx;
1504 __u32 byte_tx;
1505};
1506
1507struct hci_dev_info {
1508 __u16 dev_id;
1509 char name[8];
1510
1511 bdaddr_t bdaddr;
1512
1513 __u32 flags;
1514 __u8 type;
1515
1516 __u8 features[8];
1517
1518 __u32 pkt_type;
1519 __u32 link_policy;
1520 __u32 link_mode;
1521
1522 __u16 acl_mtu;
1523 __u16 acl_pkts;
1524 __u16 sco_mtu;
1525 __u16 sco_pkts;
1526
1527 struct hci_dev_stats stat;
1528};
1529
1530struct hci_conn_info {
1531 __u16 handle;
1532 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001533 __u8 type;
1534 __u8 out;
1535 __u16 state;
1536 __u32 link_mode;
Nick Pellyc1728492009-12-09 00:15:41 -08001537 __u32 mtu;
1538 __u32 cnt;
1539 __u32 pkts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001540 __u8 pending_sec_level;
1541 __u8 ssp_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001542};
1543
1544struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001545 __u16 dev_id;
1546 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001547};
1548
1549struct hci_dev_list_req {
1550 __u16 dev_num;
1551 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1552};
1553
1554struct hci_conn_list_req {
1555 __u16 dev_id;
1556 __u16 conn_num;
1557 struct hci_conn_info conn_info[0];
1558};
1559
1560struct hci_conn_info_req {
1561 bdaddr_t bdaddr;
1562 __u8 type;
1563 struct hci_conn_info conn_info[0];
1564};
1565
Marcel Holtmann40be4922008-07-14 20:13:50 +02001566struct hci_auth_info_req {
1567 bdaddr_t bdaddr;
1568 __u8 type;
1569};
1570
Linus Torvalds1da177e2005-04-16 15:20:36 -07001571struct hci_inquiry_req {
1572 __u16 dev_id;
1573 __u16 flags;
1574 __u8 lap[3];
1575 __u8 length;
1576 __u8 num_rsp;
1577};
1578#define IREQ_CACHE_FLUSH 0x0001
1579
1580#endif /* __HCI_H */