blob: 9fda3238177b1d77743df974d2b71f971a3cbd65 [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
Nick Pellybbcda3b2010-02-11 11:54:28 -0800163#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
164#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
165#define ALL_ESCO_MASK (SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \
166 EDR_ESCO_MASK)
Marcel Holtmanna8746412008-07-14 20:13:46 +0200167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168/* ACL flags */
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200169#define ACL_START_NO_FLUSH 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170#define ACL_CONT 0x01
171#define ACL_START 0x02
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700172#define ACL_COMPLETE 0x03
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173#define ACL_ACTIVE_BCAST 0x04
174#define ACL_PICO_BCAST 0x08
175
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700176#define ACL_PB_MASK (ACL_CONT | ACL_START)
177
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178/* Baseband links */
179#define SCO_LINK 0x00
180#define ACL_LINK 0x01
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200181#define ESCO_LINK 0x02
Ville Tervofcd89c02011-02-10 22:38:47 -0300182/* Low Energy links do not have defined link type. Use invented one */
183#define LE_LINK 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184
185/* LMP features */
186#define LMP_3SLOT 0x01
187#define LMP_5SLOT 0x02
188#define LMP_ENCRYPT 0x04
189#define LMP_SOFFSET 0x08
190#define LMP_TACCURACY 0x10
191#define LMP_RSWITCH 0x20
192#define LMP_HOLD 0x40
Marcel Holtmann04837f62006-07-03 10:02:33 +0200193#define LMP_SNIFF 0x80
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
195#define LMP_PARK 0x01
196#define LMP_RSSI 0x02
197#define LMP_QUALITY 0x04
198#define LMP_SCO 0x08
199#define LMP_HV2 0x10
200#define LMP_HV3 0x20
201#define LMP_ULAW 0x40
202#define LMP_ALAW 0x80
203
204#define LMP_CVSD 0x01
205#define LMP_PSCHEME 0x02
206#define LMP_PCONTROL 0x04
207
Johan Hedbergd5859e22011-01-25 01:19:58 +0200208#define LMP_RSSI_INQ 0x40
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200209#define LMP_ESCO 0x80
210
211#define LMP_EV4 0x01
212#define LMP_EV5 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200213#define LMP_LE 0x40
Marcel Holtmann5b7f99092007-07-11 09:51:55 +0200214
Marcel Holtmann04837f62006-07-03 10:02:33 +0200215#define LMP_SNIFF_SUBR 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200216#define LMP_PAUSE_ENC 0x04
Marcel Holtmannefc76882009-02-06 09:13:37 +0100217#define LMP_EDR_ESCO_2M 0x20
218#define LMP_EDR_ESCO_3M 0x40
219#define LMP_EDR_3S_ESCO 0x80
Marcel Holtmann04837f62006-07-03 10:02:33 +0200220
Johan Hedbergd5859e22011-01-25 01:19:58 +0200221#define LMP_EXT_INQ 0x01
Marcel Holtmann769be972008-07-14 20:13:49 +0200222#define LMP_SIMPLE_PAIR 0x08
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200223#define LMP_NO_FLUSH 0x40
Marcel Holtmann769be972008-07-14 20:13:49 +0200224
Johan Hedbergd5859e22011-01-25 01:19:58 +0200225#define LMP_LSTO 0x01
226#define LMP_INQ_TX_PWR 0x02
Andre Guedesc006aa02011-06-30 19:20:55 -0300227
Marcel Holtmann04837f62006-07-03 10:02:33 +0200228/* Connection modes */
229#define HCI_CM_ACTIVE 0x0000
230#define HCI_CM_HOLD 0x0001
231#define HCI_CM_SNIFF 0x0002
232#define HCI_CM_PARK 0x0003
233
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234/* Link policies */
235#define HCI_LP_RSWITCH 0x0001
236#define HCI_LP_HOLD 0x0002
237#define HCI_LP_SNIFF 0x0004
238#define HCI_LP_PARK 0x0008
239
Marcel Holtmann04837f62006-07-03 10:02:33 +0200240/* Link modes */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241#define HCI_LM_ACCEPT 0x8000
242#define HCI_LM_MASTER 0x0001
243#define HCI_LM_AUTH 0x0002
244#define HCI_LM_ENCRYPT 0x0004
245#define HCI_LM_TRUSTED 0x0008
246#define HCI_LM_RELIABLE 0x0010
247#define HCI_LM_SECURE 0x0020
248
Marcel Holtmann40be4922008-07-14 20:13:50 +0200249/* Authentication types */
250#define HCI_AT_NO_BONDING 0x00
251#define HCI_AT_NO_BONDING_MITM 0x01
252#define HCI_AT_DEDICATED_BONDING 0x02
253#define HCI_AT_DEDICATED_BONDING_MITM 0x03
254#define HCI_AT_GENERAL_BONDING 0x04
255#define HCI_AT_GENERAL_BONDING_MITM 0x05
256
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700257/* Flow control modes */
258#define HCI_PACKET_BASED_FLOW_CTL_MODE 0x00
259#define HCI_BLOCK_BASED_FLOW_CTL_MODE 0x01
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200260
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261/* ----- HCI Commands ---- */
Ville Tervo6bd32322011-02-16 16:32:41 +0200262#define HCI_OP_NOP 0x0000
263
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200264#define HCI_OP_INQUIRY 0x0401
265struct hci_cp_inquiry {
266 __u8 lap[3];
267 __u8 length;
268 __u8 num_rsp;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300269} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200271#define HCI_OP_INQUIRY_CANCEL 0x0402
272
273#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
274
275#define HCI_OP_CREATE_CONN 0x0405
276struct hci_cp_create_conn {
277 bdaddr_t bdaddr;
278 __le16 pkt_type;
279 __u8 pscan_rep_mode;
280 __u8 pscan_mode;
281 __le16 clock_offset;
282 __u8 role_switch;
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_DISCONNECT 0x0406
286struct hci_cp_disconnect {
287 __le16 handle;
288 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300289} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200291#define HCI_OP_ADD_SCO 0x0407
292struct hci_cp_add_sco {
293 __le16 handle;
294 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300295} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200296
297#define HCI_OP_CREATE_CONN_CANCEL 0x0408
298struct hci_cp_create_conn_cancel {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300300} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200302#define HCI_OP_ACCEPT_CONN_REQ 0x0409
303struct hci_cp_accept_conn_req {
304 bdaddr_t bdaddr;
305 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300306} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200308#define HCI_OP_REJECT_CONN_REQ 0x040a
309struct hci_cp_reject_conn_req {
310 bdaddr_t bdaddr;
311 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300312} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200314#define HCI_OP_LINK_KEY_REPLY 0x040b
315struct hci_cp_link_key_reply {
316 bdaddr_t bdaddr;
317 __u8 link_key[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300318} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320struct hci_rp_link_key_reply {
321 __u8 status;
322 bdaddr_t bdaddr;
323} __packed;
324
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200325#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
326struct hci_cp_link_key_neg_reply {
327 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300328} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200330#define HCI_OP_PIN_CODE_REPLY 0x040d
331struct hci_cp_pin_code_reply {
332 bdaddr_t bdaddr;
333 __u8 pin_len;
334 __u8 pin_code[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300335} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200336struct hci_rp_pin_code_reply {
337 __u8 status;
338 bdaddr_t bdaddr;
339} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200340
341#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
342struct hci_cp_pin_code_neg_reply {
343 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300344} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200345struct hci_rp_pin_code_neg_reply {
346 __u8 status;
347 bdaddr_t bdaddr;
348} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200349
350#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
351struct hci_cp_change_conn_ptype {
352 __le16 handle;
353 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300354} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200355
356#define HCI_OP_AUTH_REQUESTED 0x0411
357struct hci_cp_auth_requested {
358 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300359} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200360
361#define HCI_OP_SET_CONN_ENCRYPT 0x0413
362struct hci_cp_set_conn_encrypt {
363 __le16 handle;
364 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300365} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200366
367#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
368struct hci_cp_change_conn_link_key {
369 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300370} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200371
372#define HCI_OP_REMOTE_NAME_REQ 0x0419
373struct hci_cp_remote_name_req {
374 bdaddr_t bdaddr;
375 __u8 pscan_rep_mode;
376 __u8 pscan_mode;
377 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300378} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200379
380#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
381struct hci_cp_remote_name_req_cancel {
382 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300383} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200384
385#define HCI_OP_READ_REMOTE_FEATURES 0x041b
386struct hci_cp_read_remote_features {
387 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300388} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200389
390#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
391struct hci_cp_read_remote_ext_features {
392 __le16 handle;
393 __u8 page;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300394} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200395
396#define HCI_OP_READ_REMOTE_VERSION 0x041d
397struct hci_cp_read_remote_version {
398 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300399} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200400
401#define HCI_OP_SETUP_SYNC_CONN 0x0428
402struct hci_cp_setup_sync_conn {
403 __le16 handle;
404 __le32 tx_bandwidth;
405 __le32 rx_bandwidth;
406 __le16 max_latency;
407 __le16 voice_setting;
408 __u8 retrans_effort;
409 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300410} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200411
412#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
413struct hci_cp_accept_sync_conn_req {
414 bdaddr_t bdaddr;
415 __le32 tx_bandwidth;
416 __le32 rx_bandwidth;
417 __le16 max_latency;
418 __le16 content_format;
419 __u8 retrans_effort;
420 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300421} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200422
423#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
424struct hci_cp_reject_sync_conn_req {
425 bdaddr_t bdaddr;
426 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300427} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200428
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200429#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
430struct hci_cp_io_capability_reply {
431 bdaddr_t bdaddr;
432 __u8 capability;
433 __u8 oob_data;
434 __u8 authentication;
435} __packed;
436
Johan Hedberga5c29682011-02-19 12:05:57 -0300437#define HCI_OP_USER_CONFIRM_REPLY 0x042c
438struct hci_cp_user_confirm_reply {
439 bdaddr_t bdaddr;
440} __packed;
441struct hci_rp_user_confirm_reply {
442 __u8 status;
443 bdaddr_t bdaddr;
444} __packed;
445
446#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
447
Szymon Janc2763eda2011-03-22 13:12:22 +0100448#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
449struct hci_cp_remote_oob_data_reply {
450 bdaddr_t bdaddr;
451 __u8 hash[16];
452 __u8 randomizer[16];
453} __packed;
454
455#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
456struct hci_cp_remote_oob_data_neg_reply {
457 bdaddr_t bdaddr;
458} __packed;
459
Johan Hedberg03b555e2011-01-04 15:40:05 +0200460#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
461struct hci_cp_io_capability_neg_reply {
462 bdaddr_t bdaddr;
463 __u8 reason;
464} __packed;
465
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466#define HCI_OP_CREATE_PHYS_LINK 0x0435
467struct hci_cp_create_phys_link {
468 __u8 phy_handle;
469 __u8 key_len;
470 __u8 type;
471 __u8 data[32];
472} __packed;
473
474#define HCI_OP_ACCEPT_PHYS_LINK 0x0436
475struct hci_cp_accept_phys_link {
476 __u8 phy_handle;
477 __u8 key_len;
478 __u8 type;
479 __u8 data[32];
480} __packed;
481
482#define HCI_OP_DISCONN_PHYS_LINK 0x0437
483struct hci_cp_disconn_phys_link {
484 __u8 phy_handle;
485 __u8 reason;
486} __packed;
487
488struct hci_ext_fs {
489 __u8 id;
490 __u8 type;
491 __le16 max_sdu;
492 __le32 sdu_arr_time;
493 __le32 acc_latency;
494 __le32 flush_to;
495} __packed;
496
497#define HCI_OP_CREATE_LOGICAL_LINK 0x0438
498#define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439
499struct hci_cp_create_logical_link {
500 __u8 phy_handle;
501 struct hci_ext_fs tx_fs;
502 struct hci_ext_fs rx_fs;
503} __packed;
504
505#define HCI_OP_DISCONN_LOGICAL_LINK 0x043a
506struct hci_cp_disconn_logical_link {
507 __le16 log_handle;
508} __packed;
509
510#define HCI_OP_LOGICAL_LINK_CANCEL 0x043b
511struct hci_cp_logical_link_cancel {
512 __u8 phy_handle;
513 __u8 flow_spec_id;
514} __packed;
515
516struct hci_rp_logical_link_cancel {
517 __u8 status;
518 __u8 phy_handle;
519 __u8 flow_spec_id;
520} __packed;
521
522#define HCI_OP_FLOW_SPEC_MODIFY 0x043c
523struct hci_cp_flow_spec_modify {
524 __le16 log_handle;
525 struct hci_ext_fs tx_fs;
526 struct hci_ext_fs rx_fs;
527} __packed;
528
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200529#define HCI_OP_SNIFF_MODE 0x0803
530struct hci_cp_sniff_mode {
531 __le16 handle;
532 __le16 max_interval;
533 __le16 min_interval;
534 __le16 attempt;
535 __le16 timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300536} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200537
538#define HCI_OP_EXIT_SNIFF_MODE 0x0804
539struct hci_cp_exit_sniff_mode {
540 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300541} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200542
543#define HCI_OP_ROLE_DISCOVERY 0x0809
544struct hci_cp_role_discovery {
545 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300546} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200547struct hci_rp_role_discovery {
548 __u8 status;
549 __le16 handle;
550 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300551} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200552
553#define HCI_OP_SWITCH_ROLE 0x080b
554struct hci_cp_switch_role {
555 bdaddr_t bdaddr;
556 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300557} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200558
559#define HCI_OP_READ_LINK_POLICY 0x080c
560struct hci_cp_read_link_policy {
561 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300562} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200563struct hci_rp_read_link_policy {
564 __u8 status;
565 __le16 handle;
566 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300567} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200568
569#define HCI_OP_WRITE_LINK_POLICY 0x080d
570struct hci_cp_write_link_policy {
571 __le16 handle;
572 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300573} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200574struct hci_rp_write_link_policy {
575 __u8 status;
576 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300577} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200578
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200579#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
580struct hci_rp_read_def_link_policy {
581 __u8 status;
582 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300583} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200584
585#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
586struct hci_cp_write_def_link_policy {
587 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300588} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200589
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200590#define HCI_OP_SNIFF_SUBRATE 0x0811
591struct hci_cp_sniff_subrate {
592 __le16 handle;
593 __le16 max_latency;
594 __le16 min_remote_timeout;
595 __le16 min_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300596} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200597
598#define HCI_OP_SET_EVENT_MASK 0x0c01
599struct hci_cp_set_event_mask {
600 __u8 mask[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300601} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200602
603#define HCI_OP_RESET 0x0c03
604
605#define HCI_OP_SET_EVENT_FLT 0x0c05
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606struct hci_cp_set_event_flt {
607 __u8 flt_type;
608 __u8 cond_type;
609 __u8 condition[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300610} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611
612/* Filter types */
613#define HCI_FLT_CLEAR_ALL 0x00
614#define HCI_FLT_INQ_RESULT 0x01
615#define HCI_FLT_CONN_SETUP 0x02
616
617/* CONN_SETUP Condition types */
618#define HCI_CONN_SETUP_ALLOW_ALL 0x00
619#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
620#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
621
622/* CONN_SETUP Conditions */
623#define HCI_CONN_SETUP_AUTO_OFF 0x01
624#define HCI_CONN_SETUP_AUTO_ON 0x02
625
Johan Hedbergb0916ea2011-01-10 13:44:55 +0200626#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
627struct hci_cp_delete_stored_link_key {
628 bdaddr_t bdaddr;
629 __u8 delete_all;
630} __packed;
631
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200632#define HCI_MAX_NAME_LENGTH 248
633
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200634#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
635struct hci_cp_write_local_name {
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200636 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300637} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200638
639#define HCI_OP_READ_LOCAL_NAME 0x0c14
640struct hci_rp_read_local_name {
641 __u8 status;
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200642 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300643} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200644
645#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
646
647#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
648
Andrei Emeltchenko70f230202010-12-01 16:58:25 +0200649#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200650 #define SCAN_DISABLED 0x00
651 #define SCAN_INQUIRY 0x01
652 #define SCAN_PAGE 0x02
653
654#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
655
656#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
657 #define AUTH_DISABLED 0x00
658 #define AUTH_ENABLED 0x01
659
660#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
661
662#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
663 #define ENCRYPT_DISABLED 0x00
664 #define ENCRYPT_P2P 0x01
665 #define ENCRYPT_BOTH 0x02
666
667#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
668struct hci_rp_read_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 __u8 status;
670 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300671} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200673#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
674struct hci_cp_write_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300676} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200678#define HCI_OP_READ_VOICE_SETTING 0x0c25
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679struct hci_rp_read_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800680 __u8 status;
681 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300682} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200684#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685struct hci_cp_write_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800686 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300687} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200689#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800691 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800693 __le16 acl_max_pkt;
694 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300695} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696
Johan Hedbergd5859e22011-01-25 01:19:58 +0200697#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
698
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300699#define HCI_MAX_EIR_LENGTH 240
700
701#define HCI_OP_WRITE_EIR 0x0c52
702struct hci_cp_write_eir {
703 uint8_t fec;
704 uint8_t data[HCI_MAX_EIR_LENGTH];
705} __packed;
706
Marcel Holtmann333140b2008-07-14 20:13:48 +0200707#define HCI_OP_READ_SSP_MODE 0x0c55
708struct hci_rp_read_ssp_mode {
709 __u8 status;
710 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300711} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200712
713#define HCI_OP_WRITE_SSP_MODE 0x0c56
714struct hci_cp_write_ssp_mode {
715 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300716} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200717
Szymon Jancc35938b2011-03-22 13:12:21 +0100718#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
719struct hci_rp_read_local_oob_data {
720 __u8 status;
721 __u8 hash[16];
722 __u8 randomizer[16];
723} __packed;
724
Johan Hedbergd5859e22011-01-25 01:19:58 +0200725#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
726
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700727#define HCI_OP_READ_LL_TIMEOUT 0x0c61
728struct hci_rp_read_ll_timeout {
729 __u8 status;
730 __le16 timeout;
731} __packed;
732
733#define HCI_OP_WRITE_LL_TIMEOUT 0x0c62
734struct hci_cp_write_ll_timeout {
735 __le16 timeout;
736} __packed;
737
738#define HCI_OP_SET_EVENT_MASK_PAGE2 0x0c63
739struct hci_cp_set_event_mask_page2 {
740 __u8 mask[8];
741} __packed;
742
743#define HCI_OP_READ_LOCATION_DATA 0x0c64
744struct hci_rp_read_location_data {
745 __u8 status;
746 __u8 loc_dom_aware;
747 __u8 loc_dom;
748 __u8 loc_dom_opts;
749 __u8 loc_opts;
750} __packed;
751
752#define HCI_OP_WRITE_LOCATION_DATA 0x0c65
753struct hci_cp_write_location_data {
754 __u8 loc_dom_aware;
755 __u8 loc_dom;
756 __u8 loc_dom_opts;
757 __u8 loc_opts;
758} __packed;
759
760#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
761struct hci_rp_read_flow_control_mode {
762 __u8 status;
763 __u8 mode;
764} __packed;
765
766#define HCI_OP_WRITE_FLOW_CONTROL_MODE 0x0c67
767struct hci_cp_write_flow_control_mode {
768 __u8 mode;
769} __packed;
770
771#define HCI_OP_READ_BE_FLUSH_TIMEOUT 0x0c69
772struct hci_cp_read_be_flush_timeout {
773 __le16 log_handle;
774} __packed;
775
776struct hci_rp_read_be_flush_timeout {
777 __u8 status;
778 __le32 timeout;
779} __packed;
780
781#define HCI_OP_WRITE_BE_FLUSH_TIMEOUT 0x0c6a
782struct hci_cp_write_be_flush_timeout {
783 __le16 log_handle;
784 __le32 timeout;
785} __packed;
786
787#define HCI_OP_SHORT_RANGE_MODE 0x0c6b
788struct hci_cp_short_range_mode {
789 __u8 phy_handle;
790 __u8 mode;
Andre Guedese326af42011-06-30 19:20:53 -0300791} __packed;
792
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200793#define HCI_OP_READ_LOCAL_VERSION 0x1001
794struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200796 __u8 hci_ver;
797 __le16 hci_rev;
798 __u8 lmp_ver;
799 __le16 manufacturer;
800 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300801} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200803#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
804struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200806 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300807} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200809#define HCI_OP_READ_LOCAL_FEATURES 0x1003
810struct hci_rp_read_local_features {
811 __u8 status;
812 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300813} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200814
815#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
816struct hci_rp_read_local_ext_features {
817 __u8 status;
818 __u8 page;
819 __u8 max_page;
820 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300821} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200822
823#define HCI_OP_READ_BUFFER_SIZE 0x1005
824struct hci_rp_read_buffer_size {
825 __u8 status;
826 __le16 acl_mtu;
827 __u8 sco_mtu;
828 __le16 acl_max_pkt;
829 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300830} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200831
832#define HCI_OP_READ_BD_ADDR 0x1009
833struct hci_rp_read_bd_addr {
834 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300836} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700838#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
839struct hci_rp_read_data_block_size {
840 __u8 status;
841 __le16 max_acl_len;
842 __le16 data_block_len;
843 __le16 num_blocks;
844} __packed;
845
846#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
847struct hci_rp_read_local_amp_info {
848 __u8 status;
849 __u8 amp_status;
850 __le32 total_bw;
851 __le32 max_bw;
852 __le32 min_latency;
853 __le32 max_pdu;
854 __u8 amp_type;
855 __le16 pal_cap;
856 __le16 max_assoc_size;
857 __le32 max_flush_to;
858 __le32 be_flush_to;
859} __packed;
860
861#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
862struct hci_cp_read_local_amp_assoc {
863 __u8 phy_handle;
864 __le16 len_so_far;
865 __le16 max_len;
866} __packed;
867
868struct hci_rp_read_local_amp_assoc {
869 __u8 status;
870 __u8 phy_handle;
871 __le16 rem_len;
872 __u8 frag[248];
873} __packed;
874
875#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
876struct hci_cp_write_remote_amp_assoc {
877 __u8 phy_handle;
878 __le16 len_so_far;
879 __le16 rem_len;
880 __u8 frag[248];
881} __packed;
882
883struct hci_rp_write_remote_amp_assoc {
884 __u8 status;
885 __u8 phy_handle;
886} __packed;
887
Ville Tervo63185f62011-02-10 22:38:46 -0300888#define HCI_OP_LE_SET_EVENT_MASK 0x2001
889struct hci_cp_le_set_event_mask {
890 __u8 mask[8];
891} __packed;
892
893#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
894struct hci_rp_le_read_buffer_size {
895 __u8 status;
896 __le16 le_mtu;
897 __u8 le_max_pkt;
898} __packed;
899
Brian Gixa68668b2011-08-11 15:49:36 -0700900#define HCI_OP_LE_SET_SCAN_PARAMETERS 0x200b
901struct hci_cp_le_set_scan_parameters {
902 __u8 type;
903 __le16 interval;
904 __le16 window;
905 __u8 own_bdaddr_type;
906 __u8 filter;
907} __packed;
908
Andre Guedes726e1332011-05-26 16:23:52 -0300909#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
Brian Gixa68668b2011-08-11 15:49:36 -0700910struct hci_cp_le_set_scan_enable {
911 __u8 enable;
912 __u8 filter_dup;
913} __packed;
Andre Guedes726e1332011-05-26 16:23:52 -0300914
Ville Tervo63185f62011-02-10 22:38:46 -0300915#define HCI_OP_LE_CREATE_CONN 0x200d
916struct hci_cp_le_create_conn {
917 __le16 scan_interval;
918 __le16 scan_window;
919 __u8 filter_policy;
920 __u8 peer_addr_type;
921 bdaddr_t peer_addr;
922 __u8 own_address_type;
923 __le16 conn_interval_min;
924 __le16 conn_interval_max;
925 __le16 conn_latency;
926 __le16 supervision_timeout;
927 __le16 min_ce_len;
928 __le16 max_ce_len;
929} __packed;
930
931#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
932
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200933#define HCI_OP_LE_CONN_UPDATE 0x2013
934struct hci_cp_le_conn_update {
935 __le16 handle;
936 __le16 conn_interval_min;
937 __le16 conn_interval_max;
938 __le16 conn_latency;
939 __le16 supervision_timeout;
940 __le16 min_ce_len;
941 __le16 max_ce_len;
942} __packed;
943
Brian Gixa68668b2011-08-11 15:49:36 -0700944#define HCI_OP_LE_ENCRYPT 0x2017
945struct hci_cp_le_encrypt {
946 __u8 key[16];
947 __u8 data[16];
948} __packed;
949struct hci_cp_le_encrypt_reply {
950 __u8 status;
951 __u8 encrypted[16];
952} __packed;
953
Vinicius Costa Gomes735038c2011-06-09 18:50:47 -0300954#define HCI_OP_LE_START_ENC 0x2019
955struct hci_cp_le_start_enc {
956 __le16 handle;
957 __u8 rand[8];
958 __le16 ediv;
959 __u8 ltk[16];
960} __packed;
961
962#define HCI_OP_LE_LTK_REPLY 0x201a
963struct hci_cp_le_ltk_reply {
964 __le16 handle;
965 __u8 ltk[16];
966} __packed;
967struct hci_rp_le_ltk_reply {
968 __u8 status;
969 __le16 handle;
970} __packed;
971
972#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
973struct hci_cp_le_ltk_neg_reply {
974 __le16 handle;
975} __packed;
976struct hci_rp_le_ltk_neg_reply {
977 __u8 status;
978 __le16 handle;
979} __packed;
980
Linus Torvalds1da177e2005-04-16 15:20:36 -0700981/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200982#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -0700983
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200984#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -0700985struct inquiry_info {
986 bdaddr_t bdaddr;
987 __u8 pscan_rep_mode;
988 __u8 pscan_period_mode;
989 __u8 pscan_mode;
990 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800991 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300992} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700993
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200994#define HCI_EV_CONN_COMPLETE 0x03
995struct hci_ev_conn_complete {
996 __u8 status;
997 __le16 handle;
998 bdaddr_t bdaddr;
999 __u8 link_type;
1000 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001001} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001002
1003#define HCI_EV_CONN_REQUEST 0x04
1004struct hci_ev_conn_request {
1005 bdaddr_t bdaddr;
1006 __u8 dev_class[3];
1007 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001008} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001009
1010#define HCI_EV_DISCONN_COMPLETE 0x05
1011struct hci_ev_disconn_complete {
1012 __u8 status;
1013 __le16 handle;
1014 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001015} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001016
1017#define HCI_EV_AUTH_COMPLETE 0x06
1018struct hci_ev_auth_complete {
1019 __u8 status;
1020 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001021} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001022
1023#define HCI_EV_REMOTE_NAME 0x07
1024struct hci_ev_remote_name {
1025 __u8 status;
1026 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001027 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001028} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001029
1030#define HCI_EV_ENCRYPT_CHANGE 0x08
1031struct hci_ev_encrypt_change {
1032 __u8 status;
1033 __le16 handle;
1034 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001035} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001036
1037#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1038struct hci_ev_change_link_key_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_FEATURES 0x0b
1044struct hci_ev_remote_features {
1045 __u8 status;
1046 __le16 handle;
1047 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001048} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001049
1050#define HCI_EV_REMOTE_VERSION 0x0c
1051struct hci_ev_remote_version {
1052 __u8 status;
1053 __le16 handle;
1054 __u8 lmp_ver;
1055 __le16 manufacturer;
1056 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001057} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001058
1059#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1060struct hci_qos {
1061 __u8 service_type;
1062 __u32 token_rate;
1063 __u32 peak_bandwidth;
1064 __u32 latency;
1065 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001066} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001067struct hci_ev_qos_setup_complete {
1068 __u8 status;
1069 __le16 handle;
1070 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001071} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001072
1073#define HCI_EV_CMD_COMPLETE 0x0e
1074struct hci_ev_cmd_complete {
1075 __u8 ncmd;
1076 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001077} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001078
1079#define HCI_EV_CMD_STATUS 0x0f
1080struct hci_ev_cmd_status {
1081 __u8 status;
1082 __u8 ncmd;
1083 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001084} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001085
1086#define HCI_EV_ROLE_CHANGE 0x12
1087struct hci_ev_role_change {
1088 __u8 status;
1089 bdaddr_t bdaddr;
1090 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001091} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001092
1093#define HCI_EV_NUM_COMP_PKTS 0x13
1094struct hci_ev_num_comp_pkts {
1095 __u8 num_hndl;
1096 /* variable length part */
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001097} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001098
1099#define HCI_EV_MODE_CHANGE 0x14
1100struct hci_ev_mode_change {
1101 __u8 status;
1102 __le16 handle;
1103 __u8 mode;
1104 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001105} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001106
1107#define HCI_EV_PIN_CODE_REQ 0x16
1108struct hci_ev_pin_code_req {
1109 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001110} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001111
1112#define HCI_EV_LINK_KEY_REQ 0x17
1113struct hci_ev_link_key_req {
1114 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001115} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001116
1117#define HCI_EV_LINK_KEY_NOTIFY 0x18
1118struct hci_ev_link_key_notify {
1119 bdaddr_t bdaddr;
1120 __u8 link_key[16];
1121 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001122} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001123
1124#define HCI_EV_CLOCK_OFFSET 0x1c
1125struct hci_ev_clock_offset {
1126 __u8 status;
1127 __le16 handle;
1128 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001129} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001130
Marcel Holtmanna8746412008-07-14 20:13:46 +02001131#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1132struct hci_ev_pkt_type_change {
1133 __u8 status;
1134 __le16 handle;
1135 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001136} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001137
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001138#define HCI_EV_PSCAN_REP_MODE 0x20
1139struct hci_ev_pscan_rep_mode {
1140 bdaddr_t bdaddr;
1141 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001142} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001143
Linus Torvalds1da177e2005-04-16 15:20:36 -07001144#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1145struct inquiry_info_with_rssi {
1146 bdaddr_t bdaddr;
1147 __u8 pscan_rep_mode;
1148 __u8 pscan_period_mode;
1149 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001150 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001151 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001152} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001153struct inquiry_info_with_rssi_and_pscan_mode {
1154 bdaddr_t bdaddr;
1155 __u8 pscan_rep_mode;
1156 __u8 pscan_period_mode;
1157 __u8 pscan_mode;
1158 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001159 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001160 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001161} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001163#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1164struct hci_ev_remote_ext_features {
1165 __u8 status;
1166 __le16 handle;
1167 __u8 page;
1168 __u8 max_page;
1169 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001170} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001171
1172#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1173struct hci_ev_sync_conn_complete {
1174 __u8 status;
1175 __le16 handle;
1176 bdaddr_t bdaddr;
1177 __u8 link_type;
1178 __u8 tx_interval;
1179 __u8 retrans_window;
1180 __le16 rx_pkt_len;
1181 __le16 tx_pkt_len;
1182 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001183} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001184
1185#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1186struct hci_ev_sync_conn_changed {
1187 __u8 status;
1188 __le16 handle;
1189 __u8 tx_interval;
1190 __u8 retrans_window;
1191 __le16 rx_pkt_len;
1192 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001193} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001194
1195#define HCI_EV_SNIFF_SUBRATE 0x2e
1196struct hci_ev_sniff_subrate {
1197 __u8 status;
1198 __le16 handle;
1199 __le16 max_tx_latency;
1200 __le16 max_rx_latency;
1201 __le16 max_remote_timeout;
1202 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001203} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001204
1205#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001206struct extended_inquiry_info {
1207 bdaddr_t bdaddr;
1208 __u8 pscan_rep_mode;
1209 __u8 pscan_period_mode;
1210 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001211 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001212 __s8 rssi;
1213 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001214} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001215
Marcel Holtmann04936842008-07-14 20:13:48 +02001216#define HCI_EV_IO_CAPA_REQUEST 0x31
1217struct hci_ev_io_capa_request {
1218 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001219} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001220
Johan Hedberg03b555e2011-01-04 15:40:05 +02001221#define HCI_EV_IO_CAPA_REPLY 0x32
1222struct hci_ev_io_capa_reply {
1223 bdaddr_t bdaddr;
1224 __u8 capability;
1225 __u8 oob_data;
1226 __u8 authentication;
1227} __packed;
1228
Johan Hedberga5c29682011-02-19 12:05:57 -03001229#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1230struct hci_ev_user_confirm_req {
1231 bdaddr_t bdaddr;
1232 __le32 passkey;
1233} __packed;
1234
Brian Gixa68668b2011-08-11 15:49:36 -07001235#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1236struct hci_ev_user_passkey_request {
1237 bdaddr_t bdaddr;
1238} __packed;
1239
Szymon Janc2763eda2011-03-22 13:12:22 +01001240#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1241struct hci_ev_remote_oob_data_request {
1242 bdaddr_t bdaddr;
1243} __packed;
1244
Marcel Holtmann04936842008-07-14 20:13:48 +02001245#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1246struct hci_ev_simple_pair_complete {
1247 __u8 status;
1248 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001249} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001250
Brian Gixa68668b2011-08-11 15:49:36 -07001251#define HCI_EV_USER_PASSKEY_NOTIFICATION 0x3b
1252struct hci_ev_user_passkey_notification {
1253 bdaddr_t bdaddr;
1254 __le32 passkey;
1255} __packed;
1256
Marcel Holtmann41a96212008-07-14 20:13:48 +02001257#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1258struct hci_ev_remote_host_features {
1259 bdaddr_t bdaddr;
1260 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001261} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001262
Ville Tervo63185f62011-02-10 22:38:46 -03001263#define HCI_EV_LE_META 0x3e
1264struct hci_ev_le_meta {
1265 __u8 subevent;
1266} __packed;
1267
1268/* Low energy meta events */
1269#define HCI_EV_LE_CONN_COMPLETE 0x01
1270struct hci_ev_le_conn_complete {
1271 __u8 status;
1272 __le16 handle;
1273 __u8 role;
1274 __u8 bdaddr_type;
1275 bdaddr_t bdaddr;
1276 __le16 interval;
1277 __le16 latency;
1278 __le16 supervision_timeout;
1279 __u8 clk_accurancy;
1280} __packed;
1281
Anderson Briglia1c3cc1182011-05-26 16:23:49 -03001282#define ADV_IND 0x00
1283#define ADV_DIRECT_IND 0x01
1284#define ADV_SCAN_IND 0x02
1285#define ADV_NONCONN_IND 0x03
1286#define ADV_SCAN_RSP 0x04
1287
1288#define ADDR_LE_DEV_PUBLIC 0x00
1289#define ADDR_LE_DEV_RANDOM 0x01
1290
1291#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1292struct hci_ev_le_advertising_info {
1293 __u8 evt_type;
1294 __u8 bdaddr_type;
1295 bdaddr_t bdaddr;
1296 __u8 length;
1297 __u8 data[0];
1298} __packed;
1299
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300#define HCI_EV_LE_LTK_REQ 0x05
1301struct hci_ev_le_ltk_req {
1302 __le16 handle;
1303 __u8 random[8];
1304 __le16 ediv;
1305} __packed;
1306
1307#define HCI_EV_PHYS_LINK_COMPLETE 0x40
1308struct hci_ev_phys_link_complete {
1309 __u8 status;
1310 __u8 phy_handle;
1311} __packed;
1312
1313#define HCI_EV_CHANNEL_SELECTED 0x41
1314struct hci_ev_channel_selected {
1315 __u8 phy_handle;
1316} __packed;
1317
1318#define HCI_EV_DISCONN_PHYS_LINK_COMPLETE 0x42
1319struct hci_ev_disconn_phys_link_complete {
1320 __u8 status;
1321 __u8 phy_handle;
1322 __u8 reason;
1323} __packed;
1324
1325#define HCI_EV_LOG_LINK_COMPLETE 0x45
1326struct hci_ev_log_link_complete {
1327 __u8 status;
1328 __le16 log_handle;
1329 __u8 phy_handle;
1330 __u8 flow_spec_id;
1331} __packed;
1332
1333#define HCI_EV_DISCONN_LOG_LINK_COMPLETE 0x46
1334struct hci_ev_disconn_log_link_complete {
1335 __u8 status;
1336 __le16 log_handle;
1337 __u8 reason;
1338} __packed;
1339
1340#define HCI_EV_FLOW_SPEC_MODIFY_COMPLETE 0x47
1341struct hci_ev_flow_spec_modify_complete {
1342 __u8 status;
1343 __le16 log_handle;
1344} __packed;
1345
1346#define HCI_EV_NUM_COMP_BLOCKS 0x48
1347struct hci_ev_num_comp_blocks {
1348 __le16 total_num_blocks;
1349 __u8 num_hndl;
1350 /* variable length part */
1351} __packed;
1352
1353#define HCI_EV_SHORT_RANGE_MODE_COMPLETE 0x4c
1354struct hci_ev_short_range_mode_complete {
1355 __u8 status;
1356 __u8 phy_handle;
1357 __u8 mode;
1358} __packed;
1359
1360#define HCI_EV_AMP_STATUS_CHANGE 0x4d
1361struct hci_ev_amp_status_change {
1362 __u8 status;
1363 __u8 amp_status;
1364} __packed;
1365
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001367#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001368struct hci_ev_stack_internal {
1369 __u16 type;
1370 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001371} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001372
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001373#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001374struct hci_ev_si_device {
1375 __u16 event;
1376 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001377} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001378
1379#define HCI_EV_SI_SECURITY 0x02
1380struct hci_ev_si_security {
1381 __u16 event;
1382 __u16 proto;
1383 __u16 subproto;
1384 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001385} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001386
1387/* ---- HCI Packet structures ---- */
1388#define HCI_COMMAND_HDR_SIZE 3
1389#define HCI_EVENT_HDR_SIZE 2
1390#define HCI_ACL_HDR_SIZE 4
1391#define HCI_SCO_HDR_SIZE 3
1392
1393struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001394 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001395 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001396} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397
1398struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001399 __u8 evt;
1400 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001401} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001402
1403struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001404 __le16 handle; /* Handle & Flags(PB, BC) */
1405 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001406} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001407
1408struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001409 __le16 handle;
1410 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001411} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001412
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001413#ifdef __KERNEL__
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001414#include <linux/skbuff.h>
1415static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1416{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001417 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001418}
1419
1420static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1421{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001422 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001423}
1424
1425static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1426{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001427 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001428}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429#endif
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001430
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001432#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433#define hci_opcode_ogf(op) (op >> 10)
1434#define hci_opcode_ocf(op) (op & 0x03ff)
1435
1436/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001437#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438#define hci_handle(h) (h & 0x0fff)
1439#define hci_flags(h) (h >> 12)
1440
1441/* ---- HCI Sockets ---- */
1442
1443/* Socket options */
1444#define HCI_DATA_DIR 1
1445#define HCI_FILTER 2
1446#define HCI_TIME_STAMP 3
1447
1448/* CMSG flags */
1449#define HCI_CMSG_DIR 0x0001
1450#define HCI_CMSG_TSTAMP 0x0002
1451
1452struct sockaddr_hci {
1453 sa_family_t hci_family;
1454 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001455 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001456};
1457#define HCI_DEV_NONE 0xffff
1458
Johan Hedbergc02178d2010-12-08 00:21:05 +02001459#define HCI_CHANNEL_RAW 0
1460#define HCI_CHANNEL_CONTROL 1
1461
Linus Torvalds1da177e2005-04-16 15:20:36 -07001462struct hci_filter {
1463 unsigned long type_mask;
1464 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001465 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466};
1467
1468struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001469 __u32 type_mask;
1470 __u32 event_mask[2];
1471 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472};
1473
1474#define HCI_FLT_TYPE_BITS 31
1475#define HCI_FLT_EVENT_BITS 63
1476#define HCI_FLT_OGF_BITS 63
1477#define HCI_FLT_OCF_BITS 127
1478
1479/* ---- HCI Ioctl requests structures ---- */
1480struct hci_dev_stats {
1481 __u32 err_rx;
1482 __u32 err_tx;
1483 __u32 cmd_tx;
1484 __u32 evt_rx;
1485 __u32 acl_tx;
1486 __u32 acl_rx;
1487 __u32 sco_tx;
1488 __u32 sco_rx;
1489 __u32 byte_rx;
1490 __u32 byte_tx;
1491};
1492
1493struct hci_dev_info {
1494 __u16 dev_id;
1495 char name[8];
1496
1497 bdaddr_t bdaddr;
1498
1499 __u32 flags;
1500 __u8 type;
1501
1502 __u8 features[8];
1503
1504 __u32 pkt_type;
1505 __u32 link_policy;
1506 __u32 link_mode;
1507
1508 __u16 acl_mtu;
1509 __u16 acl_pkts;
1510 __u16 sco_mtu;
1511 __u16 sco_pkts;
1512
1513 struct hci_dev_stats stat;
1514};
1515
1516struct hci_conn_info {
1517 __u16 handle;
1518 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001519 __u8 type;
1520 __u8 out;
1521 __u16 state;
1522 __u32 link_mode;
Nick Pellyc1728492009-12-09 00:15:41 -08001523 __u32 mtu;
1524 __u32 cnt;
1525 __u32 pkts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001526 __u8 pending_sec_level;
1527 __u8 ssp_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001528};
1529
1530struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001531 __u16 dev_id;
1532 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001533};
1534
1535struct hci_dev_list_req {
1536 __u16 dev_num;
1537 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1538};
1539
1540struct hci_conn_list_req {
1541 __u16 dev_id;
1542 __u16 conn_num;
1543 struct hci_conn_info conn_info[0];
1544};
1545
1546struct hci_conn_info_req {
1547 bdaddr_t bdaddr;
1548 __u8 type;
1549 struct hci_conn_info conn_info[0];
1550};
1551
Marcel Holtmann40be4922008-07-14 20:13:50 +02001552struct hci_auth_info_req {
1553 bdaddr_t bdaddr;
1554 __u8 type;
1555};
1556
Linus Torvalds1da177e2005-04-16 15:20:36 -07001557struct hci_inquiry_req {
1558 __u16 dev_id;
1559 __u16 flags;
1560 __u8 lap[3];
1561 __u8 length;
1562 __u8 num_rsp;
1563};
1564#define IREQ_CACHE_FLUSH 0x0001
1565
1566#endif /* __HCI_H */