blob: b67803a2e39a2b26d2059b15d4038af69a352198 [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
Brian Gix8a7f1642011-10-17 17:39:46 -0700711#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
712struct hci_cp_write_current_iac_lap {
713 __u8 num_current_iac;
714 __u8 lap[6];
715} __packed;
716
Johan Hedbergd5859e22011-01-25 01:19:58 +0200717#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
718
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300719#define HCI_MAX_EIR_LENGTH 240
720
721#define HCI_OP_WRITE_EIR 0x0c52
722struct hci_cp_write_eir {
723 uint8_t fec;
724 uint8_t data[HCI_MAX_EIR_LENGTH];
725} __packed;
726
Marcel Holtmann333140b2008-07-14 20:13:48 +0200727#define HCI_OP_READ_SSP_MODE 0x0c55
728struct hci_rp_read_ssp_mode {
729 __u8 status;
730 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300731} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200732
733#define HCI_OP_WRITE_SSP_MODE 0x0c56
734struct hci_cp_write_ssp_mode {
735 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300736} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200737
Szymon Jancc35938b2011-03-22 13:12:21 +0100738#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
739struct hci_rp_read_local_oob_data {
740 __u8 status;
741 __u8 hash[16];
742 __u8 randomizer[16];
743} __packed;
744
Johan Hedbergd5859e22011-01-25 01:19:58 +0200745#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700747#define HCI_OP_READ_LL_TIMEOUT 0x0c61
748struct hci_rp_read_ll_timeout {
749 __u8 status;
750 __le16 timeout;
751} __packed;
752
753#define HCI_OP_WRITE_LL_TIMEOUT 0x0c62
754struct hci_cp_write_ll_timeout {
755 __le16 timeout;
756} __packed;
757
758#define HCI_OP_SET_EVENT_MASK_PAGE2 0x0c63
759struct hci_cp_set_event_mask_page2 {
760 __u8 mask[8];
761} __packed;
762
763#define HCI_OP_READ_LOCATION_DATA 0x0c64
764struct hci_rp_read_location_data {
765 __u8 status;
766 __u8 loc_dom_aware;
767 __u8 loc_dom;
768 __u8 loc_dom_opts;
769 __u8 loc_opts;
770} __packed;
771
772#define HCI_OP_WRITE_LOCATION_DATA 0x0c65
773struct hci_cp_write_location_data {
774 __u8 loc_dom_aware;
775 __u8 loc_dom;
776 __u8 loc_dom_opts;
777 __u8 loc_opts;
778} __packed;
779
780#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
781struct hci_rp_read_flow_control_mode {
782 __u8 status;
783 __u8 mode;
784} __packed;
785
786#define HCI_OP_WRITE_FLOW_CONTROL_MODE 0x0c67
787struct hci_cp_write_flow_control_mode {
788 __u8 mode;
789} __packed;
790
791#define HCI_OP_READ_BE_FLUSH_TIMEOUT 0x0c69
792struct hci_cp_read_be_flush_timeout {
793 __le16 log_handle;
794} __packed;
795
796struct hci_rp_read_be_flush_timeout {
797 __u8 status;
798 __le32 timeout;
799} __packed;
800
801#define HCI_OP_WRITE_BE_FLUSH_TIMEOUT 0x0c6a
802struct hci_cp_write_be_flush_timeout {
803 __le16 log_handle;
804 __le32 timeout;
805} __packed;
806
807#define HCI_OP_SHORT_RANGE_MODE 0x0c6b
808struct hci_cp_short_range_mode {
809 __u8 phy_handle;
810 __u8 mode;
Andre Guedese326af42011-06-30 19:20:53 -0300811} __packed;
812
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200813#define HCI_OP_READ_LOCAL_VERSION 0x1001
814struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200816 __u8 hci_ver;
817 __le16 hci_rev;
818 __u8 lmp_ver;
819 __le16 manufacturer;
820 __le16 lmp_subver;
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_COMMANDS 0x1002
824struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200826 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300827} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200829#define HCI_OP_READ_LOCAL_FEATURES 0x1003
830struct hci_rp_read_local_features {
831 __u8 status;
832 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300833} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200834
835#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
836struct hci_rp_read_local_ext_features {
837 __u8 status;
838 __u8 page;
839 __u8 max_page;
840 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300841} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200842
843#define HCI_OP_READ_BUFFER_SIZE 0x1005
844struct hci_rp_read_buffer_size {
845 __u8 status;
846 __le16 acl_mtu;
847 __u8 sco_mtu;
848 __le16 acl_max_pkt;
849 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300850} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200851
852#define HCI_OP_READ_BD_ADDR 0x1009
853struct hci_rp_read_bd_addr {
854 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300856} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
859struct hci_rp_read_data_block_size {
860 __u8 status;
861 __le16 max_acl_len;
862 __le16 data_block_len;
863 __le16 num_blocks;
864} __packed;
865
866#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
867struct hci_rp_read_local_amp_info {
868 __u8 status;
869 __u8 amp_status;
870 __le32 total_bw;
871 __le32 max_bw;
872 __le32 min_latency;
873 __le32 max_pdu;
874 __u8 amp_type;
875 __le16 pal_cap;
876 __le16 max_assoc_size;
877 __le32 max_flush_to;
878 __le32 be_flush_to;
879} __packed;
880
881#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
882struct hci_cp_read_local_amp_assoc {
883 __u8 phy_handle;
884 __le16 len_so_far;
885 __le16 max_len;
886} __packed;
887
888struct hci_rp_read_local_amp_assoc {
889 __u8 status;
890 __u8 phy_handle;
891 __le16 rem_len;
892 __u8 frag[248];
893} __packed;
894
895#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
896struct hci_cp_write_remote_amp_assoc {
897 __u8 phy_handle;
898 __le16 len_so_far;
899 __le16 rem_len;
900 __u8 frag[248];
901} __packed;
902
903struct hci_rp_write_remote_amp_assoc {
904 __u8 status;
905 __u8 phy_handle;
906} __packed;
907
Ville Tervo63185f62011-02-10 22:38:46 -0300908#define HCI_OP_LE_SET_EVENT_MASK 0x2001
909struct hci_cp_le_set_event_mask {
910 __u8 mask[8];
911} __packed;
912
913#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
914struct hci_rp_le_read_buffer_size {
915 __u8 status;
916 __le16 le_mtu;
917 __u8 le_max_pkt;
918} __packed;
919
Brian Gixa68668b2011-08-11 15:49:36 -0700920#define HCI_OP_LE_SET_SCAN_PARAMETERS 0x200b
921struct hci_cp_le_set_scan_parameters {
922 __u8 type;
923 __le16 interval;
924 __le16 window;
925 __u8 own_bdaddr_type;
926 __u8 filter;
927} __packed;
928
Andre Guedes726e1332011-05-26 16:23:52 -0300929#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
Brian Gixa68668b2011-08-11 15:49:36 -0700930struct hci_cp_le_set_scan_enable {
931 __u8 enable;
932 __u8 filter_dup;
933} __packed;
Andre Guedes726e1332011-05-26 16:23:52 -0300934
Ville Tervo63185f62011-02-10 22:38:46 -0300935#define HCI_OP_LE_CREATE_CONN 0x200d
936struct hci_cp_le_create_conn {
937 __le16 scan_interval;
938 __le16 scan_window;
939 __u8 filter_policy;
940 __u8 peer_addr_type;
941 bdaddr_t peer_addr;
942 __u8 own_address_type;
943 __le16 conn_interval_min;
944 __le16 conn_interval_max;
945 __le16 conn_latency;
946 __le16 supervision_timeout;
947 __le16 min_ce_len;
948 __le16 max_ce_len;
949} __packed;
950
951#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
952
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200953#define HCI_OP_LE_CONN_UPDATE 0x2013
954struct hci_cp_le_conn_update {
955 __le16 handle;
956 __le16 conn_interval_min;
957 __le16 conn_interval_max;
958 __le16 conn_latency;
959 __le16 supervision_timeout;
960 __le16 min_ce_len;
961 __le16 max_ce_len;
962} __packed;
963
Brian Gixa68668b2011-08-11 15:49:36 -0700964#define HCI_OP_LE_ENCRYPT 0x2017
965struct hci_cp_le_encrypt {
966 __u8 key[16];
967 __u8 data[16];
968} __packed;
969struct hci_cp_le_encrypt_reply {
970 __u8 status;
971 __u8 encrypted[16];
972} __packed;
973
Vinicius Costa Gomes735038c2011-06-09 18:50:47 -0300974#define HCI_OP_LE_START_ENC 0x2019
975struct hci_cp_le_start_enc {
976 __le16 handle;
977 __u8 rand[8];
978 __le16 ediv;
979 __u8 ltk[16];
980} __packed;
981
982#define HCI_OP_LE_LTK_REPLY 0x201a
983struct hci_cp_le_ltk_reply {
984 __le16 handle;
985 __u8 ltk[16];
986} __packed;
987struct hci_rp_le_ltk_reply {
988 __u8 status;
989 __le16 handle;
990} __packed;
991
992#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
993struct hci_cp_le_ltk_neg_reply {
994 __le16 handle;
995} __packed;
996struct hci_rp_le_ltk_neg_reply {
997 __u8 status;
998 __le16 handle;
999} __packed;
1000
Linus Torvalds1da177e2005-04-16 15:20:36 -07001001/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001002#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001004#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -07001005struct inquiry_info {
1006 bdaddr_t bdaddr;
1007 __u8 pscan_rep_mode;
1008 __u8 pscan_period_mode;
1009 __u8 pscan_mode;
1010 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001011 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001012} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001013
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001014#define HCI_EV_CONN_COMPLETE 0x03
1015struct hci_ev_conn_complete {
1016 __u8 status;
1017 __le16 handle;
1018 bdaddr_t bdaddr;
1019 __u8 link_type;
1020 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001021} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001022
1023#define HCI_EV_CONN_REQUEST 0x04
1024struct hci_ev_conn_request {
1025 bdaddr_t bdaddr;
1026 __u8 dev_class[3];
1027 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001028} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001029
1030#define HCI_EV_DISCONN_COMPLETE 0x05
1031struct hci_ev_disconn_complete {
1032 __u8 status;
1033 __le16 handle;
1034 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001035} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001036
1037#define HCI_EV_AUTH_COMPLETE 0x06
1038struct hci_ev_auth_complete {
1039 __u8 status;
1040 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001041} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001042
1043#define HCI_EV_REMOTE_NAME 0x07
1044struct hci_ev_remote_name {
1045 __u8 status;
1046 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001047 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001048} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001049
1050#define HCI_EV_ENCRYPT_CHANGE 0x08
1051struct hci_ev_encrypt_change {
1052 __u8 status;
1053 __le16 handle;
1054 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001055} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001056
1057#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1058struct hci_ev_change_link_key_complete {
1059 __u8 status;
1060 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001061} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001062
1063#define HCI_EV_REMOTE_FEATURES 0x0b
1064struct hci_ev_remote_features {
1065 __u8 status;
1066 __le16 handle;
1067 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001068} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001069
1070#define HCI_EV_REMOTE_VERSION 0x0c
1071struct hci_ev_remote_version {
1072 __u8 status;
1073 __le16 handle;
1074 __u8 lmp_ver;
1075 __le16 manufacturer;
1076 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001077} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001078
1079#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1080struct hci_qos {
1081 __u8 service_type;
1082 __u32 token_rate;
1083 __u32 peak_bandwidth;
1084 __u32 latency;
1085 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001086} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001087struct hci_ev_qos_setup_complete {
1088 __u8 status;
1089 __le16 handle;
1090 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001091} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001092
1093#define HCI_EV_CMD_COMPLETE 0x0e
1094struct hci_ev_cmd_complete {
1095 __u8 ncmd;
1096 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001097} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001098
1099#define HCI_EV_CMD_STATUS 0x0f
1100struct hci_ev_cmd_status {
1101 __u8 status;
1102 __u8 ncmd;
1103 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001104} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001105
1106#define HCI_EV_ROLE_CHANGE 0x12
1107struct hci_ev_role_change {
1108 __u8 status;
1109 bdaddr_t bdaddr;
1110 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001111} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001112
1113#define HCI_EV_NUM_COMP_PKTS 0x13
1114struct hci_ev_num_comp_pkts {
1115 __u8 num_hndl;
1116 /* variable length part */
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001117} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001118
1119#define HCI_EV_MODE_CHANGE 0x14
1120struct hci_ev_mode_change {
1121 __u8 status;
1122 __le16 handle;
1123 __u8 mode;
1124 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001125} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001126
1127#define HCI_EV_PIN_CODE_REQ 0x16
1128struct hci_ev_pin_code_req {
1129 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001130} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001131
1132#define HCI_EV_LINK_KEY_REQ 0x17
1133struct hci_ev_link_key_req {
1134 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001135} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001136
1137#define HCI_EV_LINK_KEY_NOTIFY 0x18
1138struct hci_ev_link_key_notify {
1139 bdaddr_t bdaddr;
1140 __u8 link_key[16];
1141 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001142} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001143
1144#define HCI_EV_CLOCK_OFFSET 0x1c
1145struct hci_ev_clock_offset {
1146 __u8 status;
1147 __le16 handle;
1148 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001149} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001150
Marcel Holtmanna8746412008-07-14 20:13:46 +02001151#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1152struct hci_ev_pkt_type_change {
1153 __u8 status;
1154 __le16 handle;
1155 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001156} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001157
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001158#define HCI_EV_PSCAN_REP_MODE 0x20
1159struct hci_ev_pscan_rep_mode {
1160 bdaddr_t bdaddr;
1161 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001162} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001163
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1165struct inquiry_info_with_rssi {
1166 bdaddr_t bdaddr;
1167 __u8 pscan_rep_mode;
1168 __u8 pscan_period_mode;
1169 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001170 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001171 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001172} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001173struct inquiry_info_with_rssi_and_pscan_mode {
1174 bdaddr_t bdaddr;
1175 __u8 pscan_rep_mode;
1176 __u8 pscan_period_mode;
1177 __u8 pscan_mode;
1178 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001179 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001180 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001181} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001182
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001183#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1184struct hci_ev_remote_ext_features {
1185 __u8 status;
1186 __le16 handle;
1187 __u8 page;
1188 __u8 max_page;
1189 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001190} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001191
1192#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1193struct hci_ev_sync_conn_complete {
1194 __u8 status;
1195 __le16 handle;
1196 bdaddr_t bdaddr;
1197 __u8 link_type;
1198 __u8 tx_interval;
1199 __u8 retrans_window;
1200 __le16 rx_pkt_len;
1201 __le16 tx_pkt_len;
1202 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001203} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001204
1205#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1206struct hci_ev_sync_conn_changed {
1207 __u8 status;
1208 __le16 handle;
1209 __u8 tx_interval;
1210 __u8 retrans_window;
1211 __le16 rx_pkt_len;
1212 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001213} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001214
1215#define HCI_EV_SNIFF_SUBRATE 0x2e
1216struct hci_ev_sniff_subrate {
1217 __u8 status;
1218 __le16 handle;
1219 __le16 max_tx_latency;
1220 __le16 max_rx_latency;
1221 __le16 max_remote_timeout;
1222 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001223} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001224
1225#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001226struct extended_inquiry_info {
1227 bdaddr_t bdaddr;
1228 __u8 pscan_rep_mode;
1229 __u8 pscan_period_mode;
1230 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001231 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001232 __s8 rssi;
1233 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001234} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001235
Marcel Holtmann04936842008-07-14 20:13:48 +02001236#define HCI_EV_IO_CAPA_REQUEST 0x31
1237struct hci_ev_io_capa_request {
1238 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001239} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001240
Johan Hedberg03b555e2011-01-04 15:40:05 +02001241#define HCI_EV_IO_CAPA_REPLY 0x32
1242struct hci_ev_io_capa_reply {
1243 bdaddr_t bdaddr;
1244 __u8 capability;
1245 __u8 oob_data;
1246 __u8 authentication;
1247} __packed;
1248
Johan Hedberga5c29682011-02-19 12:05:57 -03001249#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1250struct hci_ev_user_confirm_req {
1251 bdaddr_t bdaddr;
1252 __le32 passkey;
1253} __packed;
1254
Brian Gixa68668b2011-08-11 15:49:36 -07001255#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1256struct hci_ev_user_passkey_request {
1257 bdaddr_t bdaddr;
1258} __packed;
1259
Szymon Janc2763eda2011-03-22 13:12:22 +01001260#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1261struct hci_ev_remote_oob_data_request {
1262 bdaddr_t bdaddr;
1263} __packed;
1264
Marcel Holtmann04936842008-07-14 20:13:48 +02001265#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1266struct hci_ev_simple_pair_complete {
1267 __u8 status;
1268 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001269} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001270
Brian Gixa68668b2011-08-11 15:49:36 -07001271#define HCI_EV_USER_PASSKEY_NOTIFICATION 0x3b
1272struct hci_ev_user_passkey_notification {
1273 bdaddr_t bdaddr;
1274 __le32 passkey;
1275} __packed;
1276
Marcel Holtmann41a96212008-07-14 20:13:48 +02001277#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1278struct hci_ev_remote_host_features {
1279 bdaddr_t bdaddr;
1280 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001281} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001282
Ville Tervo63185f62011-02-10 22:38:46 -03001283#define HCI_EV_LE_META 0x3e
1284struct hci_ev_le_meta {
1285 __u8 subevent;
1286} __packed;
1287
1288/* Low energy meta events */
1289#define HCI_EV_LE_CONN_COMPLETE 0x01
1290struct hci_ev_le_conn_complete {
1291 __u8 status;
1292 __le16 handle;
1293 __u8 role;
1294 __u8 bdaddr_type;
1295 bdaddr_t bdaddr;
1296 __le16 interval;
1297 __le16 latency;
1298 __le16 supervision_timeout;
1299 __u8 clk_accurancy;
1300} __packed;
1301
Anderson Briglia1c3cc1182011-05-26 16:23:49 -03001302#define ADV_IND 0x00
1303#define ADV_DIRECT_IND 0x01
1304#define ADV_SCAN_IND 0x02
1305#define ADV_NONCONN_IND 0x03
1306#define ADV_SCAN_RSP 0x04
1307
1308#define ADDR_LE_DEV_PUBLIC 0x00
1309#define ADDR_LE_DEV_RANDOM 0x01
1310
1311#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1312struct hci_ev_le_advertising_info {
1313 __u8 evt_type;
1314 __u8 bdaddr_type;
1315 bdaddr_t bdaddr;
1316 __u8 length;
1317 __u8 data[0];
1318} __packed;
1319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001320#define HCI_EV_LE_LTK_REQ 0x05
1321struct hci_ev_le_ltk_req {
1322 __le16 handle;
1323 __u8 random[8];
1324 __le16 ediv;
1325} __packed;
1326
1327#define HCI_EV_PHYS_LINK_COMPLETE 0x40
1328struct hci_ev_phys_link_complete {
1329 __u8 status;
1330 __u8 phy_handle;
1331} __packed;
1332
1333#define HCI_EV_CHANNEL_SELECTED 0x41
1334struct hci_ev_channel_selected {
1335 __u8 phy_handle;
1336} __packed;
1337
1338#define HCI_EV_DISCONN_PHYS_LINK_COMPLETE 0x42
1339struct hci_ev_disconn_phys_link_complete {
1340 __u8 status;
1341 __u8 phy_handle;
1342 __u8 reason;
1343} __packed;
1344
1345#define HCI_EV_LOG_LINK_COMPLETE 0x45
1346struct hci_ev_log_link_complete {
1347 __u8 status;
1348 __le16 log_handle;
1349 __u8 phy_handle;
1350 __u8 flow_spec_id;
1351} __packed;
1352
1353#define HCI_EV_DISCONN_LOG_LINK_COMPLETE 0x46
1354struct hci_ev_disconn_log_link_complete {
1355 __u8 status;
1356 __le16 log_handle;
1357 __u8 reason;
1358} __packed;
1359
1360#define HCI_EV_FLOW_SPEC_MODIFY_COMPLETE 0x47
1361struct hci_ev_flow_spec_modify_complete {
1362 __u8 status;
1363 __le16 log_handle;
1364} __packed;
1365
1366#define HCI_EV_NUM_COMP_BLOCKS 0x48
1367struct hci_ev_num_comp_blocks {
1368 __le16 total_num_blocks;
1369 __u8 num_hndl;
1370 /* variable length part */
1371} __packed;
1372
1373#define HCI_EV_SHORT_RANGE_MODE_COMPLETE 0x4c
1374struct hci_ev_short_range_mode_complete {
1375 __u8 status;
1376 __u8 phy_handle;
1377 __u8 mode;
1378} __packed;
1379
1380#define HCI_EV_AMP_STATUS_CHANGE 0x4d
1381struct hci_ev_amp_status_change {
1382 __u8 status;
1383 __u8 amp_status;
1384} __packed;
1385
Linus Torvalds1da177e2005-04-16 15:20:36 -07001386/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001387#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388struct hci_ev_stack_internal {
1389 __u16 type;
1390 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001391} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001392
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001393#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394struct hci_ev_si_device {
1395 __u16 event;
1396 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001397} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001398
1399#define HCI_EV_SI_SECURITY 0x02
1400struct hci_ev_si_security {
1401 __u16 event;
1402 __u16 proto;
1403 __u16 subproto;
1404 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001405} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406
1407/* ---- HCI Packet structures ---- */
1408#define HCI_COMMAND_HDR_SIZE 3
1409#define HCI_EVENT_HDR_SIZE 2
1410#define HCI_ACL_HDR_SIZE 4
1411#define HCI_SCO_HDR_SIZE 3
1412
1413struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001414 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001415 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001416} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001417
1418struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001419 __u8 evt;
1420 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001421} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001422
1423struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001424 __le16 handle; /* Handle & Flags(PB, BC) */
1425 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001426} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001427
1428struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001429 __le16 handle;
1430 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001431} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001432
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001433#ifdef __KERNEL__
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001434#include <linux/skbuff.h>
1435static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1436{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001437 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001438}
1439
1440static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1441{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001442 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001443}
1444
1445static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1446{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001447 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001448}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449#endif
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001450
Linus Torvalds1da177e2005-04-16 15:20:36 -07001451/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001452#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001453#define hci_opcode_ogf(op) (op >> 10)
1454#define hci_opcode_ocf(op) (op & 0x03ff)
1455
1456/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001457#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458#define hci_handle(h) (h & 0x0fff)
1459#define hci_flags(h) (h >> 12)
1460
1461/* ---- HCI Sockets ---- */
1462
1463/* Socket options */
1464#define HCI_DATA_DIR 1
1465#define HCI_FILTER 2
1466#define HCI_TIME_STAMP 3
1467
1468/* CMSG flags */
1469#define HCI_CMSG_DIR 0x0001
1470#define HCI_CMSG_TSTAMP 0x0002
1471
1472struct sockaddr_hci {
1473 sa_family_t hci_family;
1474 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001475 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476};
1477#define HCI_DEV_NONE 0xffff
1478
Johan Hedbergc02178d2010-12-08 00:21:05 +02001479#define HCI_CHANNEL_RAW 0
1480#define HCI_CHANNEL_CONTROL 1
1481
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482struct hci_filter {
1483 unsigned long type_mask;
1484 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001485 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001486};
1487
1488struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001489 __u32 type_mask;
1490 __u32 event_mask[2];
1491 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492};
1493
1494#define HCI_FLT_TYPE_BITS 31
1495#define HCI_FLT_EVENT_BITS 63
1496#define HCI_FLT_OGF_BITS 63
1497#define HCI_FLT_OCF_BITS 127
1498
1499/* ---- HCI Ioctl requests structures ---- */
1500struct hci_dev_stats {
1501 __u32 err_rx;
1502 __u32 err_tx;
1503 __u32 cmd_tx;
1504 __u32 evt_rx;
1505 __u32 acl_tx;
1506 __u32 acl_rx;
1507 __u32 sco_tx;
1508 __u32 sco_rx;
1509 __u32 byte_rx;
1510 __u32 byte_tx;
1511};
1512
1513struct hci_dev_info {
1514 __u16 dev_id;
1515 char name[8];
1516
1517 bdaddr_t bdaddr;
1518
1519 __u32 flags;
1520 __u8 type;
1521
1522 __u8 features[8];
1523
1524 __u32 pkt_type;
1525 __u32 link_policy;
1526 __u32 link_mode;
1527
1528 __u16 acl_mtu;
1529 __u16 acl_pkts;
1530 __u16 sco_mtu;
1531 __u16 sco_pkts;
1532
1533 struct hci_dev_stats stat;
1534};
1535
1536struct hci_conn_info {
1537 __u16 handle;
1538 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001539 __u8 type;
1540 __u8 out;
1541 __u16 state;
1542 __u32 link_mode;
Nick Pellyc1728492009-12-09 00:15:41 -08001543 __u32 mtu;
1544 __u32 cnt;
1545 __u32 pkts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001546 __u8 pending_sec_level;
1547 __u8 ssp_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001548};
1549
1550struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001551 __u16 dev_id;
1552 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001553};
1554
1555struct hci_dev_list_req {
1556 __u16 dev_num;
1557 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1558};
1559
1560struct hci_conn_list_req {
1561 __u16 dev_id;
1562 __u16 conn_num;
1563 struct hci_conn_info conn_info[0];
1564};
1565
1566struct hci_conn_info_req {
1567 bdaddr_t bdaddr;
1568 __u8 type;
1569 struct hci_conn_info conn_info[0];
1570};
1571
Marcel Holtmann40be4922008-07-14 20:13:50 +02001572struct hci_auth_info_req {
1573 bdaddr_t bdaddr;
1574 __u8 type;
1575};
1576
Linus Torvalds1da177e2005-04-16 15:20:36 -07001577struct hci_inquiry_req {
1578 __u16 dev_id;
1579 __u16 flags;
1580 __u8 lap[3];
1581 __u8 length;
1582 __u8 num_rsp;
1583};
1584#define IREQ_CACHE_FLUSH 0x0001
1585
1586#endif /* __HCI_H */