blob: ce5133b224457647001993e9ba302f20af320d05 [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
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4
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
28#define HCI_MAX_ACL_SIZE 1024
29#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
40
41/* HCI notify events */
42#define HCI_NOTIFY_CONN_ADD 1
43#define HCI_NOTIFY_CONN_DEL 2
44#define HCI_NOTIFY_VOICE_SETTING 3
45
Marcel Holtmannc13854c2010-02-08 15:27:07 +010046/* HCI bus types */
Marcel Holtmann0ac53932006-07-08 13:57:15 +020047#define HCI_VIRTUAL 0
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#define HCI_USB 1
49#define HCI_PCCARD 2
50#define HCI_UART 3
51#define HCI_RS232 4
52#define HCI_PCI 5
Marcel Holtmann0ac53932006-07-08 13:57:15 +020053#define HCI_SDIO 6
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Marcel Holtmann943da252010-02-13 02:28:41 +010055/* HCI controller types */
56#define HCI_BREDR 0x00
David Vrabel8f1e1742010-08-09 17:38:10 -040057#define HCI_AMP 0x01
Marcel Holtmann943da252010-02-13 02:28:41 +010058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059/* HCI device quirks */
60enum {
Marcel Holtmann7a9d4022008-11-30 12:17:26 +010061 HCI_QUIRK_NO_RESET,
Marcel Holtmannda1f5192006-07-03 10:02:29 +020062 HCI_QUIRK_RAW_DEVICE,
63 HCI_QUIRK_FIXUP_BUFFER_SIZE
Linus Torvalds1da177e2005-04-16 15:20:36 -070064};
65
66/* HCI device flags */
67enum {
68 HCI_UP,
69 HCI_INIT,
70 HCI_RUNNING,
71
72 HCI_PSCAN,
73 HCI_ISCAN,
74 HCI_AUTH,
75 HCI_ENCRYPT,
76 HCI_INQUIRY,
77
78 HCI_RAW,
Johan Hedbergab81cbf2010-12-15 13:53:18 +020079
80 HCI_SETUP,
81 HCI_AUTO_OFF,
Johan Hedbergebc99fe2011-01-04 11:54:26 +020082 HCI_MGMT,
Johan Hedbergc542a062011-01-26 13:11:03 +020083 HCI_PAIRABLE,
Johan Hedberg1aff6f02011-01-13 21:56:52 +020084 HCI_SERVICE_CACHE,
Johan Hedberg55ed8ca12011-01-17 14:41:05 +020085 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
Gustavo F. Padovan10572132011-03-16 15:36:29 -030087
88 HCI_RESET,
Linus Torvalds1da177e2005-04-16 15:20:36 -070089};
90
Andre Guedesd23264a2011-11-25 20:53:38 -030091/*
92 * BR/EDR and/or LE controller flags: the flags defined here should represent
93 * states from the controller.
94 */
95enum {
96 HCI_LE_SCAN,
97};
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099/* HCI ioctl defines */
100#define HCIDEVUP _IOW('H', 201, int)
101#define HCIDEVDOWN _IOW('H', 202, int)
102#define HCIDEVRESET _IOW('H', 203, int)
103#define HCIDEVRESTAT _IOW('H', 204, int)
104
105#define HCIGETDEVLIST _IOR('H', 210, int)
106#define HCIGETDEVINFO _IOR('H', 211, int)
107#define HCIGETCONNLIST _IOR('H', 212, int)
108#define HCIGETCONNINFO _IOR('H', 213, int)
Marcel Holtmann40be4922008-07-14 20:13:50 +0200109#define HCIGETAUTHINFO _IOR('H', 215, int)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
111#define HCISETRAW _IOW('H', 220, int)
112#define HCISETSCAN _IOW('H', 221, int)
113#define HCISETAUTH _IOW('H', 222, int)
114#define HCISETENCRYPT _IOW('H', 223, int)
115#define HCISETPTYPE _IOW('H', 224, int)
116#define HCISETLINKPOL _IOW('H', 225, int)
117#define HCISETLINKMODE _IOW('H', 226, int)
118#define HCISETACLMTU _IOW('H', 227, int)
119#define HCISETSCOMTU _IOW('H', 228, int)
120
Johan Hedbergf0358562010-05-18 13:20:32 +0200121#define HCIBLOCKADDR _IOW('H', 230, int)
122#define HCIUNBLOCKADDR _IOW('H', 231, int)
123
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124#define HCIINQUIRY _IOR('H', 240, int)
125
126/* HCI timeouts */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200127#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
128#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
Marcel Holtmann052b30b2009-04-26 20:01:22 +0200129#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
Marcel Holtmann04837f62006-07-03 10:02:33 +0200130#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
131#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
Ville Tervo6bd32322011-02-16 16:32:41 +0200132#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200134/* HCI data types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135#define HCI_COMMAND_PKT 0x01
136#define HCI_ACLDATA_PKT 0x02
137#define HCI_SCODATA_PKT 0x03
138#define HCI_EVENT_PKT 0x04
139#define HCI_VENDOR_PKT 0xff
140
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200141/* HCI packet types */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142#define HCI_DM1 0x0008
143#define HCI_DM3 0x0400
144#define HCI_DM5 0x4000
145#define HCI_DH1 0x0010
146#define HCI_DH3 0x0800
147#define HCI_DH5 0x8000
148
149#define HCI_HV1 0x0020
150#define HCI_HV2 0x0040
151#define HCI_HV3 0x0080
152
153#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
154#define ACL_PTYPE_MASK (~SCO_PTYPE_MASK)
155
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200156/* eSCO packet types */
157#define ESCO_HV1 0x0001
158#define ESCO_HV2 0x0002
159#define ESCO_HV3 0x0004
160#define ESCO_EV3 0x0008
161#define ESCO_EV4 0x0010
162#define ESCO_EV5 0x0020
Marcel Holtmannefc76882009-02-06 09:13:37 +0100163#define ESCO_2EV3 0x0040
164#define ESCO_3EV3 0x0080
165#define ESCO_2EV5 0x0100
166#define ESCO_3EV5 0x0200
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200167
Marcel Holtmanna8746412008-07-14 20:13:46 +0200168#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
Marcel Holtmannefc76882009-02-06 09:13:37 +0100169#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
Marcel Holtmanna8746412008-07-14 20:13:46 +0200170
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171/* ACL flags */
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200172#define ACL_START_NO_FLUSH 0x00
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173#define ACL_CONT 0x01
174#define ACL_START 0x02
175#define ACL_ACTIVE_BCAST 0x04
176#define ACL_PICO_BCAST 0x08
177
178/* Baseband links */
179#define SCO_LINK 0x00
180#define ACL_LINK 0x01
Marcel Holtmann5b7f9902007-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 Holtmann5b7f9902007-07-11 09:51:55 +0200209#define LMP_ESCO 0x80
210
211#define LMP_EV4 0x01
212#define LMP_EV5 0x02
Johan Hedberg69ab39e2011-12-15 00:47:35 +0200213#define LMP_NO_BREDR 0x20
Johan Hedbergd5859e22011-01-25 01:19:58 +0200214#define LMP_LE 0x40
Marcel Holtmann5b7f9902007-07-11 09:51:55 +0200215
Marcel Holtmann04837f62006-07-03 10:02:33 +0200216#define LMP_SNIFF_SUBR 0x02
Johan Hedbergd5859e22011-01-25 01:19:58 +0200217#define LMP_PAUSE_ENC 0x04
Marcel Holtmannefc76882009-02-06 09:13:37 +0100218#define LMP_EDR_ESCO_2M 0x20
219#define LMP_EDR_ESCO_3M 0x40
220#define LMP_EDR_3S_ESCO 0x80
Marcel Holtmann04837f62006-07-03 10:02:33 +0200221
Johan Hedbergd5859e22011-01-25 01:19:58 +0200222#define LMP_EXT_INQ 0x01
Andre Guedese6100a22011-06-30 19:20:54 -0300223#define LMP_SIMUL_LE_BR 0x02
Marcel Holtmann769be972008-07-14 20:13:49 +0200224#define LMP_SIMPLE_PAIR 0x08
Andrei Emeltchenkoe7021122011-01-03 11:14:36 +0200225#define LMP_NO_FLUSH 0x40
Marcel Holtmann769be972008-07-14 20:13:49 +0200226
Johan Hedbergd5859e22011-01-25 01:19:58 +0200227#define LMP_LSTO 0x01
228#define LMP_INQ_TX_PWR 0x02
Andre Guedes971e3a42011-06-30 19:20:52 -0300229#define LMP_EXTFEATURES 0x80
Johan Hedbergd5859e22011-01-25 01:19:58 +0200230
Andre Guedeseead27d2011-06-30 19:20:55 -0300231/* Extended LMP features */
232#define LMP_HOST_LE 0x02
233
Marcel Holtmann04837f62006-07-03 10:02:33 +0200234/* Connection modes */
235#define HCI_CM_ACTIVE 0x0000
236#define HCI_CM_HOLD 0x0001
237#define HCI_CM_SNIFF 0x0002
238#define HCI_CM_PARK 0x0003
239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240/* Link policies */
241#define HCI_LP_RSWITCH 0x0001
242#define HCI_LP_HOLD 0x0002
243#define HCI_LP_SNIFF 0x0004
244#define HCI_LP_PARK 0x0008
245
Marcel Holtmann04837f62006-07-03 10:02:33 +0200246/* Link modes */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247#define HCI_LM_ACCEPT 0x8000
248#define HCI_LM_MASTER 0x0001
249#define HCI_LM_AUTH 0x0002
250#define HCI_LM_ENCRYPT 0x0004
251#define HCI_LM_TRUSTED 0x0008
252#define HCI_LM_RELIABLE 0x0010
253#define HCI_LM_SECURE 0x0020
254
Marcel Holtmann40be4922008-07-14 20:13:50 +0200255/* Authentication types */
256#define HCI_AT_NO_BONDING 0x00
257#define HCI_AT_NO_BONDING_MITM 0x01
258#define HCI_AT_DEDICATED_BONDING 0x02
259#define HCI_AT_DEDICATED_BONDING_MITM 0x03
260#define HCI_AT_GENERAL_BONDING 0x04
261#define HCI_AT_GENERAL_BONDING_MITM 0x05
262
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200263/* Link Key types */
264#define HCI_LK_COMBINATION 0x00
265#define HCI_LK_LOCAL_UNIT 0x01
266#define HCI_LK_REMOTE_UNIT 0x02
267#define HCI_LK_DEBUG_COMBINATION 0x03
268#define HCI_LK_UNAUTH_COMBINATION 0x04
269#define HCI_LK_AUTH_COMBINATION 0x05
270#define HCI_LK_CHANGED_COMBINATION 0x06
Vinicius Costa Gomes34918cd2011-07-07 18:59:35 -0300271/* The spec doesn't define types for SMP keys */
272#define HCI_LK_SMP_LTK 0x81
273#define HCI_LK_SMP_IRK 0x82
274#define HCI_LK_SMP_CSRK 0x83
Waldemar Rymarkiewiczb6020ba2011-04-28 12:07:53 +0200275
Andrei Emeltchenko9f5a0d72011-11-07 14:20:25 +0200276/* ---- HCI Error Codes ---- */
277#define HCI_ERROR_AUTH_FAILURE 0x05
278#define HCI_ERROR_REJ_BAD_ADDR 0x0f
279#define HCI_ERROR_REMOTE_USER_TERM 0x13
280#define HCI_ERROR_LOCAL_HOST_TERM 0x16
281#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
282
Andrei Emeltchenko2455a3e2011-12-19 16:31:28 +0200283/* Flow control modes */
284#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
285#define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01
286
Johan Hedberg32748db2011-12-30 14:57:23 +0200287/* Extended Inquiry Response field types */
288#define EIR_FLAGS 0x01 /* flags */
289#define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */
290#define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */
291#define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */
292#define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */
293#define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */
294#define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */
295#define EIR_NAME_SHORT 0x08 /* shortened local name */
296#define EIR_NAME_COMPLETE 0x09 /* complete local name */
297#define EIR_TX_POWER 0x0A /* transmit power level */
298#define EIR_DEVICE_ID 0x10 /* device ID */
299
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300/* ----- HCI Commands ---- */
Ville Tervo6bd32322011-02-16 16:32:41 +0200301#define HCI_OP_NOP 0x0000
302
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200303#define HCI_OP_INQUIRY 0x0401
304struct hci_cp_inquiry {
305 __u8 lap[3];
306 __u8 length;
307 __u8 num_rsp;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300308} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200310#define HCI_OP_INQUIRY_CANCEL 0x0402
311
312#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
313
314#define HCI_OP_CREATE_CONN 0x0405
315struct hci_cp_create_conn {
316 bdaddr_t bdaddr;
317 __le16 pkt_type;
318 __u8 pscan_rep_mode;
319 __u8 pscan_mode;
320 __le16 clock_offset;
321 __u8 role_switch;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300322} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200324#define HCI_OP_DISCONNECT 0x0406
325struct hci_cp_disconnect {
326 __le16 handle;
327 __u8 reason;
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_ADD_SCO 0x0407
331struct hci_cp_add_sco {
332 __le16 handle;
333 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300334} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200335
336#define HCI_OP_CREATE_CONN_CANCEL 0x0408
337struct hci_cp_create_conn_cancel {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300339} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200341#define HCI_OP_ACCEPT_CONN_REQ 0x0409
342struct hci_cp_accept_conn_req {
343 bdaddr_t bdaddr;
344 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300345} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200347#define HCI_OP_REJECT_CONN_REQ 0x040a
348struct hci_cp_reject_conn_req {
349 bdaddr_t bdaddr;
350 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300351} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200353#define HCI_OP_LINK_KEY_REPLY 0x040b
354struct hci_cp_link_key_reply {
355 bdaddr_t bdaddr;
356 __u8 link_key[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300357} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200359#define HCI_OP_LINK_KEY_NEG_REPLY 0x040c
360struct hci_cp_link_key_neg_reply {
361 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300362} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200364#define HCI_OP_PIN_CODE_REPLY 0x040d
365struct hci_cp_pin_code_reply {
366 bdaddr_t bdaddr;
367 __u8 pin_len;
368 __u8 pin_code[16];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300369} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200370struct hci_rp_pin_code_reply {
371 __u8 status;
372 bdaddr_t bdaddr;
373} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200374
375#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
376struct hci_cp_pin_code_neg_reply {
377 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300378} __packed;
Johan Hedberg980e1a52011-01-22 06:10:07 +0200379struct hci_rp_pin_code_neg_reply {
380 __u8 status;
381 bdaddr_t bdaddr;
382} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200383
384#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
385struct hci_cp_change_conn_ptype {
386 __le16 handle;
387 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300388} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200389
390#define HCI_OP_AUTH_REQUESTED 0x0411
391struct hci_cp_auth_requested {
392 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300393} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200394
395#define HCI_OP_SET_CONN_ENCRYPT 0x0413
396struct hci_cp_set_conn_encrypt {
397 __le16 handle;
398 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300399} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200400
401#define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415
402struct hci_cp_change_conn_link_key {
403 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300404} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200405
406#define HCI_OP_REMOTE_NAME_REQ 0x0419
407struct hci_cp_remote_name_req {
408 bdaddr_t bdaddr;
409 __u8 pscan_rep_mode;
410 __u8 pscan_mode;
411 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300412} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200413
414#define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a
415struct hci_cp_remote_name_req_cancel {
416 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300417} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200418
419#define HCI_OP_READ_REMOTE_FEATURES 0x041b
420struct hci_cp_read_remote_features {
421 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300422} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200423
424#define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c
425struct hci_cp_read_remote_ext_features {
426 __le16 handle;
427 __u8 page;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300428} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200429
430#define HCI_OP_READ_REMOTE_VERSION 0x041d
431struct hci_cp_read_remote_version {
432 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300433} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200434
435#define HCI_OP_SETUP_SYNC_CONN 0x0428
436struct hci_cp_setup_sync_conn {
437 __le16 handle;
438 __le32 tx_bandwidth;
439 __le32 rx_bandwidth;
440 __le16 max_latency;
441 __le16 voice_setting;
442 __u8 retrans_effort;
443 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300444} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200445
446#define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429
447struct hci_cp_accept_sync_conn_req {
448 bdaddr_t bdaddr;
449 __le32 tx_bandwidth;
450 __le32 rx_bandwidth;
451 __le16 max_latency;
452 __le16 content_format;
453 __u8 retrans_effort;
454 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300455} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200456
457#define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a
458struct hci_cp_reject_sync_conn_req {
459 bdaddr_t bdaddr;
460 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300461} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200462
Johan Hedberg17fa4b92011-01-25 13:28:33 +0200463#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
464struct hci_cp_io_capability_reply {
465 bdaddr_t bdaddr;
466 __u8 capability;
467 __u8 oob_data;
468 __u8 authentication;
469} __packed;
470
Johan Hedberga5c29682011-02-19 12:05:57 -0300471#define HCI_OP_USER_CONFIRM_REPLY 0x042c
472struct hci_cp_user_confirm_reply {
473 bdaddr_t bdaddr;
474} __packed;
475struct hci_rp_user_confirm_reply {
476 __u8 status;
477 bdaddr_t bdaddr;
478} __packed;
479
480#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
481
Brian Gix9ad40192011-11-12 22:01:11 -0800482#define HCI_OP_USER_PASSKEY_REPLY 0x042e
483struct hci_cp_user_passkey_reply {
484 bdaddr_t bdaddr;
485 __le32 passkey;
486} __packed;
487
488#define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f
489
Szymon Janc2763eda2011-03-22 13:12:22 +0100490#define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430
491struct hci_cp_remote_oob_data_reply {
492 bdaddr_t bdaddr;
493 __u8 hash[16];
494 __u8 randomizer[16];
495} __packed;
496
497#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
498struct hci_cp_remote_oob_data_neg_reply {
499 bdaddr_t bdaddr;
500} __packed;
501
Johan Hedberg03b555e2011-01-04 15:40:05 +0200502#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
503struct hci_cp_io_capability_neg_reply {
504 bdaddr_t bdaddr;
505 __u8 reason;
506} __packed;
507
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200508#define HCI_OP_SNIFF_MODE 0x0803
509struct hci_cp_sniff_mode {
510 __le16 handle;
511 __le16 max_interval;
512 __le16 min_interval;
513 __le16 attempt;
514 __le16 timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300515} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200516
517#define HCI_OP_EXIT_SNIFF_MODE 0x0804
518struct hci_cp_exit_sniff_mode {
519 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300520} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200521
522#define HCI_OP_ROLE_DISCOVERY 0x0809
523struct hci_cp_role_discovery {
524 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300525} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200526struct hci_rp_role_discovery {
527 __u8 status;
528 __le16 handle;
529 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300530} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200531
532#define HCI_OP_SWITCH_ROLE 0x080b
533struct hci_cp_switch_role {
534 bdaddr_t bdaddr;
535 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300536} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200537
538#define HCI_OP_READ_LINK_POLICY 0x080c
539struct hci_cp_read_link_policy {
540 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300541} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200542struct hci_rp_read_link_policy {
543 __u8 status;
544 __le16 handle;
545 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300546} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200547
548#define HCI_OP_WRITE_LINK_POLICY 0x080d
549struct hci_cp_write_link_policy {
550 __le16 handle;
551 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300552} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200553struct hci_rp_write_link_policy {
554 __u8 status;
555 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300556} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200557
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200558#define HCI_OP_READ_DEF_LINK_POLICY 0x080e
559struct hci_rp_read_def_link_policy {
560 __u8 status;
561 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300562} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200563
564#define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f
565struct hci_cp_write_def_link_policy {
566 __le16 policy;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300567} __packed;
Marcel Holtmanne4e8e372008-07-14 20:13:47 +0200568
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200569#define HCI_OP_SNIFF_SUBRATE 0x0811
570struct hci_cp_sniff_subrate {
571 __le16 handle;
572 __le16 max_latency;
573 __le16 min_remote_timeout;
574 __le16 min_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300575} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200576
577#define HCI_OP_SET_EVENT_MASK 0x0c01
578struct hci_cp_set_event_mask {
579 __u8 mask[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300580} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200581
582#define HCI_OP_RESET 0x0c03
583
584#define HCI_OP_SET_EVENT_FLT 0x0c05
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585struct hci_cp_set_event_flt {
586 __u8 flt_type;
587 __u8 cond_type;
588 __u8 condition[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300589} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590
591/* Filter types */
592#define HCI_FLT_CLEAR_ALL 0x00
593#define HCI_FLT_INQ_RESULT 0x01
594#define HCI_FLT_CONN_SETUP 0x02
595
596/* CONN_SETUP Condition types */
597#define HCI_CONN_SETUP_ALLOW_ALL 0x00
598#define HCI_CONN_SETUP_ALLOW_CLASS 0x01
599#define HCI_CONN_SETUP_ALLOW_BDADDR 0x02
600
601/* CONN_SETUP Conditions */
602#define HCI_CONN_SETUP_AUTO_OFF 0x01
603#define HCI_CONN_SETUP_AUTO_ON 0x02
604
Johan Hedbergb0916ea2011-01-10 13:44:55 +0200605#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
606struct hci_cp_delete_stored_link_key {
607 bdaddr_t bdaddr;
608 __u8 delete_all;
609} __packed;
610
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200611#define HCI_MAX_NAME_LENGTH 248
612
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200613#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
614struct hci_cp_write_local_name {
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200615 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300616} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200617
618#define HCI_OP_READ_LOCAL_NAME 0x0c14
619struct hci_rp_read_local_name {
620 __u8 status;
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200621 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300622} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200623
624#define HCI_OP_WRITE_CA_TIMEOUT 0x0c16
625
626#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
627
Andrei Emeltchenko70f230202010-12-01 16:58:25 +0200628#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200629 #define SCAN_DISABLED 0x00
630 #define SCAN_INQUIRY 0x01
631 #define SCAN_PAGE 0x02
632
633#define HCI_OP_READ_AUTH_ENABLE 0x0c1f
634
635#define HCI_OP_WRITE_AUTH_ENABLE 0x0c20
636 #define AUTH_DISABLED 0x00
637 #define AUTH_ENABLED 0x01
638
639#define HCI_OP_READ_ENCRYPT_MODE 0x0c21
640
641#define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22
642 #define ENCRYPT_DISABLED 0x00
643 #define ENCRYPT_P2P 0x01
644 #define ENCRYPT_BOTH 0x02
645
646#define HCI_OP_READ_CLASS_OF_DEV 0x0c23
647struct hci_rp_read_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 __u8 status;
649 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300650} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200652#define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24
653struct hci_cp_write_class_of_dev {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 __u8 dev_class[3];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300655} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200657#define HCI_OP_READ_VOICE_SETTING 0x0c25
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658struct hci_rp_read_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800659 __u8 status;
660 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300661} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200663#define HCI_OP_WRITE_VOICE_SETTING 0x0c26
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664struct hci_cp_write_voice_setting {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800665 __le16 voice_setting;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300666} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200668#define HCI_OP_HOST_BUFFER_SIZE 0x0c33
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669struct hci_cp_host_buffer_size {
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800670 __le16 acl_mtu;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 __u8 sco_mtu;
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800672 __le16 acl_max_pkt;
673 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300674} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675
Johan Hedbergd5859e22011-01-25 01:19:58 +0200676#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
677
Johan Hedberg80a1e1d2011-03-28 14:07:23 +0300678#define HCI_MAX_EIR_LENGTH 240
679
680#define HCI_OP_WRITE_EIR 0x0c52
681struct hci_cp_write_eir {
682 uint8_t fec;
683 uint8_t data[HCI_MAX_EIR_LENGTH];
684} __packed;
685
Marcel Holtmann333140b2008-07-14 20:13:48 +0200686#define HCI_OP_READ_SSP_MODE 0x0c55
687struct hci_rp_read_ssp_mode {
688 __u8 status;
689 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300690} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200691
692#define HCI_OP_WRITE_SSP_MODE 0x0c56
693struct hci_cp_write_ssp_mode {
694 __u8 mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300695} __packed;
Marcel Holtmann333140b2008-07-14 20:13:48 +0200696
Szymon Jancc35938b2011-03-22 13:12:21 +0100697#define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57
698struct hci_rp_read_local_oob_data {
699 __u8 status;
700 __u8 hash[16];
701 __u8 randomizer[16];
702} __packed;
703
Johan Hedbergd5859e22011-01-25 01:19:58 +0200704#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
705
Andrei Emeltchenko1e89cff2011-11-24 14:52:02 +0200706#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
707struct hci_rp_read_flow_control_mode {
708 __u8 status;
709 __u8 mode;
710} __packed;
711
Andre Guedesf9b49302011-06-30 19:20:53 -0300712#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
713struct hci_cp_write_le_host_supported {
714 __u8 le;
715 __u8 simul;
716} __packed;
717
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200718#define HCI_OP_READ_LOCAL_VERSION 0x1001
719struct hci_rp_read_local_version {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200721 __u8 hci_ver;
722 __le16 hci_rev;
723 __u8 lmp_ver;
724 __le16 manufacturer;
725 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300726} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200728#define HCI_OP_READ_LOCAL_COMMANDS 0x1002
729struct hci_rp_read_local_commands {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 __u8 status;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200731 __u8 commands[64];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300732} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700733
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200734#define HCI_OP_READ_LOCAL_FEATURES 0x1003
735struct hci_rp_read_local_features {
736 __u8 status;
737 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300738} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200739
740#define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004
Andre Guedes971e3a42011-06-30 19:20:52 -0300741struct hci_cp_read_local_ext_features {
742 __u8 page;
743} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200744struct hci_rp_read_local_ext_features {
745 __u8 status;
746 __u8 page;
747 __u8 max_page;
748 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300749} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200750
751#define HCI_OP_READ_BUFFER_SIZE 0x1005
752struct hci_rp_read_buffer_size {
753 __u8 status;
754 __le16 acl_mtu;
755 __u8 sco_mtu;
756 __le16 acl_max_pkt;
757 __le16 sco_max_pkt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300758} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200759
760#define HCI_OP_READ_BD_ADDR 0x1009
761struct hci_rp_read_bd_addr {
762 __u8 status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300764} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765
Andrei Emeltchenko350ee4c2011-12-07 15:56:51 +0200766#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
767struct hci_rp_read_data_block_size {
768 __u8 status;
769 __le16 max_acl_len;
770 __le16 block_len;
771 __le16 num_blocks;
772} __packed;
773
Antti Julkuf6422ec2011-06-22 13:11:56 +0300774#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
775struct hci_cp_write_page_scan_activity {
776 __le16 interval;
777 __le16 window;
778} __packed;
779
780#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
781 #define PAGE_SCAN_TYPE_STANDARD 0x00
782 #define PAGE_SCAN_TYPE_INTERLACED 0x01
783
Andrei Emeltchenko928abaa2011-10-12 10:53:57 +0300784#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
785struct hci_rp_read_local_amp_info {
786 __u8 status;
787 __u8 amp_status;
788 __le32 total_bw;
789 __le32 max_bw;
790 __le32 min_latency;
791 __le32 max_pdu;
792 __u8 amp_type;
793 __le16 pal_cap;
794 __le16 max_assoc_size;
795 __le32 max_flush_to;
796 __le32 be_flush_to;
797} __packed;
798
Ville Tervo63185f62011-02-10 22:38:46 -0300799#define HCI_OP_LE_SET_EVENT_MASK 0x2001
800struct hci_cp_le_set_event_mask {
801 __u8 mask[8];
802} __packed;
803
804#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
805struct hci_rp_le_read_buffer_size {
806 __u8 status;
807 __le16 le_mtu;
808 __u8 le_max_pkt;
809} __packed;
810
Andre Guedes07f7fa52011-12-02 21:13:31 +0900811#define HCI_OP_LE_SET_SCAN_PARAM 0x200b
812struct hci_cp_le_set_scan_param {
813 __u8 type;
814 __le16 interval;
815 __le16 window;
816 __u8 own_address_type;
817 __u8 filter_policy;
818} __packed;
819
Andrei Emeltchenko68a8aea2011-12-19 16:14:18 +0200820#define LE_SCANNING_DISABLED 0x00
821#define LE_SCANNING_ENABLED 0x01
822
Andre Guedeseb9d91f2011-05-26 16:23:52 -0300823#define HCI_OP_LE_SET_SCAN_ENABLE 0x200c
824struct hci_cp_le_set_scan_enable {
825 __u8 enable;
826 __u8 filter_dup;
827} __packed;
828
Ville Tervo63185f62011-02-10 22:38:46 -0300829#define HCI_OP_LE_CREATE_CONN 0x200d
830struct hci_cp_le_create_conn {
831 __le16 scan_interval;
832 __le16 scan_window;
833 __u8 filter_policy;
834 __u8 peer_addr_type;
835 bdaddr_t peer_addr;
836 __u8 own_address_type;
837 __le16 conn_interval_min;
838 __le16 conn_interval_max;
839 __le16 conn_latency;
840 __le16 supervision_timeout;
841 __le16 min_ce_len;
842 __le16 max_ce_len;
843} __packed;
844
845#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
846
Claudio Takahasi2ce603e2011-02-16 20:44:53 -0200847#define HCI_OP_LE_CONN_UPDATE 0x2013
848struct hci_cp_le_conn_update {
849 __le16 handle;
850 __le16 conn_interval_min;
851 __le16 conn_interval_max;
852 __le16 conn_latency;
853 __le16 supervision_timeout;
854 __le16 min_ce_len;
855 __le16 max_ce_len;
856} __packed;
857
Vinicius Costa Gomesa7a595f2011-06-09 18:50:47 -0300858#define HCI_OP_LE_START_ENC 0x2019
859struct hci_cp_le_start_enc {
860 __le16 handle;
861 __u8 rand[8];
862 __le16 ediv;
863 __u8 ltk[16];
864} __packed;
865
866#define HCI_OP_LE_LTK_REPLY 0x201a
867struct hci_cp_le_ltk_reply {
868 __le16 handle;
869 __u8 ltk[16];
870} __packed;
871struct hci_rp_le_ltk_reply {
872 __u8 status;
873 __le16 handle;
874} __packed;
875
876#define HCI_OP_LE_LTK_NEG_REPLY 0x201b
877struct hci_cp_le_ltk_neg_reply {
878 __le16 handle;
879} __packed;
880struct hci_rp_le_ltk_neg_reply {
881 __u8 status;
882 __le16 handle;
883} __packed;
884
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885/* ---- HCI Events ---- */
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200886#define HCI_EV_INQUIRY_COMPLETE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -0700887
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200888#define HCI_EV_INQUIRY_RESULT 0x02
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889struct inquiry_info {
890 bdaddr_t bdaddr;
891 __u8 pscan_rep_mode;
892 __u8 pscan_period_mode;
893 __u8 pscan_mode;
894 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -0800895 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300896} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200898#define HCI_EV_CONN_COMPLETE 0x03
899struct hci_ev_conn_complete {
900 __u8 status;
901 __le16 handle;
902 bdaddr_t bdaddr;
903 __u8 link_type;
904 __u8 encr_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300905} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200906
907#define HCI_EV_CONN_REQUEST 0x04
908struct hci_ev_conn_request {
909 bdaddr_t bdaddr;
910 __u8 dev_class[3];
911 __u8 link_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300912} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200913
914#define HCI_EV_DISCONN_COMPLETE 0x05
915struct hci_ev_disconn_complete {
916 __u8 status;
917 __le16 handle;
918 __u8 reason;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300919} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200920
921#define HCI_EV_AUTH_COMPLETE 0x06
922struct hci_ev_auth_complete {
923 __u8 status;
924 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300925} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200926
927#define HCI_EV_REMOTE_NAME 0x07
928struct hci_ev_remote_name {
929 __u8 status;
930 bdaddr_t bdaddr;
Johan Hedberg1f6c6372011-03-16 14:29:35 +0200931 __u8 name[HCI_MAX_NAME_LENGTH];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300932} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200933
934#define HCI_EV_ENCRYPT_CHANGE 0x08
935struct hci_ev_encrypt_change {
936 __u8 status;
937 __le16 handle;
938 __u8 encrypt;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300939} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200940
941#define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09
942struct hci_ev_change_link_key_complete {
943 __u8 status;
944 __le16 handle;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300945} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200946
947#define HCI_EV_REMOTE_FEATURES 0x0b
948struct hci_ev_remote_features {
949 __u8 status;
950 __le16 handle;
951 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300952} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200953
954#define HCI_EV_REMOTE_VERSION 0x0c
955struct hci_ev_remote_version {
956 __u8 status;
957 __le16 handle;
958 __u8 lmp_ver;
959 __le16 manufacturer;
960 __le16 lmp_subver;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300961} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200962
963#define HCI_EV_QOS_SETUP_COMPLETE 0x0d
964struct hci_qos {
965 __u8 service_type;
966 __u32 token_rate;
967 __u32 peak_bandwidth;
968 __u32 latency;
969 __u32 delay_variation;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300970} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200971struct hci_ev_qos_setup_complete {
972 __u8 status;
973 __le16 handle;
974 struct hci_qos qos;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300975} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200976
977#define HCI_EV_CMD_COMPLETE 0x0e
978struct hci_ev_cmd_complete {
979 __u8 ncmd;
980 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300981} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200982
983#define HCI_EV_CMD_STATUS 0x0f
984struct hci_ev_cmd_status {
985 __u8 status;
986 __u8 ncmd;
987 __le16 opcode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300988} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200989
990#define HCI_EV_ROLE_CHANGE 0x12
991struct hci_ev_role_change {
992 __u8 status;
993 bdaddr_t bdaddr;
994 __u8 role;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -0300995} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +0200996
997#define HCI_EV_NUM_COMP_PKTS 0x13
Andrei Emeltchenko613a1c02011-12-19 16:31:30 +0200998struct hci_comp_pkts_info {
999 __le16 handle;
1000 __le16 count;
1001} __packed;
1002
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001003struct hci_ev_num_comp_pkts {
1004 __u8 num_hndl;
Andrei Emeltchenko613a1c02011-12-19 16:31:30 +02001005 struct hci_comp_pkts_info handles[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001006} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001007
1008#define HCI_EV_MODE_CHANGE 0x14
1009struct hci_ev_mode_change {
1010 __u8 status;
1011 __le16 handle;
1012 __u8 mode;
1013 __le16 interval;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001014} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001015
1016#define HCI_EV_PIN_CODE_REQ 0x16
1017struct hci_ev_pin_code_req {
1018 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001019} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001020
1021#define HCI_EV_LINK_KEY_REQ 0x17
1022struct hci_ev_link_key_req {
1023 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001024} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001025
1026#define HCI_EV_LINK_KEY_NOTIFY 0x18
1027struct hci_ev_link_key_notify {
1028 bdaddr_t bdaddr;
1029 __u8 link_key[16];
1030 __u8 key_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001031} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001032
1033#define HCI_EV_CLOCK_OFFSET 0x1c
1034struct hci_ev_clock_offset {
1035 __u8 status;
1036 __le16 handle;
1037 __le16 clock_offset;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001038} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001039
Marcel Holtmanna8746412008-07-14 20:13:46 +02001040#define HCI_EV_PKT_TYPE_CHANGE 0x1d
1041struct hci_ev_pkt_type_change {
1042 __u8 status;
1043 __le16 handle;
1044 __le16 pkt_type;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001045} __packed;
Marcel Holtmanna8746412008-07-14 20:13:46 +02001046
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001047#define HCI_EV_PSCAN_REP_MODE 0x20
1048struct hci_ev_pscan_rep_mode {
1049 bdaddr_t bdaddr;
1050 __u8 pscan_rep_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001051} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001052
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
1054struct inquiry_info_with_rssi {
1055 bdaddr_t bdaddr;
1056 __u8 pscan_rep_mode;
1057 __u8 pscan_period_mode;
1058 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001059 __le16 clock_offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001061} __packed;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001062struct inquiry_info_with_rssi_and_pscan_mode {
1063 bdaddr_t bdaddr;
1064 __u8 pscan_rep_mode;
1065 __u8 pscan_period_mode;
1066 __u8 pscan_mode;
1067 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001068 __le16 clock_offset;
Marcel Holtmann45bb4bf2005-08-09 20:27:49 -07001069 __s8 rssi;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001070} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001071
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001072#define HCI_EV_REMOTE_EXT_FEATURES 0x23
1073struct hci_ev_remote_ext_features {
1074 __u8 status;
1075 __le16 handle;
1076 __u8 page;
1077 __u8 max_page;
1078 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001079} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001080
1081#define HCI_EV_SYNC_CONN_COMPLETE 0x2c
1082struct hci_ev_sync_conn_complete {
1083 __u8 status;
1084 __le16 handle;
1085 bdaddr_t bdaddr;
1086 __u8 link_type;
1087 __u8 tx_interval;
1088 __u8 retrans_window;
1089 __le16 rx_pkt_len;
1090 __le16 tx_pkt_len;
1091 __u8 air_mode;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001092} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001093
1094#define HCI_EV_SYNC_CONN_CHANGED 0x2d
1095struct hci_ev_sync_conn_changed {
1096 __u8 status;
1097 __le16 handle;
1098 __u8 tx_interval;
1099 __u8 retrans_window;
1100 __le16 rx_pkt_len;
1101 __le16 tx_pkt_len;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001102} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001103
1104#define HCI_EV_SNIFF_SUBRATE 0x2e
1105struct hci_ev_sniff_subrate {
1106 __u8 status;
1107 __le16 handle;
1108 __le16 max_tx_latency;
1109 __le16 max_rx_latency;
1110 __le16 max_remote_timeout;
1111 __le16 max_local_timeout;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001112} __packed;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001113
1114#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001115struct extended_inquiry_info {
1116 bdaddr_t bdaddr;
1117 __u8 pscan_rep_mode;
1118 __u8 pscan_period_mode;
1119 __u8 dev_class[3];
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001120 __le16 clock_offset;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001121 __s8 rssi;
1122 __u8 data[240];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001123} __packed;
Marcel Holtmann21d9e302005-09-13 01:32:25 +02001124
Marcel Holtmann04936842008-07-14 20:13:48 +02001125#define HCI_EV_IO_CAPA_REQUEST 0x31
1126struct hci_ev_io_capa_request {
1127 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001128} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001129
Johan Hedberg03b555e2011-01-04 15:40:05 +02001130#define HCI_EV_IO_CAPA_REPLY 0x32
1131struct hci_ev_io_capa_reply {
1132 bdaddr_t bdaddr;
1133 __u8 capability;
1134 __u8 oob_data;
1135 __u8 authentication;
1136} __packed;
1137
Johan Hedberga5c29682011-02-19 12:05:57 -03001138#define HCI_EV_USER_CONFIRM_REQUEST 0x33
1139struct hci_ev_user_confirm_req {
1140 bdaddr_t bdaddr;
1141 __le32 passkey;
1142} __packed;
1143
Brian Gix9ad40192011-11-12 22:01:11 -08001144#define HCI_EV_USER_PASSKEY_REQUEST 0x34
1145struct hci_ev_user_passkey_req {
1146 bdaddr_t bdaddr;
1147} __packed;
1148
Szymon Janc2763eda2011-03-22 13:12:22 +01001149#define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35
1150struct hci_ev_remote_oob_data_request {
1151 bdaddr_t bdaddr;
1152} __packed;
1153
Marcel Holtmann04936842008-07-14 20:13:48 +02001154#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
1155struct hci_ev_simple_pair_complete {
1156 __u8 status;
1157 bdaddr_t bdaddr;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001158} __packed;
Marcel Holtmann04936842008-07-14 20:13:48 +02001159
Marcel Holtmann41a96212008-07-14 20:13:48 +02001160#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1161struct hci_ev_remote_host_features {
1162 bdaddr_t bdaddr;
1163 __u8 features[8];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001164} __packed;
Marcel Holtmann41a96212008-07-14 20:13:48 +02001165
Ville Tervo63185f62011-02-10 22:38:46 -03001166#define HCI_EV_LE_META 0x3e
1167struct hci_ev_le_meta {
1168 __u8 subevent;
1169} __packed;
1170
1171/* Low energy meta events */
1172#define HCI_EV_LE_CONN_COMPLETE 0x01
1173struct hci_ev_le_conn_complete {
1174 __u8 status;
1175 __le16 handle;
1176 __u8 role;
1177 __u8 bdaddr_type;
1178 bdaddr_t bdaddr;
1179 __le16 interval;
1180 __le16 latency;
1181 __le16 supervision_timeout;
1182 __u8 clk_accurancy;
1183} __packed;
1184
Vinicius Costa Gomesa7a595f2011-06-09 18:50:47 -03001185#define HCI_EV_LE_LTK_REQ 0x05
1186struct hci_ev_le_ltk_req {
1187 __le16 handle;
1188 __u8 random[8];
1189 __le16 ediv;
1190} __packed;
1191
Anderson Briglia57a56fd2011-05-26 16:23:49 -03001192/* Advertising report event types */
1193#define ADV_IND 0x00
1194#define ADV_DIRECT_IND 0x01
1195#define ADV_SCAN_IND 0x02
1196#define ADV_NONCONN_IND 0x03
1197#define ADV_SCAN_RSP 0x04
1198
1199#define ADDR_LE_DEV_PUBLIC 0x00
1200#define ADDR_LE_DEV_RANDOM 0x01
1201
1202#define HCI_EV_LE_ADVERTISING_REPORT 0x02
1203struct hci_ev_le_advertising_info {
1204 __u8 evt_type;
1205 __u8 bdaddr_type;
1206 bdaddr_t bdaddr;
1207 __u8 length;
1208 __u8 data[0];
1209} __packed;
1210
Linus Torvalds1da177e2005-04-16 15:20:36 -07001211/* Internal events generated by Bluetooth stack */
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001212#define HCI_EV_STACK_INTERNAL 0xfd
Linus Torvalds1da177e2005-04-16 15:20:36 -07001213struct hci_ev_stack_internal {
1214 __u16 type;
1215 __u8 data[0];
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001216} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001218#define HCI_EV_SI_DEVICE 0x01
Linus Torvalds1da177e2005-04-16 15:20:36 -07001219struct hci_ev_si_device {
1220 __u16 event;
1221 __u16 dev_id;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001222} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001223
1224#define HCI_EV_SI_SECURITY 0x02
1225struct hci_ev_si_security {
1226 __u16 event;
1227 __u16 proto;
1228 __u16 subproto;
1229 __u8 incoming;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001230} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231
1232/* ---- HCI Packet structures ---- */
1233#define HCI_COMMAND_HDR_SIZE 3
1234#define HCI_EVENT_HDR_SIZE 2
1235#define HCI_ACL_HDR_SIZE 4
1236#define HCI_SCO_HDR_SIZE 3
1237
1238struct hci_command_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001239 __le16 opcode; /* OCF & OGF */
Andrei Emeltchenko70f230202010-12-01 16:58:25 +02001240 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001241} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001242
1243struct hci_event_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001244 __u8 evt;
1245 __u8 plen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001246} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001247
1248struct hci_acl_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001249 __le16 handle; /* Handle & Flags(PB, BC) */
1250 __le16 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001251} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001252
1253struct hci_sco_hdr {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001254 __le16 handle;
1255 __u8 dlen;
Gustavo F. Padovan66c853c2010-07-19 02:00:13 -03001256} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257
Arnaldo Carvalho de Melo2a123b862007-03-27 18:38:07 -03001258#include <linux/skbuff.h>
1259static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
1260{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001261 return (struct hci_event_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b862007-03-27 18:38:07 -03001262}
1263
1264static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
1265{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001266 return (struct hci_acl_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b862007-03-27 18:38:07 -03001267}
1268
1269static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
1270{
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001271 return (struct hci_sco_hdr *) skb->data;
Arnaldo Carvalho de Melo2a123b862007-03-27 18:38:07 -03001272}
Arnaldo Carvalho de Melo2a123b862007-03-27 18:38:07 -03001273
Linus Torvalds1da177e2005-04-16 15:20:36 -07001274/* Command opcode pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001275#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001276#define hci_opcode_ogf(op) (op >> 10)
1277#define hci_opcode_ocf(op) (op & 0x03ff)
1278
1279/* ACL handle and flags pack/unpack */
Marcel Holtmann1ebb9252005-11-08 09:57:21 -08001280#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001281#define hci_handle(h) (h & 0x0fff)
1282#define hci_flags(h) (h >> 12)
1283
1284/* ---- HCI Sockets ---- */
1285
1286/* Socket options */
1287#define HCI_DATA_DIR 1
1288#define HCI_FILTER 2
1289#define HCI_TIME_STAMP 3
1290
1291/* CMSG flags */
1292#define HCI_CMSG_DIR 0x0001
1293#define HCI_CMSG_TSTAMP 0x0002
1294
1295struct sockaddr_hci {
1296 sa_family_t hci_family;
1297 unsigned short hci_dev;
Johan Hedbergc02178d2010-12-08 00:21:05 +02001298 unsigned short hci_channel;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001299};
1300#define HCI_DEV_NONE 0xffff
1301
Johan Hedbergc02178d2010-12-08 00:21:05 +02001302#define HCI_CHANNEL_RAW 0
1303#define HCI_CHANNEL_CONTROL 1
1304
Linus Torvalds1da177e2005-04-16 15:20:36 -07001305struct hci_filter {
1306 unsigned long type_mask;
1307 unsigned long event_mask[2];
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001308 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001309};
1310
1311struct hci_ufilter {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001312 __u32 type_mask;
1313 __u32 event_mask[2];
1314 __le16 opcode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001315};
1316
1317#define HCI_FLT_TYPE_BITS 31
1318#define HCI_FLT_EVENT_BITS 63
1319#define HCI_FLT_OGF_BITS 63
1320#define HCI_FLT_OCF_BITS 127
1321
1322/* ---- HCI Ioctl requests structures ---- */
1323struct hci_dev_stats {
1324 __u32 err_rx;
1325 __u32 err_tx;
1326 __u32 cmd_tx;
1327 __u32 evt_rx;
1328 __u32 acl_tx;
1329 __u32 acl_rx;
1330 __u32 sco_tx;
1331 __u32 sco_rx;
1332 __u32 byte_rx;
1333 __u32 byte_tx;
1334};
1335
1336struct hci_dev_info {
1337 __u16 dev_id;
1338 char name[8];
1339
1340 bdaddr_t bdaddr;
1341
1342 __u32 flags;
1343 __u8 type;
1344
1345 __u8 features[8];
1346
1347 __u32 pkt_type;
1348 __u32 link_policy;
1349 __u32 link_mode;
1350
1351 __u16 acl_mtu;
1352 __u16 acl_pkts;
1353 __u16 sco_mtu;
1354 __u16 sco_pkts;
1355
1356 struct hci_dev_stats stat;
1357};
1358
1359struct hci_conn_info {
1360 __u16 handle;
1361 bdaddr_t bdaddr;
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001362 __u8 type;
1363 __u8 out;
1364 __u16 state;
1365 __u32 link_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366};
1367
1368struct hci_dev_req {
Marcel Holtmanna9de9242007-10-20 13:33:56 +02001369 __u16 dev_id;
1370 __u32 dev_opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001371};
1372
1373struct hci_dev_list_req {
1374 __u16 dev_num;
1375 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
1376};
1377
1378struct hci_conn_list_req {
1379 __u16 dev_id;
1380 __u16 conn_num;
1381 struct hci_conn_info conn_info[0];
1382};
1383
1384struct hci_conn_info_req {
1385 bdaddr_t bdaddr;
1386 __u8 type;
1387 struct hci_conn_info conn_info[0];
1388};
1389
Marcel Holtmann40be4922008-07-14 20:13:50 +02001390struct hci_auth_info_req {
1391 bdaddr_t bdaddr;
1392 __u8 type;
1393};
1394
Linus Torvalds1da177e2005-04-16 15:20:36 -07001395struct hci_inquiry_req {
1396 __u16 dev_id;
1397 __u16 flags;
1398 __u8 lap[3];
1399 __u8 length;
1400 __u8 num_rsp;
1401};
1402#define IREQ_CACHE_FLUSH 0x0001
1403
Andrei Emeltchenko8830f512011-11-11 17:02:14 +02001404extern int enable_hs;
1405
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406#endif /* __HCI_H */