blob: cd8585523c0259154fde76011356ca3c81856c19 [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
Srinivas Krovvidi10734192011-12-29 07:29:11 +05303 Copyright (c) 2000-2001, 2010-2012 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 */
Brian Gix6e4531c2011-10-28 16:12:08 -0700127#define HCI_CMD_TIMEOUT (5000) /* 5 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
Srinivas Krovvidi10734192011-12-29 07:29:11 +0530703#define HCI_OP_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0c28
704struct hci_cp_write_automatic_flush_timeout {
705 __le16 handle;
706 __le16 timeout;
707} __packed;
708
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200709#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800711 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800713 __le16 acl_max_pkt;
714 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300715} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716
Brian Gix8a7f1642011-10-17 17:39:46 -0700717#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
718struct hci_cp_write_current_iac_lap {
719 __u8 num_current_iac;
720 __u8 lap[6];
721} __packed;
722
Johan Hedbergd5859e22011-01-25 01:19:58 +0200723#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
724
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300725#define HCI_MAX_EIR_LENGTH 240
726
727#define HCI_OP_WRITE_EIR 0x0c52
728struct hci_cp_write_eir {
729 uint8_t fec;
730 uint8_t data[HCI_MAX_EIR_LENGTH];
731} __packed;
732
Marcel Holtmann333140b2008-07-14 20:13:48 +0200733#define HCI_OP_READ_SSP_MODE 0x0c55
734struct hci_rp_read_ssp_mode {
735 __u8 status;
736 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300737} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200738
739#define HCI_OP_WRITE_SSP_MODE 0x0c56
740struct hci_cp_write_ssp_mode {
741 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300742} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200743
Szymon Jancc35938b2011-03-22 13:12:21 +0100744#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
745struct hci_rp_read_local_oob_data {
746 __u8 status;
747 __u8 hash[16];
748 __u8 randomizer[16];
749} __packed;
750
Johan Hedbergd5859e22011-01-25 01:19:58 +0200751#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
752
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700753#define HCI_OP_READ_LL_TIMEOUT 0x0c61
754struct hci_rp_read_ll_timeout {
755 __u8 status;
756 __le16 timeout;
757} __packed;
758
759#define HCI_OP_WRITE_LL_TIMEOUT 0x0c62
760struct hci_cp_write_ll_timeout {
761 __le16 timeout;
762} __packed;
763
764#define HCI_OP_SET_EVENT_MASK_PAGE2 0x0c63
765struct hci_cp_set_event_mask_page2 {
766 __u8 mask[8];
767} __packed;
768
769#define HCI_OP_READ_LOCATION_DATA 0x0c64
770struct hci_rp_read_location_data {
771 __u8 status;
772 __u8 loc_dom_aware;
773 __u8 loc_dom;
774 __u8 loc_dom_opts;
775 __u8 loc_opts;
776} __packed;
777
778#define HCI_OP_WRITE_LOCATION_DATA 0x0c65
779struct hci_cp_write_location_data {
780 __u8 loc_dom_aware;
781 __u8 loc_dom;
782 __u8 loc_dom_opts;
783 __u8 loc_opts;
784} __packed;
785
786#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
787struct hci_rp_read_flow_control_mode {
788 __u8 status;
789 __u8 mode;
790} __packed;
791
792#define HCI_OP_WRITE_FLOW_CONTROL_MODE 0x0c67
793struct hci_cp_write_flow_control_mode {
794 __u8 mode;
795} __packed;
796
797#define HCI_OP_READ_BE_FLUSH_TIMEOUT 0x0c69
798struct hci_cp_read_be_flush_timeout {
799 __le16 log_handle;
800} __packed;
801
802struct hci_rp_read_be_flush_timeout {
803 __u8 status;
804 __le32 timeout;
805} __packed;
806
807#define HCI_OP_WRITE_BE_FLUSH_TIMEOUT 0x0c6a
808struct hci_cp_write_be_flush_timeout {
809 __le16 log_handle;
810 __le32 timeout;
811} __packed;
812
813#define HCI_OP_SHORT_RANGE_MODE 0x0c6b
814struct hci_cp_short_range_mode {
815 __u8 phy_handle;
816 __u8 mode;
Andre Guedese326af42011-06-30 19:20:53 -0300817} __packed;
818
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200819#define HCI_OP_READ_LOCAL_VERSION 0x1001
820struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200822 __u8 hci_ver;
823 __le16 hci_rev;
824 __u8 lmp_ver;
825 __le16 manufacturer;
826 __le16 lmp_subver;
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_COMMANDS 0x1002
830struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200832 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300833} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200835#define HCI_OP_READ_LOCAL_FEATURES 0x1003
836struct hci_rp_read_local_features {
837 __u8 status;
838 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300839} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200840
841#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
842struct hci_rp_read_local_ext_features {
843 __u8 status;
844 __u8 page;
845 __u8 max_page;
846 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300847} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200848
849#define HCI_OP_READ_BUFFER_SIZE 0x1005
850struct hci_rp_read_buffer_size {
851 __u8 status;
852 __le16 acl_mtu;
853 __u8 sco_mtu;
854 __le16 acl_max_pkt;
855 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300856} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200857
858#define HCI_OP_READ_BD_ADDR 0x1009
859struct hci_rp_read_bd_addr {
860 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300862} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
865struct hci_rp_read_data_block_size {
866 __u8 status;
867 __le16 max_acl_len;
868 __le16 data_block_len;
869 __le16 num_blocks;
870} __packed;
871
872#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
873struct hci_rp_read_local_amp_info {
874 __u8 status;
875 __u8 amp_status;
876 __le32 total_bw;
877 __le32 max_bw;
878 __le32 min_latency;
879 __le32 max_pdu;
880 __u8 amp_type;
881 __le16 pal_cap;
882 __le16 max_assoc_size;
883 __le32 max_flush_to;
884 __le32 be_flush_to;
885} __packed;
886
887#define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a
888struct hci_cp_read_local_amp_assoc {
889 __u8 phy_handle;
890 __le16 len_so_far;
891 __le16 max_len;
892} __packed;
893
894struct hci_rp_read_local_amp_assoc {
895 __u8 status;
896 __u8 phy_handle;
897 __le16 rem_len;
898 __u8 frag[248];
899} __packed;
900
901#define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b
902struct hci_cp_write_remote_amp_assoc {
903 __u8 phy_handle;
904 __le16 len_so_far;
905 __le16 rem_len;
906 __u8 frag[248];
907} __packed;
908
909struct hci_rp_write_remote_amp_assoc {
910 __u8 status;
911 __u8 phy_handle;
912} __packed;
913
Ville Tervo63185f62011-02-10 22:38:46 -0300914#define HCI_OP_LE_SET_EVENT_MASK 0x2001
915struct hci_cp_le_set_event_mask {
916 __u8 mask[8];
917} __packed;
918
919#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
920struct hci_rp_le_read_buffer_size {
921 __u8 status;
922 __le16 le_mtu;
923 __u8 le_max_pkt;
924} __packed;
925
Brian Gixa68668b2011-08-11 15:49:36 -0700926#define HCI_OP_LE_SET_SCAN_PARAMETERS 0x200b
927struct hci_cp_le_set_scan_parameters {
928 __u8 type;
929 __le16 interval;
930 __le16 window;
931 __u8 own_bdaddr_type;
932 __u8 filter;
933} __packed;
934
Andre Guedes726e1332011-05-26 16:23:52 -0300935#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
Brian Gixa68668b2011-08-11 15:49:36 -0700936struct hci_cp_le_set_scan_enable {
937 __u8 enable;
938 __u8 filter_dup;
939} __packed;
Andre Guedes726e1332011-05-26 16:23:52 -0300940
Ville Tervo63185f62011-02-10 22:38:46 -0300941#define HCI_OP_LE_CREATE_CONN 0x200d
942struct hci_cp_le_create_conn {
943 __le16 scan_interval;
944 __le16 scan_window;
945 __u8 filter_policy;
946 __u8 peer_addr_type;
947 bdaddr_t peer_addr;
948 __u8 own_address_type;
949 __le16 conn_interval_min;
950 __le16 conn_interval_max;
951 __le16 conn_latency;
952 __le16 supervision_timeout;
953 __le16 min_ce_len;
954 __le16 max_ce_len;
955} __packed;
956
957#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
958
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200959#define HCI_OP_LE_CONN_UPDATE 0x2013
960struct hci_cp_le_conn_update {
961 __le16 handle;
962 __le16 conn_interval_min;
963 __le16 conn_interval_max;
964 __le16 conn_latency;
965 __le16 supervision_timeout;
966 __le16 min_ce_len;
967 __le16 max_ce_len;
968} __packed;
969
Brian Gixa68668b2011-08-11 15:49:36 -0700970#define HCI_OP_LE_ENCRYPT 0x2017
971struct hci_cp_le_encrypt {
972 __u8 key[16];
973 __u8 data[16];
974} __packed;
975struct hci_cp_le_encrypt_reply {
976 __u8 status;
977 __u8 encrypted[16];
978} __packed;
979
Vinicius Costa Gomes735038c2011-06-09 18:50:47 -0300980#define HCI_OP_LE_START_ENC 0x2019
981struct hci_cp_le_start_enc {
982 __le16 handle;
983 __u8 rand[8];
984 __le16 ediv;
985 __u8 ltk[16];
986} __packed;
987
988#define HCI_OP_LE_LTK_REPLY 0x201a
989struct hci_cp_le_ltk_reply {
990 __le16 handle;
991 __u8 ltk[16];
992} __packed;
993struct hci_rp_le_ltk_reply {
994 __u8 status;
995 __le16 handle;
996} __packed;
997
998#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
999struct hci_cp_le_ltk_neg_reply {
1000 __le16 handle;
1001} __packed;
1002struct hci_rp_le_ltk_neg_reply {
1003 __u8 status;
1004 __le16 handle;
1005} __packed;
1006
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001008#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001010#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -07001011struct inquiry_info {
1012 bdaddr_t bdaddr;
1013 __u8 pscan_rep_mode;
1014 __u8 pscan_period_mode;
1015 __u8 pscan_mode;
1016 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001017 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001018} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001020#define HCI_EV_CONN_COMPLETE 0x03
1021struct hci_ev_conn_complete {
1022 __u8 status;
1023 __le16 handle;
1024 bdaddr_t bdaddr;
1025 __u8 link_type;
1026 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001027} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001028
1029#define HCI_EV_CONN_REQUEST 0x04
1030struct hci_ev_conn_request {
1031 bdaddr_t bdaddr;
1032 __u8 dev_class[3];
1033 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001034} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001035
1036#define HCI_EV_DISCONN_COMPLETE 0x05
1037struct hci_ev_disconn_complete {
1038 __u8 status;
1039 __le16 handle;
1040 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001041} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001042
1043#define HCI_EV_AUTH_COMPLETE 0x06
1044struct hci_ev_auth_complete {
1045 __u8 status;
1046 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001047} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001048
1049#define HCI_EV_REMOTE_NAME 0x07
1050struct hci_ev_remote_name {
1051 __u8 status;
1052 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +02001053 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001054} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001055
1056#define HCI_EV_ENCRYPT_CHANGE 0x08
1057struct hci_ev_encrypt_change {
1058 __u8 status;
1059 __le16 handle;
1060 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001061} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001062
1063#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
1064struct hci_ev_change_link_key_complete {
1065 __u8 status;
1066 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001067} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001068
1069#define HCI_EV_REMOTE_FEATURES 0x0b
1070struct hci_ev_remote_features {
1071 __u8 status;
1072 __le16 handle;
1073 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001074} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001075
1076#define HCI_EV_REMOTE_VERSION 0x0c
1077struct hci_ev_remote_version {
1078 __u8 status;
1079 __le16 handle;
1080 __u8 lmp_ver;
1081 __le16 manufacturer;
1082 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001083} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001084
1085#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
1086struct hci_qos {
1087 __u8 service_type;
1088 __u32 token_rate;
1089 __u32 peak_bandwidth;
1090 __u32 latency;
1091 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001092} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001093struct hci_ev_qos_setup_complete {
1094 __u8 status;
1095 __le16 handle;
1096 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001097} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001098
1099#define HCI_EV_CMD_COMPLETE 0x0e
1100struct hci_ev_cmd_complete {
1101 __u8 ncmd;
1102 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001103} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001104
1105#define HCI_EV_CMD_STATUS 0x0f
1106struct hci_ev_cmd_status {
1107 __u8 status;
1108 __u8 ncmd;
1109 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001110} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001111
1112#define HCI_EV_ROLE_CHANGE 0x12
1113struct hci_ev_role_change {
1114 __u8 status;
1115 bdaddr_t bdaddr;
1116 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001117} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001118
1119#define HCI_EV_NUM_COMP_PKTS 0x13
1120struct hci_ev_num_comp_pkts {
1121 __u8 num_hndl;
1122 /* variable length part */
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001123} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001124
1125#define HCI_EV_MODE_CHANGE 0x14
1126struct hci_ev_mode_change {
1127 __u8 status;
1128 __le16 handle;
1129 __u8 mode;
1130 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001131} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001132
1133#define HCI_EV_PIN_CODE_REQ 0x16
1134struct hci_ev_pin_code_req {
1135 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001136} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001137
1138#define HCI_EV_LINK_KEY_REQ 0x17
1139struct hci_ev_link_key_req {
1140 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001141} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001142
1143#define HCI_EV_LINK_KEY_NOTIFY 0x18
1144struct hci_ev_link_key_notify {
1145 bdaddr_t bdaddr;
1146 __u8 link_key[16];
1147 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001148} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001149
1150#define HCI_EV_CLOCK_OFFSET 0x1c
1151struct hci_ev_clock_offset {
1152 __u8 status;
1153 __le16 handle;
1154 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001155} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001156
Marcel Holtmanna8746412008-07-14 20:13:46 +02001157#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1158struct hci_ev_pkt_type_change {
1159 __u8 status;
1160 __le16 handle;
1161 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001162} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001163
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001164#define HCI_EV_PSCAN_REP_MODE 0x20
1165struct hci_ev_pscan_rep_mode {
1166 bdaddr_t bdaddr;
1167 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001168} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001169
Linus Torvalds1da177e2005-04-16 15:20:36 -07001170#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1171struct inquiry_info_with_rssi {
1172 bdaddr_t bdaddr;
1173 __u8 pscan_rep_mode;
1174 __u8 pscan_period_mode;
1175 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001176 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001177 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001178} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001179struct inquiry_info_with_rssi_and_pscan_mode {
1180 bdaddr_t bdaddr;
1181 __u8 pscan_rep_mode;
1182 __u8 pscan_period_mode;
1183 __u8 pscan_mode;
1184 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001185 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001186 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001187} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001188
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001189#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1190struct hci_ev_remote_ext_features {
1191 __u8 status;
1192 __le16 handle;
1193 __u8 page;
1194 __u8 max_page;
1195 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001196} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001197
1198#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1199struct hci_ev_sync_conn_complete {
1200 __u8 status;
1201 __le16 handle;
1202 bdaddr_t bdaddr;
1203 __u8 link_type;
1204 __u8 tx_interval;
1205 __u8 retrans_window;
1206 __le16 rx_pkt_len;
1207 __le16 tx_pkt_len;
1208 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001209} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001210
1211#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1212struct hci_ev_sync_conn_changed {
1213 __u8 status;
1214 __le16 handle;
1215 __u8 tx_interval;
1216 __u8 retrans_window;
1217 __le16 rx_pkt_len;
1218 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001219} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001220
1221#define HCI_EV_SNIFF_SUBRATE 0x2e
1222struct hci_ev_sniff_subrate {
1223 __u8 status;
1224 __le16 handle;
1225 __le16 max_tx_latency;
1226 __le16 max_rx_latency;
1227 __le16 max_remote_timeout;
1228 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001229} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001230
1231#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001232struct extended_inquiry_info {
1233 bdaddr_t bdaddr;
1234 __u8 pscan_rep_mode;
1235 __u8 pscan_period_mode;
1236 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001237 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001238 __s8 rssi;
1239 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001240} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001241
Marcel Holtmann04936842008-07-14 20:13:48 +02001242#define HCI_EV_IO_CAPA_REQUEST 0x31
1243struct hci_ev_io_capa_request {
1244 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001245} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001246
Johan Hedberg03b555e2011-01-04 15:40:05 +02001247#define HCI_EV_IO_CAPA_REPLY 0x32
1248struct hci_ev_io_capa_reply {
1249 bdaddr_t bdaddr;
1250 __u8 capability;
1251 __u8 oob_data;
1252 __u8 authentication;
1253} __packed;
1254
Johan Hedberga5c29682011-02-19 12:05:57 -03001255#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1256struct hci_ev_user_confirm_req {
1257 bdaddr_t bdaddr;
1258 __le32 passkey;
1259} __packed;
1260
Brian Gixa68668b2011-08-11 15:49:36 -07001261#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1262struct hci_ev_user_passkey_request {
1263 bdaddr_t bdaddr;
1264} __packed;
1265
Szymon Janc2763eda2011-03-22 13:12:22 +01001266#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1267struct hci_ev_remote_oob_data_request {
1268 bdaddr_t bdaddr;
1269} __packed;
1270
Marcel Holtmann04936842008-07-14 20:13:48 +02001271#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1272struct hci_ev_simple_pair_complete {
1273 __u8 status;
1274 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001275} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001276
Brian Gixa68668b2011-08-11 15:49:36 -07001277#define HCI_EV_USER_PASSKEY_NOTIFICATION 0x3b
1278struct hci_ev_user_passkey_notification {
1279 bdaddr_t bdaddr;
1280 __le32 passkey;
1281} __packed;
1282
Marcel Holtmann41a96212008-07-14 20:13:48 +02001283#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1284struct hci_ev_remote_host_features {
1285 bdaddr_t bdaddr;
1286 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001287} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001288
Ville Tervo63185f62011-02-10 22:38:46 -03001289#define HCI_EV_LE_META 0x3e
1290struct hci_ev_le_meta {
1291 __u8 subevent;
1292} __packed;
1293
1294/* Low energy meta events */
1295#define HCI_EV_LE_CONN_COMPLETE 0x01
1296struct hci_ev_le_conn_complete {
1297 __u8 status;
1298 __le16 handle;
1299 __u8 role;
1300 __u8 bdaddr_type;
1301 bdaddr_t bdaddr;
1302 __le16 interval;
1303 __le16 latency;
1304 __le16 supervision_timeout;
1305 __u8 clk_accurancy;
1306} __packed;
1307
Anderson Briglia1c3cc1182011-05-26 16:23:49 -03001308#define ADV_IND 0x00
1309#define ADV_DIRECT_IND 0x01
1310#define ADV_SCAN_IND 0x02
1311#define ADV_NONCONN_IND 0x03
1312#define ADV_SCAN_RSP 0x04
1313
1314#define ADDR_LE_DEV_PUBLIC 0x00
1315#define ADDR_LE_DEV_RANDOM 0x01
1316
1317#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1318struct hci_ev_le_advertising_info {
1319 __u8 evt_type;
1320 __u8 bdaddr_type;
1321 bdaddr_t bdaddr;
1322 __u8 length;
1323 __u8 data[0];
1324} __packed;
1325
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001326#define HCI_EV_LE_LTK_REQ 0x05
1327struct hci_ev_le_ltk_req {
1328 __le16 handle;
1329 __u8 random[8];
1330 __le16 ediv;
1331} __packed;
1332
1333#define HCI_EV_PHYS_LINK_COMPLETE 0x40
1334struct hci_ev_phys_link_complete {
1335 __u8 status;
1336 __u8 phy_handle;
1337} __packed;
1338
1339#define HCI_EV_CHANNEL_SELECTED 0x41
1340struct hci_ev_channel_selected {
1341 __u8 phy_handle;
1342} __packed;
1343
1344#define HCI_EV_DISCONN_PHYS_LINK_COMPLETE 0x42
1345struct hci_ev_disconn_phys_link_complete {
1346 __u8 status;
1347 __u8 phy_handle;
1348 __u8 reason;
1349} __packed;
1350
1351#define HCI_EV_LOG_LINK_COMPLETE 0x45
1352struct hci_ev_log_link_complete {
1353 __u8 status;
1354 __le16 log_handle;
1355 __u8 phy_handle;
1356 __u8 flow_spec_id;
1357} __packed;
1358
1359#define HCI_EV_DISCONN_LOG_LINK_COMPLETE 0x46
1360struct hci_ev_disconn_log_link_complete {
1361 __u8 status;
1362 __le16 log_handle;
1363 __u8 reason;
1364} __packed;
1365
1366#define HCI_EV_FLOW_SPEC_MODIFY_COMPLETE 0x47
1367struct hci_ev_flow_spec_modify_complete {
1368 __u8 status;
1369 __le16 log_handle;
1370} __packed;
1371
1372#define HCI_EV_NUM_COMP_BLOCKS 0x48
1373struct hci_ev_num_comp_blocks {
1374 __le16 total_num_blocks;
1375 __u8 num_hndl;
1376 /* variable length part */
1377} __packed;
1378
1379#define HCI_EV_SHORT_RANGE_MODE_COMPLETE 0x4c
1380struct hci_ev_short_range_mode_complete {
1381 __u8 status;
1382 __u8 phy_handle;
1383 __u8 mode;
1384} __packed;
1385
1386#define HCI_EV_AMP_STATUS_CHANGE 0x4d
1387struct hci_ev_amp_status_change {
1388 __u8 status;
1389 __u8 amp_status;
1390} __packed;
1391
Linus Torvalds1da177e2005-04-16 15:20:36 -07001392/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001393#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394struct hci_ev_stack_internal {
1395 __u16 type;
1396 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001397} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001398
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001399#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400struct hci_ev_si_device {
1401 __u16 event;
1402 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001403} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001404
1405#define HCI_EV_SI_SECURITY 0x02
1406struct hci_ev_si_security {
1407 __u16 event;
1408 __u16 proto;
1409 __u16 subproto;
1410 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001411} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001412
1413/* ---- HCI Packet structures ---- */
1414#define HCI_COMMAND_HDR_SIZE 3
1415#define HCI_EVENT_HDR_SIZE 2
1416#define HCI_ACL_HDR_SIZE 4
1417#define HCI_SCO_HDR_SIZE 3
1418
1419struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001420 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001421 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001422} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001423
1424struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001425 __u8 evt;
1426 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001427} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001428
1429struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001430 __le16 handle; /* Handle & Flags(PB, BC) */
1431 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001432} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433
1434struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001435 __le16 handle;
1436 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001437} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439#ifdef __KERNEL__
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001440#include <linux/skbuff.h>
1441static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1442{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001443 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001444}
1445
1446static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1447{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001448 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001449}
1450
1451static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1452{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001453 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001454}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455#endif
Arnaldo Carvalho de Melo2a123b82007-03-27 18:38:07 -03001456
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001458#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001459#define hci_opcode_ogf(op) (op >> 10)
1460#define hci_opcode_ocf(op) (op & 0x03ff)
1461
1462/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001463#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001464#define hci_handle(h) (h & 0x0fff)
1465#define hci_flags(h) (h >> 12)
1466
1467/* ---- HCI Sockets ---- */
1468
1469/* Socket options */
1470#define HCI_DATA_DIR 1
1471#define HCI_FILTER 2
1472#define HCI_TIME_STAMP 3
1473
1474/* CMSG flags */
1475#define HCI_CMSG_DIR 0x0001
1476#define HCI_CMSG_TSTAMP 0x0002
1477
1478struct sockaddr_hci {
1479 sa_family_t hci_family;
1480 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001481 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482};
1483#define HCI_DEV_NONE 0xffff
1484
Johan Hedbergc02178d2010-12-08 00:21:05 +02001485#define HCI_CHANNEL_RAW 0
1486#define HCI_CHANNEL_CONTROL 1
1487
Linus Torvalds1da177e2005-04-16 15:20:36 -07001488struct hci_filter {
1489 unsigned long type_mask;
1490 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001491 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001492};
1493
1494struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001495 __u32 type_mask;
1496 __u32 event_mask[2];
1497 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001498};
1499
1500#define HCI_FLT_TYPE_BITS 31
1501#define HCI_FLT_EVENT_BITS 63
1502#define HCI_FLT_OGF_BITS 63
1503#define HCI_FLT_OCF_BITS 127
1504
1505/* ---- HCI Ioctl requests structures ---- */
1506struct hci_dev_stats {
1507 __u32 err_rx;
1508 __u32 err_tx;
1509 __u32 cmd_tx;
1510 __u32 evt_rx;
1511 __u32 acl_tx;
1512 __u32 acl_rx;
1513 __u32 sco_tx;
1514 __u32 sco_rx;
1515 __u32 byte_rx;
1516 __u32 byte_tx;
1517};
1518
1519struct hci_dev_info {
1520 __u16 dev_id;
1521 char name[8];
1522
1523 bdaddr_t bdaddr;
1524
1525 __u32 flags;
1526 __u8 type;
1527
1528 __u8 features[8];
1529
1530 __u32 pkt_type;
1531 __u32 link_policy;
1532 __u32 link_mode;
1533
1534 __u16 acl_mtu;
1535 __u16 acl_pkts;
1536 __u16 sco_mtu;
1537 __u16 sco_pkts;
1538
1539 struct hci_dev_stats stat;
1540};
1541
1542struct hci_conn_info {
1543 __u16 handle;
1544 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001545 __u8 type;
1546 __u8 out;
1547 __u16 state;
1548 __u32 link_mode;
Nick Pellyc1728492009-12-09 00:15:41 -08001549 __u32 mtu;
1550 __u32 cnt;
1551 __u32 pkts;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001552 __u8 pending_sec_level;
1553 __u8 ssp_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001554};
1555
1556struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001557 __u16 dev_id;
1558 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001559};
1560
1561struct hci_dev_list_req {
1562 __u16 dev_num;
1563 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1564};
1565
1566struct hci_conn_list_req {
1567 __u16 dev_id;
1568 __u16 conn_num;
1569 struct hci_conn_info conn_info[0];
1570};
1571
1572struct hci_conn_info_req {
1573 bdaddr_t bdaddr;
1574 __u8 type;
1575 struct hci_conn_info conn_info[0];
1576};
1577
Marcel Holtmann40be4922008-07-14 20:13:50 +02001578struct hci_auth_info_req {
1579 bdaddr_t bdaddr;
1580 __u8 type;
1581};
1582
Linus Torvalds1da177e2005-04-16 15:20:36 -07001583struct hci_inquiry_req {
1584 __u16 dev_id;
1585 __u16 flags;
1586 __u8 lap[3];
1587 __u8 length;
1588 __u8 num_rsp;
1589};
1590#define IREQ_CACHE_FLUSH 0x0001
1591
1592#endif /* __HCI_H */