blob: 56c931622f94e1f7108558fa88570a0912f3b5de [file] [log] [blame]
Scott James Remnant96927a42013-07-17 18:27:57 -07001/*
2 *
3 * BlueZ - Bluetooth protocol stack for Linux
4 *
5 * Copyright (C) 2000-2001 Qualcomm Incorporated
6 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
7 * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 *
24 */
25
26#ifndef __HCI_H
27#define __HCI_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <sys/socket.h>
34
35#define HCI_MAX_DEV 16
36
37#define HCI_MAX_ACL_SIZE (1492 + 4)
38#define HCI_MAX_SCO_SIZE 255
39#define HCI_MAX_EVENT_SIZE 260
40#define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4)
41
42/* HCI dev events */
43#define HCI_DEV_REG 1
44#define HCI_DEV_UNREG 2
45#define HCI_DEV_UP 3
46#define HCI_DEV_DOWN 4
47#define HCI_DEV_SUSPEND 5
48#define HCI_DEV_RESUME 6
49
50/* HCI bus types */
51#define HCI_VIRTUAL 0
52#define HCI_USB 1
53#define HCI_PCCARD 2
54#define HCI_UART 3
55#define HCI_RS232 4
56#define HCI_PCI 5
57#define HCI_SDIO 6
58
59/* HCI controller types */
60#define HCI_BREDR 0x00
61#define HCI_AMP 0x01
62
63/* HCI device flags */
64enum {
65 HCI_UP,
66 HCI_INIT,
67 HCI_RUNNING,
68
69 HCI_PSCAN,
70 HCI_ISCAN,
71 HCI_AUTH,
72 HCI_ENCRYPT,
73 HCI_INQUIRY,
74
75 HCI_RAW,
76};
77
78/* LE address type */
79enum {
80 LE_PUBLIC_ADDRESS = 0x00,
81 LE_RANDOM_ADDRESS = 0x01
82};
83
84/* HCI ioctl defines */
85#define HCIDEVUP _IOW('H', 201, int)
86#define HCIDEVDOWN _IOW('H', 202, int)
87#define HCIDEVRESET _IOW('H', 203, int)
88#define HCIDEVRESTAT _IOW('H', 204, int)
89
90#define HCIGETDEVLIST _IOR('H', 210, int)
91#define HCIGETDEVINFO _IOR('H', 211, int)
92#define HCIGETCONNLIST _IOR('H', 212, int)
93#define HCIGETCONNINFO _IOR('H', 213, int)
94#define HCIGETAUTHINFO _IOR('H', 215, int)
95
96#define HCISETRAW _IOW('H', 220, int)
97#define HCISETSCAN _IOW('H', 221, int)
98#define HCISETAUTH _IOW('H', 222, int)
99#define HCISETENCRYPT _IOW('H', 223, int)
100#define HCISETPTYPE _IOW('H', 224, int)
101#define HCISETLINKPOL _IOW('H', 225, int)
102#define HCISETLINKMODE _IOW('H', 226, int)
103#define HCISETACLMTU _IOW('H', 227, int)
104#define HCISETSCOMTU _IOW('H', 228, int)
105
106#define HCIBLOCKADDR _IOW('H', 230, int)
107#define HCIUNBLOCKADDR _IOW('H', 231, int)
108
109#define HCIINQUIRY _IOR('H', 240, int)
110
111#ifndef __NO_HCI_DEFS
112
113/* HCI Packet types */
114#define HCI_COMMAND_PKT 0x01
115#define HCI_ACLDATA_PKT 0x02
116#define HCI_SCODATA_PKT 0x03
117#define HCI_EVENT_PKT 0x04
118#define HCI_VENDOR_PKT 0xff
119
120/* HCI Packet types */
121#define HCI_2DH1 0x0002
122#define HCI_3DH1 0x0004
123#define HCI_DM1 0x0008
124#define HCI_DH1 0x0010
125#define HCI_2DH3 0x0100
126#define HCI_3DH3 0x0200
127#define HCI_DM3 0x0400
128#define HCI_DH3 0x0800
129#define HCI_2DH5 0x1000
130#define HCI_3DH5 0x2000
131#define HCI_DM5 0x4000
132#define HCI_DH5 0x8000
133
134#define HCI_HV1 0x0020
135#define HCI_HV2 0x0040
136#define HCI_HV3 0x0080
137
138#define HCI_EV3 0x0008
139#define HCI_EV4 0x0010
140#define HCI_EV5 0x0020
141#define HCI_2EV3 0x0040
142#define HCI_3EV3 0x0080
143#define HCI_2EV5 0x0100
144#define HCI_3EV5 0x0200
145
146#define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
147#define ACL_PTYPE_MASK (HCI_DM1 | HCI_DH1 | HCI_DM3 | HCI_DH3 | HCI_DM5 | HCI_DH5)
148
149/* HCI Error codes */
150#define HCI_UNKNOWN_COMMAND 0x01
151#define HCI_NO_CONNECTION 0x02
152#define HCI_HARDWARE_FAILURE 0x03
153#define HCI_PAGE_TIMEOUT 0x04
154#define HCI_AUTHENTICATION_FAILURE 0x05
155#define HCI_PIN_OR_KEY_MISSING 0x06
156#define HCI_MEMORY_FULL 0x07
157#define HCI_CONNECTION_TIMEOUT 0x08
158#define HCI_MAX_NUMBER_OF_CONNECTIONS 0x09
159#define HCI_MAX_NUMBER_OF_SCO_CONNECTIONS 0x0a
160#define HCI_ACL_CONNECTION_EXISTS 0x0b
161#define HCI_COMMAND_DISALLOWED 0x0c
162#define HCI_REJECTED_LIMITED_RESOURCES 0x0d
163#define HCI_REJECTED_SECURITY 0x0e
164#define HCI_REJECTED_PERSONAL 0x0f
165#define HCI_HOST_TIMEOUT 0x10
166#define HCI_UNSUPPORTED_FEATURE 0x11
167#define HCI_INVALID_PARAMETERS 0x12
168#define HCI_OE_USER_ENDED_CONNECTION 0x13
169#define HCI_OE_LOW_RESOURCES 0x14
170#define HCI_OE_POWER_OFF 0x15
171#define HCI_CONNECTION_TERMINATED 0x16
172#define HCI_REPEATED_ATTEMPTS 0x17
173#define HCI_PAIRING_NOT_ALLOWED 0x18
174#define HCI_UNKNOWN_LMP_PDU 0x19
175#define HCI_UNSUPPORTED_REMOTE_FEATURE 0x1a
176#define HCI_SCO_OFFSET_REJECTED 0x1b
177#define HCI_SCO_INTERVAL_REJECTED 0x1c
178#define HCI_AIR_MODE_REJECTED 0x1d
179#define HCI_INVALID_LMP_PARAMETERS 0x1e
180#define HCI_UNSPECIFIED_ERROR 0x1f
181#define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE 0x20
182#define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
183#define HCI_LMP_RESPONSE_TIMEOUT 0x22
184#define HCI_LMP_ERROR_TRANSACTION_COLLISION 0x23
185#define HCI_LMP_PDU_NOT_ALLOWED 0x24
186#define HCI_ENCRYPTION_MODE_NOT_ACCEPTED 0x25
187#define HCI_UNIT_LINK_KEY_USED 0x26
188#define HCI_QOS_NOT_SUPPORTED 0x27
189#define HCI_INSTANT_PASSED 0x28
190#define HCI_PAIRING_NOT_SUPPORTED 0x29
191#define HCI_TRANSACTION_COLLISION 0x2a
192#define HCI_QOS_UNACCEPTABLE_PARAMETER 0x2c
193#define HCI_QOS_REJECTED 0x2d
194#define HCI_CLASSIFICATION_NOT_SUPPORTED 0x2e
195#define HCI_INSUFFICIENT_SECURITY 0x2f
196#define HCI_PARAMETER_OUT_OF_RANGE 0x30
197#define HCI_ROLE_SWITCH_PENDING 0x32
198#define HCI_SLOT_VIOLATION 0x34
199#define HCI_ROLE_SWITCH_FAILED 0x35
200#define HCI_EIR_TOO_LARGE 0x36
201#define HCI_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
202#define HCI_HOST_BUSY_PAIRING 0x38
203
204/* ACL flags */
205#define ACL_START_NO_FLUSH 0x00
206#define ACL_CONT 0x01
207#define ACL_START 0x02
208#define ACL_ACTIVE_BCAST 0x04
209#define ACL_PICO_BCAST 0x08
210
211/* Baseband links */
212#define SCO_LINK 0x00
213#define ACL_LINK 0x01
214#define ESCO_LINK 0x02
215
216/* LMP features */
217#define LMP_3SLOT 0x01
218#define LMP_5SLOT 0x02
219#define LMP_ENCRYPT 0x04
220#define LMP_SOFFSET 0x08
221#define LMP_TACCURACY 0x10
222#define LMP_RSWITCH 0x20
223#define LMP_HOLD 0x40
224#define LMP_SNIFF 0x80
225
226#define LMP_PARK 0x01
227#define LMP_RSSI 0x02
228#define LMP_QUALITY 0x04
229#define LMP_SCO 0x08
230#define LMP_HV2 0x10
231#define LMP_HV3 0x20
232#define LMP_ULAW 0x40
233#define LMP_ALAW 0x80
234
235#define LMP_CVSD 0x01
236#define LMP_PSCHEME 0x02
237#define LMP_PCONTROL 0x04
238#define LMP_TRSP_SCO 0x08
239#define LMP_BCAST_ENC 0x80
240
241#define LMP_EDR_ACL_2M 0x02
242#define LMP_EDR_ACL_3M 0x04
243#define LMP_ENH_ISCAN 0x08
244#define LMP_ILACE_ISCAN 0x10
245#define LMP_ILACE_PSCAN 0x20
246#define LMP_RSSI_INQ 0x40
247#define LMP_ESCO 0x80
248
249#define LMP_EV4 0x01
250#define LMP_EV5 0x02
251#define LMP_AFH_CAP_SLV 0x08
252#define LMP_AFH_CLS_SLV 0x10
253#define LMP_NO_BREDR 0x20
254#define LMP_LE 0x40
255#define LMP_EDR_3SLOT 0x80
256
257#define LMP_EDR_5SLOT 0x01
258#define LMP_SNIFF_SUBR 0x02
259#define LMP_PAUSE_ENC 0x04
260#define LMP_AFH_CAP_MST 0x08
261#define LMP_AFH_CLS_MST 0x10
262#define LMP_EDR_ESCO_2M 0x20
263#define LMP_EDR_ESCO_3M 0x40
264#define LMP_EDR_3S_ESCO 0x80
265
266#define LMP_EXT_INQ 0x01
267#define LMP_LE_BREDR 0x02
268#define LMP_SIMPLE_PAIR 0x08
269#define LMP_ENCAPS_PDU 0x10
270#define LMP_ERR_DAT_REP 0x20
271#define LMP_NFLUSH_PKTS 0x40
272
273#define LMP_LSTO 0x01
274#define LMP_INQ_TX_PWR 0x02
275#define LMP_EPC 0x04
276#define LMP_EXT_FEAT 0x80
277
278/* Extended LMP features */
279#define LMP_HOST_SSP 0x01
280#define LMP_HOST_LE 0x02
281#define LMP_HOST_LE_BREDR 0x04
282
283/* Link policies */
284#define HCI_LP_RSWITCH 0x0001
285#define HCI_LP_HOLD 0x0002
286#define HCI_LP_SNIFF 0x0004
287#define HCI_LP_PARK 0x0008
288
289/* Link mode */
290#define HCI_LM_ACCEPT 0x8000
291#define HCI_LM_MASTER 0x0001
292#define HCI_LM_AUTH 0x0002
293#define HCI_LM_ENCRYPT 0x0004
294#define HCI_LM_TRUSTED 0x0008
295#define HCI_LM_RELIABLE 0x0010
296#define HCI_LM_SECURE 0x0020
297
298/* Link Key types */
299#define HCI_LK_COMBINATION 0x00
300#define HCI_LK_LOCAL_UNIT 0x01
301#define HCI_LK_REMOTE_UNIT 0x02
302#define HCI_LK_DEBUG_COMBINATION 0x03
303#define HCI_LK_UNAUTH_COMBINATION 0x04
304#define HCI_LK_AUTH_COMBINATION 0x05
305#define HCI_LK_CHANGED_COMBINATION 0x06
306#define HCI_LK_INVALID 0xFF
307
308/* ----- HCI Commands ----- */
309
310/* Link Control */
311#define OGF_LINK_CTL 0x01
312
313#define OCF_INQUIRY 0x0001
314typedef struct {
315 uint8_t lap[3];
316 uint8_t length; /* 1.28s units */
317 uint8_t num_rsp;
318} __attribute__ ((packed)) inquiry_cp;
319#define INQUIRY_CP_SIZE 5
320
321typedef struct {
322 uint8_t status;
323 bdaddr_t bdaddr;
324} __attribute__ ((packed)) status_bdaddr_rp;
325#define STATUS_BDADDR_RP_SIZE 7
326
327#define OCF_INQUIRY_CANCEL 0x0002
328
329#define OCF_PERIODIC_INQUIRY 0x0003
330typedef struct {
331 uint16_t max_period; /* 1.28s units */
332 uint16_t min_period; /* 1.28s units */
333 uint8_t lap[3];
334 uint8_t length; /* 1.28s units */
335 uint8_t num_rsp;
336} __attribute__ ((packed)) periodic_inquiry_cp;
337#define PERIODIC_INQUIRY_CP_SIZE 9
338
339#define OCF_EXIT_PERIODIC_INQUIRY 0x0004
340
341#define OCF_CREATE_CONN 0x0005
342typedef struct {
343 bdaddr_t bdaddr;
344 uint16_t pkt_type;
345 uint8_t pscan_rep_mode;
346 uint8_t pscan_mode;
347 uint16_t clock_offset;
348 uint8_t role_switch;
349} __attribute__ ((packed)) create_conn_cp;
350#define CREATE_CONN_CP_SIZE 13
351
352#define OCF_DISCONNECT 0x0006
353typedef struct {
354 uint16_t handle;
355 uint8_t reason;
356} __attribute__ ((packed)) disconnect_cp;
357#define DISCONNECT_CP_SIZE 3
358
359#define OCF_ADD_SCO 0x0007
360typedef struct {
361 uint16_t handle;
362 uint16_t pkt_type;
363} __attribute__ ((packed)) add_sco_cp;
364#define ADD_SCO_CP_SIZE 4
365
366#define OCF_CREATE_CONN_CANCEL 0x0008
367typedef struct {
368 bdaddr_t bdaddr;
369} __attribute__ ((packed)) create_conn_cancel_cp;
370#define CREATE_CONN_CANCEL_CP_SIZE 6
371
372#define OCF_ACCEPT_CONN_REQ 0x0009
373typedef struct {
374 bdaddr_t bdaddr;
375 uint8_t role;
376} __attribute__ ((packed)) accept_conn_req_cp;
377#define ACCEPT_CONN_REQ_CP_SIZE 7
378
379#define OCF_REJECT_CONN_REQ 0x000A
380typedef struct {
381 bdaddr_t bdaddr;
382 uint8_t reason;
383} __attribute__ ((packed)) reject_conn_req_cp;
384#define REJECT_CONN_REQ_CP_SIZE 7
385
386#define OCF_LINK_KEY_REPLY 0x000B
387typedef struct {
388 bdaddr_t bdaddr;
389 uint8_t link_key[16];
390} __attribute__ ((packed)) link_key_reply_cp;
391#define LINK_KEY_REPLY_CP_SIZE 22
392
393#define OCF_LINK_KEY_NEG_REPLY 0x000C
394
395#define OCF_PIN_CODE_REPLY 0x000D
396typedef struct {
397 bdaddr_t bdaddr;
398 uint8_t pin_len;
399 uint8_t pin_code[16];
400} __attribute__ ((packed)) pin_code_reply_cp;
401#define PIN_CODE_REPLY_CP_SIZE 23
402
403#define OCF_PIN_CODE_NEG_REPLY 0x000E
404
405#define OCF_SET_CONN_PTYPE 0x000F
406typedef struct {
407 uint16_t handle;
408 uint16_t pkt_type;
409} __attribute__ ((packed)) set_conn_ptype_cp;
410#define SET_CONN_PTYPE_CP_SIZE 4
411
412#define OCF_AUTH_REQUESTED 0x0011
413typedef struct {
414 uint16_t handle;
415} __attribute__ ((packed)) auth_requested_cp;
416#define AUTH_REQUESTED_CP_SIZE 2
417
418#define OCF_SET_CONN_ENCRYPT 0x0013
419typedef struct {
420 uint16_t handle;
421 uint8_t encrypt;
422} __attribute__ ((packed)) set_conn_encrypt_cp;
423#define SET_CONN_ENCRYPT_CP_SIZE 3
424
425#define OCF_CHANGE_CONN_LINK_KEY 0x0015
426typedef struct {
427 uint16_t handle;
428} __attribute__ ((packed)) change_conn_link_key_cp;
429#define CHANGE_CONN_LINK_KEY_CP_SIZE 2
430
431#define OCF_MASTER_LINK_KEY 0x0017
432typedef struct {
433 uint8_t key_flag;
434} __attribute__ ((packed)) master_link_key_cp;
435#define MASTER_LINK_KEY_CP_SIZE 1
436
437#define OCF_REMOTE_NAME_REQ 0x0019
438typedef struct {
439 bdaddr_t bdaddr;
440 uint8_t pscan_rep_mode;
441 uint8_t pscan_mode;
442 uint16_t clock_offset;
443} __attribute__ ((packed)) remote_name_req_cp;
444#define REMOTE_NAME_REQ_CP_SIZE 10
445
446#define OCF_REMOTE_NAME_REQ_CANCEL 0x001A
447typedef struct {
448 bdaddr_t bdaddr;
449} __attribute__ ((packed)) remote_name_req_cancel_cp;
450#define REMOTE_NAME_REQ_CANCEL_CP_SIZE 6
451
452#define OCF_READ_REMOTE_FEATURES 0x001B
453typedef struct {
454 uint16_t handle;
455} __attribute__ ((packed)) read_remote_features_cp;
456#define READ_REMOTE_FEATURES_CP_SIZE 2
457
458#define OCF_READ_REMOTE_EXT_FEATURES 0x001C
459typedef struct {
460 uint16_t handle;
461 uint8_t page_num;
462} __attribute__ ((packed)) read_remote_ext_features_cp;
463#define READ_REMOTE_EXT_FEATURES_CP_SIZE 3
464
465#define OCF_READ_REMOTE_VERSION 0x001D
466typedef struct {
467 uint16_t handle;
468} __attribute__ ((packed)) read_remote_version_cp;
469#define READ_REMOTE_VERSION_CP_SIZE 2
470
471#define OCF_READ_CLOCK_OFFSET 0x001F
472typedef struct {
473 uint16_t handle;
474} __attribute__ ((packed)) read_clock_offset_cp;
475#define READ_CLOCK_OFFSET_CP_SIZE 2
476
477#define OCF_READ_LMP_HANDLE 0x0020
478
479#define OCF_SETUP_SYNC_CONN 0x0028
480typedef struct {
481 uint16_t handle;
482 uint32_t tx_bandwith;
483 uint32_t rx_bandwith;
484 uint16_t max_latency;
485 uint16_t voice_setting;
486 uint8_t retrans_effort;
487 uint16_t pkt_type;
488} __attribute__ ((packed)) setup_sync_conn_cp;
489#define SETUP_SYNC_CONN_CP_SIZE 17
490
491#define OCF_ACCEPT_SYNC_CONN_REQ 0x0029
492typedef struct {
493 bdaddr_t bdaddr;
494 uint32_t tx_bandwith;
495 uint32_t rx_bandwith;
496 uint16_t max_latency;
497 uint16_t voice_setting;
498 uint8_t retrans_effort;
499 uint16_t pkt_type;
500} __attribute__ ((packed)) accept_sync_conn_req_cp;
501#define ACCEPT_SYNC_CONN_REQ_CP_SIZE 21
502
503#define OCF_REJECT_SYNC_CONN_REQ 0x002A
504typedef struct {
505 bdaddr_t bdaddr;
506 uint8_t reason;
507} __attribute__ ((packed)) reject_sync_conn_req_cp;
508#define REJECT_SYNC_CONN_REQ_CP_SIZE 7
509
510#define OCF_IO_CAPABILITY_REPLY 0x002B
511typedef struct {
512 bdaddr_t bdaddr;
513 uint8_t capability;
514 uint8_t oob_data;
515 uint8_t authentication;
516} __attribute__ ((packed)) io_capability_reply_cp;
517#define IO_CAPABILITY_REPLY_CP_SIZE 9
518
519#define OCF_USER_CONFIRM_REPLY 0x002C
520typedef struct {
521 bdaddr_t bdaddr;
522} __attribute__ ((packed)) user_confirm_reply_cp;
523#define USER_CONFIRM_REPLY_CP_SIZE 6
524
525#define OCF_USER_CONFIRM_NEG_REPLY 0x002D
526
527#define OCF_USER_PASSKEY_REPLY 0x002E
528typedef struct {
529 bdaddr_t bdaddr;
530 uint32_t passkey;
531} __attribute__ ((packed)) user_passkey_reply_cp;
532#define USER_PASSKEY_REPLY_CP_SIZE 10
533
534#define OCF_USER_PASSKEY_NEG_REPLY 0x002F
535
536#define OCF_REMOTE_OOB_DATA_REPLY 0x0030
537typedef struct {
538 bdaddr_t bdaddr;
539 uint8_t hash[16];
540 uint8_t randomizer[16];
541} __attribute__ ((packed)) remote_oob_data_reply_cp;
542#define REMOTE_OOB_DATA_REPLY_CP_SIZE 38
543
544#define OCF_REMOTE_OOB_DATA_NEG_REPLY 0x0033
545
546#define OCF_IO_CAPABILITY_NEG_REPLY 0x0034
547typedef struct {
548 bdaddr_t bdaddr;
549 uint8_t reason;
550} __attribute__ ((packed)) io_capability_neg_reply_cp;
551#define IO_CAPABILITY_NEG_REPLY_CP_SIZE 7
552
553#define OCF_CREATE_PHYSICAL_LINK 0x0035
554typedef struct {
555 uint8_t handle;
556 uint8_t key_length;
557 uint8_t key_type;
558 uint8_t key[32];
559} __attribute__ ((packed)) create_physical_link_cp;
560#define CREATE_PHYSICAL_LINK_CP_SIZE 35
561
562#define OCF_ACCEPT_PHYSICAL_LINK 0x0036
563
564#define OCF_DISCONNECT_PHYSICAL_LINK 0x0037
565typedef struct {
566 uint8_t handle;
567 uint8_t reason;
568} __attribute__ ((packed)) disconnect_physical_link_cp;
569#define DISCONNECT_PHYSICAL_LINK_CP_SIZE 2
570
571#define OCF_CREATE_LOGICAL_LINK 0x0038
572typedef struct {
573 uint8_t handle;
574 uint8_t tx_flow[16];
575 uint8_t rx_flow[16];
576} __attribute__ ((packed)) create_logical_link_cp;
577#define CREATE_LOGICAL_LINK_CP_SIZE 33
578
579#define OCF_ACCEPT_LOGICAL_LINK 0x0039
580
581#define OCF_DISCONNECT_LOGICAL_LINK 0x003A
582typedef struct {
583 uint16_t handle;
584} __attribute__ ((packed)) disconnect_logical_link_cp;
585#define DISCONNECT_LOGICAL_LINK_CP_SIZE 2
586
587#define OCF_LOGICAL_LINK_CANCEL 0x003B
588typedef struct {
589 uint8_t handle;
590 uint8_t tx_flow_id;
591} __attribute__ ((packed)) cancel_logical_link_cp;
592#define LOGICAL_LINK_CANCEL_CP_SIZE 2
593typedef struct {
594 uint8_t status;
595 uint8_t handle;
596 uint8_t tx_flow_id;
597} __attribute__ ((packed)) cancel_logical_link_rp;
598#define LOGICAL_LINK_CANCEL_RP_SIZE 3
599
600#define OCF_FLOW_SPEC_MODIFY 0x003C
601
602/* Link Policy */
603#define OGF_LINK_POLICY 0x02
604
605#define OCF_HOLD_MODE 0x0001
606typedef struct {
607 uint16_t handle;
608 uint16_t max_interval;
609 uint16_t min_interval;
610} __attribute__ ((packed)) hold_mode_cp;
611#define HOLD_MODE_CP_SIZE 6
612
613#define OCF_SNIFF_MODE 0x0003
614typedef struct {
615 uint16_t handle;
616 uint16_t max_interval;
617 uint16_t min_interval;
618 uint16_t attempt;
619 uint16_t timeout;
620} __attribute__ ((packed)) sniff_mode_cp;
621#define SNIFF_MODE_CP_SIZE 10
622
623#define OCF_EXIT_SNIFF_MODE 0x0004
624typedef struct {
625 uint16_t handle;
626} __attribute__ ((packed)) exit_sniff_mode_cp;
627#define EXIT_SNIFF_MODE_CP_SIZE 2
628
629#define OCF_PARK_MODE 0x0005
630typedef struct {
631 uint16_t handle;
632 uint16_t max_interval;
633 uint16_t min_interval;
634} __attribute__ ((packed)) park_mode_cp;
635#define PARK_MODE_CP_SIZE 6
636
637#define OCF_EXIT_PARK_MODE 0x0006
638typedef struct {
639 uint16_t handle;
640} __attribute__ ((packed)) exit_park_mode_cp;
641#define EXIT_PARK_MODE_CP_SIZE 2
642
643#define OCF_QOS_SETUP 0x0007
644typedef struct {
645 uint8_t service_type; /* 1 = best effort */
646 uint32_t token_rate; /* Byte per seconds */
647 uint32_t peak_bandwidth; /* Byte per seconds */
648 uint32_t latency; /* Microseconds */
649 uint32_t delay_variation; /* Microseconds */
650} __attribute__ ((packed)) hci_qos;
651#define HCI_QOS_CP_SIZE 17
652typedef struct {
653 uint16_t handle;
654 uint8_t flags; /* Reserved */
655 hci_qos qos;
656} __attribute__ ((packed)) qos_setup_cp;
657#define QOS_SETUP_CP_SIZE (3 + HCI_QOS_CP_SIZE)
658
659#define OCF_ROLE_DISCOVERY 0x0009
660typedef struct {
661 uint16_t handle;
662} __attribute__ ((packed)) role_discovery_cp;
663#define ROLE_DISCOVERY_CP_SIZE 2
664typedef struct {
665 uint8_t status;
666 uint16_t handle;
667 uint8_t role;
668} __attribute__ ((packed)) role_discovery_rp;
669#define ROLE_DISCOVERY_RP_SIZE 4
670
671#define OCF_SWITCH_ROLE 0x000B
672typedef struct {
673 bdaddr_t bdaddr;
674 uint8_t role;
675} __attribute__ ((packed)) switch_role_cp;
676#define SWITCH_ROLE_CP_SIZE 7
677
678#define OCF_READ_LINK_POLICY 0x000C
679typedef struct {
680 uint16_t handle;
681} __attribute__ ((packed)) read_link_policy_cp;
682#define READ_LINK_POLICY_CP_SIZE 2
683typedef struct {
684 uint8_t status;
685 uint16_t handle;
686 uint16_t policy;
687} __attribute__ ((packed)) read_link_policy_rp;
688#define READ_LINK_POLICY_RP_SIZE 5
689
690#define OCF_WRITE_LINK_POLICY 0x000D
691typedef struct {
692 uint16_t handle;
693 uint16_t policy;
694} __attribute__ ((packed)) write_link_policy_cp;
695#define WRITE_LINK_POLICY_CP_SIZE 4
696typedef struct {
697 uint8_t status;
698 uint16_t handle;
699} __attribute__ ((packed)) write_link_policy_rp;
700#define WRITE_LINK_POLICY_RP_SIZE 3
701
702#define OCF_READ_DEFAULT_LINK_POLICY 0x000E
703
704#define OCF_WRITE_DEFAULT_LINK_POLICY 0x000F
705
706#define OCF_FLOW_SPECIFICATION 0x0010
707
708#define OCF_SNIFF_SUBRATING 0x0011
709typedef struct {
710 uint16_t handle;
711 uint16_t max_latency;
712 uint16_t min_remote_timeout;
713 uint16_t min_local_timeout;
714} __attribute__ ((packed)) sniff_subrating_cp;
715#define SNIFF_SUBRATING_CP_SIZE 8
716
717/* Host Controller and Baseband */
718#define OGF_HOST_CTL 0x03
719
720#define OCF_SET_EVENT_MASK 0x0001
721typedef struct {
722 uint8_t mask[8];
723} __attribute__ ((packed)) set_event_mask_cp;
724#define SET_EVENT_MASK_CP_SIZE 8
725
726#define OCF_RESET 0x0003
727
728#define OCF_SET_EVENT_FLT 0x0005
729typedef struct {
730 uint8_t flt_type;
731 uint8_t cond_type;
732 uint8_t condition[0];
733} __attribute__ ((packed)) set_event_flt_cp;
734#define SET_EVENT_FLT_CP_SIZE 2
735
736/* Filter types */
737#define FLT_CLEAR_ALL 0x00
738#define FLT_INQ_RESULT 0x01
739#define FLT_CONN_SETUP 0x02
740/* INQ_RESULT Condition types */
741#define INQ_RESULT_RETURN_ALL 0x00
742#define INQ_RESULT_RETURN_CLASS 0x01
743#define INQ_RESULT_RETURN_BDADDR 0x02
744/* CONN_SETUP Condition types */
745#define CONN_SETUP_ALLOW_ALL 0x00
746#define CONN_SETUP_ALLOW_CLASS 0x01
747#define CONN_SETUP_ALLOW_BDADDR 0x02
748/* CONN_SETUP Conditions */
749#define CONN_SETUP_AUTO_OFF 0x01
750#define CONN_SETUP_AUTO_ON 0x02
751
752#define OCF_FLUSH 0x0008
753
754#define OCF_READ_PIN_TYPE 0x0009
755typedef struct {
756 uint8_t status;
757 uint8_t pin_type;
758} __attribute__ ((packed)) read_pin_type_rp;
759#define READ_PIN_TYPE_RP_SIZE 2
760
761#define OCF_WRITE_PIN_TYPE 0x000A
762typedef struct {
763 uint8_t pin_type;
764} __attribute__ ((packed)) write_pin_type_cp;
765#define WRITE_PIN_TYPE_CP_SIZE 1
766
767#define OCF_CREATE_NEW_UNIT_KEY 0x000B
768
769#define OCF_READ_STORED_LINK_KEY 0x000D
770typedef struct {
771 bdaddr_t bdaddr;
772 uint8_t read_all;
773} __attribute__ ((packed)) read_stored_link_key_cp;
774#define READ_STORED_LINK_KEY_CP_SIZE 7
775typedef struct {
776 uint8_t status;
777 uint16_t max_keys;
778 uint16_t num_keys;
779} __attribute__ ((packed)) read_stored_link_key_rp;
780#define READ_STORED_LINK_KEY_RP_SIZE 5
781
782#define OCF_WRITE_STORED_LINK_KEY 0x0011
783typedef struct {
784 uint8_t num_keys;
785 /* variable length part */
786} __attribute__ ((packed)) write_stored_link_key_cp;
787#define WRITE_STORED_LINK_KEY_CP_SIZE 1
788typedef struct {
789 uint8_t status;
790 uint8_t num_keys;
791} __attribute__ ((packed)) write_stored_link_key_rp;
792#define READ_WRITE_LINK_KEY_RP_SIZE 2
793
794#define OCF_DELETE_STORED_LINK_KEY 0x0012
795typedef struct {
796 bdaddr_t bdaddr;
797 uint8_t delete_all;
798} __attribute__ ((packed)) delete_stored_link_key_cp;
799#define DELETE_STORED_LINK_KEY_CP_SIZE 7
800typedef struct {
801 uint8_t status;
802 uint16_t num_keys;
803} __attribute__ ((packed)) delete_stored_link_key_rp;
804#define DELETE_STORED_LINK_KEY_RP_SIZE 3
805
806#define HCI_MAX_NAME_LENGTH 248
807
808#define OCF_CHANGE_LOCAL_NAME 0x0013
809typedef struct {
810 uint8_t name[HCI_MAX_NAME_LENGTH];
811} __attribute__ ((packed)) change_local_name_cp;
812#define CHANGE_LOCAL_NAME_CP_SIZE 248
813
814#define OCF_READ_LOCAL_NAME 0x0014
815typedef struct {
816 uint8_t status;
817 uint8_t name[HCI_MAX_NAME_LENGTH];
818} __attribute__ ((packed)) read_local_name_rp;
819#define READ_LOCAL_NAME_RP_SIZE 249
820
821#define OCF_READ_CONN_ACCEPT_TIMEOUT 0x0015
822typedef struct {
823 uint8_t status;
824 uint16_t timeout;
825} __attribute__ ((packed)) read_conn_accept_timeout_rp;
826#define READ_CONN_ACCEPT_TIMEOUT_RP_SIZE 3
827
828#define OCF_WRITE_CONN_ACCEPT_TIMEOUT 0x0016
829typedef struct {
830 uint16_t timeout;
831} __attribute__ ((packed)) write_conn_accept_timeout_cp;
832#define WRITE_CONN_ACCEPT_TIMEOUT_CP_SIZE 2
833
834#define OCF_READ_PAGE_TIMEOUT 0x0017
835typedef struct {
836 uint8_t status;
837 uint16_t timeout;
838} __attribute__ ((packed)) read_page_timeout_rp;
839#define READ_PAGE_TIMEOUT_RP_SIZE 3
840
841#define OCF_WRITE_PAGE_TIMEOUT 0x0018
842typedef struct {
843 uint16_t timeout;
844} __attribute__ ((packed)) write_page_timeout_cp;
845#define WRITE_PAGE_TIMEOUT_CP_SIZE 2
846
847#define OCF_READ_SCAN_ENABLE 0x0019
848typedef struct {
849 uint8_t status;
850 uint8_t enable;
851} __attribute__ ((packed)) read_scan_enable_rp;
852#define READ_SCAN_ENABLE_RP_SIZE 2
853
854#define OCF_WRITE_SCAN_ENABLE 0x001A
855 #define SCAN_DISABLED 0x00
856 #define SCAN_INQUIRY 0x01
857 #define SCAN_PAGE 0x02
858
859#define OCF_READ_PAGE_ACTIVITY 0x001B
860typedef struct {
861 uint8_t status;
862 uint16_t interval;
863 uint16_t window;
864} __attribute__ ((packed)) read_page_activity_rp;
865#define READ_PAGE_ACTIVITY_RP_SIZE 5
866
867#define OCF_WRITE_PAGE_ACTIVITY 0x001C
868typedef struct {
869 uint16_t interval;
870 uint16_t window;
871} __attribute__ ((packed)) write_page_activity_cp;
872#define WRITE_PAGE_ACTIVITY_CP_SIZE 4
873
874#define OCF_READ_INQ_ACTIVITY 0x001D
875typedef struct {
876 uint8_t status;
877 uint16_t interval;
878 uint16_t window;
879} __attribute__ ((packed)) read_inq_activity_rp;
880#define READ_INQ_ACTIVITY_RP_SIZE 5
881
882#define OCF_WRITE_INQ_ACTIVITY 0x001E
883typedef struct {
884 uint16_t interval;
885 uint16_t window;
886} __attribute__ ((packed)) write_inq_activity_cp;
887#define WRITE_INQ_ACTIVITY_CP_SIZE 4
888
889#define OCF_READ_AUTH_ENABLE 0x001F
890
891#define OCF_WRITE_AUTH_ENABLE 0x0020
892 #define AUTH_DISABLED 0x00
893 #define AUTH_ENABLED 0x01
894
895#define OCF_READ_ENCRYPT_MODE 0x0021
896
897#define OCF_WRITE_ENCRYPT_MODE 0x0022
898 #define ENCRYPT_DISABLED 0x00
899 #define ENCRYPT_P2P 0x01
900 #define ENCRYPT_BOTH 0x02
901
902#define OCF_READ_CLASS_OF_DEV 0x0023
903typedef struct {
904 uint8_t status;
905 uint8_t dev_class[3];
906} __attribute__ ((packed)) read_class_of_dev_rp;
907#define READ_CLASS_OF_DEV_RP_SIZE 4
908
909#define OCF_WRITE_CLASS_OF_DEV 0x0024
910typedef struct {
911 uint8_t dev_class[3];
912} __attribute__ ((packed)) write_class_of_dev_cp;
913#define WRITE_CLASS_OF_DEV_CP_SIZE 3
914
915#define OCF_READ_VOICE_SETTING 0x0025
916typedef struct {
917 uint8_t status;
918 uint16_t voice_setting;
919} __attribute__ ((packed)) read_voice_setting_rp;
920#define READ_VOICE_SETTING_RP_SIZE 3
921
922#define OCF_WRITE_VOICE_SETTING 0x0026
923typedef struct {
924 uint16_t voice_setting;
925} __attribute__ ((packed)) write_voice_setting_cp;
926#define WRITE_VOICE_SETTING_CP_SIZE 2
927
928#define OCF_READ_AUTOMATIC_FLUSH_TIMEOUT 0x0027
929
930#define OCF_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0028
931
932#define OCF_READ_NUM_BROADCAST_RETRANS 0x0029
933
934#define OCF_WRITE_NUM_BROADCAST_RETRANS 0x002A
935
936#define OCF_READ_HOLD_MODE_ACTIVITY 0x002B
937
938#define OCF_WRITE_HOLD_MODE_ACTIVITY 0x002C
939
940#define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D
941typedef struct {
942 uint16_t handle;
943 uint8_t type;
944} __attribute__ ((packed)) read_transmit_power_level_cp;
945#define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3
946typedef struct {
947 uint8_t status;
948 uint16_t handle;
949 int8_t level;
950} __attribute__ ((packed)) read_transmit_power_level_rp;
951#define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4
952
953#define OCF_READ_SYNC_FLOW_ENABLE 0x002E
954
955#define OCF_WRITE_SYNC_FLOW_ENABLE 0x002F
956
957#define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031
958
959#define OCF_HOST_BUFFER_SIZE 0x0033
960typedef struct {
961 uint16_t acl_mtu;
962 uint8_t sco_mtu;
963 uint16_t acl_max_pkt;
964 uint16_t sco_max_pkt;
965} __attribute__ ((packed)) host_buffer_size_cp;
966#define HOST_BUFFER_SIZE_CP_SIZE 7
967
968#define OCF_HOST_NUM_COMP_PKTS 0x0035
969typedef struct {
970 uint8_t num_hndl;
971 /* variable length part */
972} __attribute__ ((packed)) host_num_comp_pkts_cp;
973#define HOST_NUM_COMP_PKTS_CP_SIZE 1
974
975#define OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
976typedef struct {
977 uint8_t status;
978 uint16_t handle;
979 uint16_t timeout;
980} __attribute__ ((packed)) read_link_supervision_timeout_rp;
981#define READ_LINK_SUPERVISION_TIMEOUT_RP_SIZE 5
982
983#define OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
984typedef struct {
985 uint16_t handle;
986 uint16_t timeout;
987} __attribute__ ((packed)) write_link_supervision_timeout_cp;
988#define WRITE_LINK_SUPERVISION_TIMEOUT_CP_SIZE 4
989typedef struct {
990 uint8_t status;
991 uint16_t handle;
992} __attribute__ ((packed)) write_link_supervision_timeout_rp;
993#define WRITE_LINK_SUPERVISION_TIMEOUT_RP_SIZE 3
994
995#define OCF_READ_NUM_SUPPORTED_IAC 0x0038
996
997#define MAX_IAC_LAP 0x40
998#define OCF_READ_CURRENT_IAC_LAP 0x0039
999typedef struct {
1000 uint8_t status;
1001 uint8_t num_current_iac;
1002 uint8_t lap[MAX_IAC_LAP][3];
1003} __attribute__ ((packed)) read_current_iac_lap_rp;
1004#define READ_CURRENT_IAC_LAP_RP_SIZE 2+3*MAX_IAC_LAP
1005
1006#define OCF_WRITE_CURRENT_IAC_LAP 0x003A
1007typedef struct {
1008 uint8_t num_current_iac;
1009 uint8_t lap[MAX_IAC_LAP][3];
1010} __attribute__ ((packed)) write_current_iac_lap_cp;
1011#define WRITE_CURRENT_IAC_LAP_CP_SIZE 1+3*MAX_IAC_LAP
1012
1013#define OCF_READ_PAGE_SCAN_PERIOD_MODE 0x003B
1014
1015#define OCF_WRITE_PAGE_SCAN_PERIOD_MODE 0x003C
1016
1017#define OCF_READ_PAGE_SCAN_MODE 0x003D
1018
1019#define OCF_WRITE_PAGE_SCAN_MODE 0x003E
1020
1021#define OCF_SET_AFH_CLASSIFICATION 0x003F
1022typedef struct {
1023 uint8_t map[10];
1024} __attribute__ ((packed)) set_afh_classification_cp;
1025#define SET_AFH_CLASSIFICATION_CP_SIZE 10
1026typedef struct {
1027 uint8_t status;
1028} __attribute__ ((packed)) set_afh_classification_rp;
1029#define SET_AFH_CLASSIFICATION_RP_SIZE 1
1030
1031#define OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1032typedef struct {
1033 uint8_t status;
1034 uint8_t type;
1035} __attribute__ ((packed)) read_inquiry_scan_type_rp;
1036#define READ_INQUIRY_SCAN_TYPE_RP_SIZE 2
1037
1038#define OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1039typedef struct {
1040 uint8_t type;
1041} __attribute__ ((packed)) write_inquiry_scan_type_cp;
1042#define WRITE_INQUIRY_SCAN_TYPE_CP_SIZE 1
1043typedef struct {
1044 uint8_t status;
1045} __attribute__ ((packed)) write_inquiry_scan_type_rp;
1046#define WRITE_INQUIRY_SCAN_TYPE_RP_SIZE 1
1047
1048#define OCF_READ_INQUIRY_MODE 0x0044
1049typedef struct {
1050 uint8_t status;
1051 uint8_t mode;
1052} __attribute__ ((packed)) read_inquiry_mode_rp;
1053#define READ_INQUIRY_MODE_RP_SIZE 2
1054
1055#define OCF_WRITE_INQUIRY_MODE 0x0045
1056typedef struct {
1057 uint8_t mode;
1058} __attribute__ ((packed)) write_inquiry_mode_cp;
1059#define WRITE_INQUIRY_MODE_CP_SIZE 1
1060typedef struct {
1061 uint8_t status;
1062} __attribute__ ((packed)) write_inquiry_mode_rp;
1063#define WRITE_INQUIRY_MODE_RP_SIZE 1
1064
1065#define OCF_READ_PAGE_SCAN_TYPE 0x0046
1066
1067#define OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1068 #define PAGE_SCAN_TYPE_STANDARD 0x00
1069 #define PAGE_SCAN_TYPE_INTERLACED 0x01
1070
1071#define OCF_READ_AFH_MODE 0x0048
1072typedef struct {
1073 uint8_t status;
1074 uint8_t mode;
1075} __attribute__ ((packed)) read_afh_mode_rp;
1076#define READ_AFH_MODE_RP_SIZE 2
1077
1078#define OCF_WRITE_AFH_MODE 0x0049
1079typedef struct {
1080 uint8_t mode;
1081} __attribute__ ((packed)) write_afh_mode_cp;
1082#define WRITE_AFH_MODE_CP_SIZE 1
1083typedef struct {
1084 uint8_t status;
1085} __attribute__ ((packed)) write_afh_mode_rp;
1086#define WRITE_AFH_MODE_RP_SIZE 1
1087
1088#define HCI_MAX_EIR_LENGTH 240
1089
1090#define OCF_READ_EXT_INQUIRY_RESPONSE 0x0051
1091typedef struct {
1092 uint8_t status;
1093 uint8_t fec;
1094 uint8_t data[HCI_MAX_EIR_LENGTH];
1095} __attribute__ ((packed)) read_ext_inquiry_response_rp;
1096#define READ_EXT_INQUIRY_RESPONSE_RP_SIZE 242
1097
1098#define OCF_WRITE_EXT_INQUIRY_RESPONSE 0x0052
1099typedef struct {
1100 uint8_t fec;
1101 uint8_t data[HCI_MAX_EIR_LENGTH];
1102} __attribute__ ((packed)) write_ext_inquiry_response_cp;
1103#define WRITE_EXT_INQUIRY_RESPONSE_CP_SIZE 241
1104typedef struct {
1105 uint8_t status;
1106} __attribute__ ((packed)) write_ext_inquiry_response_rp;
1107#define WRITE_EXT_INQUIRY_RESPONSE_RP_SIZE 1
1108
1109#define OCF_REFRESH_ENCRYPTION_KEY 0x0053
1110typedef struct {
1111 uint16_t handle;
1112} __attribute__ ((packed)) refresh_encryption_key_cp;
1113#define REFRESH_ENCRYPTION_KEY_CP_SIZE 2
1114typedef struct {
1115 uint8_t status;
1116} __attribute__ ((packed)) refresh_encryption_key_rp;
1117#define REFRESH_ENCRYPTION_KEY_RP_SIZE 1
1118
1119#define OCF_READ_SIMPLE_PAIRING_MODE 0x0055
1120typedef struct {
1121 uint8_t status;
1122 uint8_t mode;
1123} __attribute__ ((packed)) read_simple_pairing_mode_rp;
1124#define READ_SIMPLE_PAIRING_MODE_RP_SIZE 2
1125
1126#define OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056
1127typedef struct {
1128 uint8_t mode;
1129} __attribute__ ((packed)) write_simple_pairing_mode_cp;
1130#define WRITE_SIMPLE_PAIRING_MODE_CP_SIZE 1
1131typedef struct {
1132 uint8_t status;
1133} __attribute__ ((packed)) write_simple_pairing_mode_rp;
1134#define WRITE_SIMPLE_PAIRING_MODE_RP_SIZE 1
1135
1136#define OCF_READ_LOCAL_OOB_DATA 0x0057
1137typedef struct {
1138 uint8_t status;
1139 uint8_t hash[16];
1140 uint8_t randomizer[16];
1141} __attribute__ ((packed)) read_local_oob_data_rp;
1142#define READ_LOCAL_OOB_DATA_RP_SIZE 33
1143
1144#define OCF_READ_INQ_RESPONSE_TX_POWER_LEVEL 0x0058
1145typedef struct {
1146 uint8_t status;
1147 int8_t level;
1148} __attribute__ ((packed)) read_inq_response_tx_power_level_rp;
1149#define READ_INQ_RESPONSE_TX_POWER_LEVEL_RP_SIZE 2
1150
1151#define OCF_READ_INQUIRY_TRANSMIT_POWER_LEVEL 0x0058
1152typedef struct {
1153 uint8_t status;
1154 int8_t level;
1155} __attribute__ ((packed)) read_inquiry_transmit_power_level_rp;
1156#define READ_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 2
1157
1158#define OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL 0x0059
1159typedef struct {
1160 int8_t level;
1161} __attribute__ ((packed)) write_inquiry_transmit_power_level_cp;
1162#define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_CP_SIZE 1
1163typedef struct {
1164 uint8_t status;
1165} __attribute__ ((packed)) write_inquiry_transmit_power_level_rp;
1166#define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 1
1167
1168#define OCF_READ_DEFAULT_ERROR_DATA_REPORTING 0x005A
1169typedef struct {
1170 uint8_t status;
1171 uint8_t reporting;
1172} __attribute__ ((packed)) read_default_error_data_reporting_rp;
1173#define READ_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 2
1174
1175#define OCF_WRITE_DEFAULT_ERROR_DATA_REPORTING 0x005B
1176typedef struct {
1177 uint8_t reporting;
1178} __attribute__ ((packed)) write_default_error_data_reporting_cp;
1179#define WRITE_DEFAULT_ERROR_DATA_REPORTING_CP_SIZE 1
1180typedef struct {
1181 uint8_t status;
1182} __attribute__ ((packed)) write_default_error_data_reporting_rp;
1183#define WRITE_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 1
1184
1185#define OCF_ENHANCED_FLUSH 0x005F
1186typedef struct {
1187 uint16_t handle;
1188 uint8_t type;
1189} __attribute__ ((packed)) enhanced_flush_cp;
1190#define ENHANCED_FLUSH_CP_SIZE 3
1191
1192#define OCF_SEND_KEYPRESS_NOTIFY 0x0060
1193typedef struct {
1194 bdaddr_t bdaddr;
1195 uint8_t type;
1196} __attribute__ ((packed)) send_keypress_notify_cp;
1197#define SEND_KEYPRESS_NOTIFY_CP_SIZE 7
1198typedef struct {
1199 uint8_t status;
1200} __attribute__ ((packed)) send_keypress_notify_rp;
1201#define SEND_KEYPRESS_NOTIFY_RP_SIZE 1
1202
1203#define OCF_READ_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0061
1204typedef struct {
1205 uint8_t status;
1206 uint16_t timeout;
1207} __attribute__ ((packed)) read_log_link_accept_timeout_rp;
1208#define READ_LOGICAL_LINK_ACCEPT_TIMEOUT_RP_SIZE 3
1209
1210#define OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0062
1211typedef struct {
1212 uint16_t timeout;
1213} __attribute__ ((packed)) write_log_link_accept_timeout_cp;
1214#define WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CP_SIZE 2
1215
1216#define OCF_SET_EVENT_MASK_PAGE_2 0x0063
1217
1218#define OCF_READ_LOCATION_DATA 0x0064
1219
1220#define OCF_WRITE_LOCATION_DATA 0x0065
1221
1222#define OCF_READ_FLOW_CONTROL_MODE 0x0066
1223
1224#define OCF_WRITE_FLOW_CONTROL_MODE 0x0067
1225
1226#define OCF_READ_ENHANCED_TRANSMIT_POWER_LEVEL 0x0068
1227typedef struct {
1228 uint8_t status;
1229 uint16_t handle;
1230 int8_t level_gfsk;
1231 int8_t level_dqpsk;
1232 int8_t level_8dpsk;
1233} __attribute__ ((packed)) read_enhanced_transmit_power_level_rp;
1234#define READ_ENHANCED_TRANSMIT_POWER_LEVEL_RP_SIZE 6
1235
1236#define OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT 0x0069
1237typedef struct {
1238 uint8_t status;
1239 uint32_t timeout;
1240} __attribute__ ((packed)) read_best_effort_flush_timeout_rp;
1241#define READ_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 5
1242
1243#define OCF_WRITE_BEST_EFFORT_FLUSH_TIMEOUT 0x006A
1244typedef struct {
1245 uint16_t handle;
1246 uint32_t timeout;
1247} __attribute__ ((packed)) write_best_effort_flush_timeout_cp;
1248#define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CP_SIZE 6
1249typedef struct {
1250 uint8_t status;
1251} __attribute__ ((packed)) write_best_effort_flush_timeout_rp;
1252#define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 1
1253
1254#define OCF_READ_LE_HOST_SUPPORTED 0x006C
1255typedef struct {
1256 uint8_t status;
1257 uint8_t le;
1258 uint8_t simul;
1259} __attribute__ ((packed)) read_le_host_supported_rp;
1260#define READ_LE_HOST_SUPPORTED_RP_SIZE 3
1261
1262#define OCF_WRITE_LE_HOST_SUPPORTED 0x006D
1263typedef struct {
1264 uint8_t le;
1265 uint8_t simul;
1266} __attribute__ ((packed)) write_le_host_supported_cp;
1267#define WRITE_LE_HOST_SUPPORTED_CP_SIZE 2
1268
1269/* Informational Parameters */
1270#define OGF_INFO_PARAM 0x04
1271
1272#define OCF_READ_LOCAL_VERSION 0x0001
1273typedef struct {
1274 uint8_t status;
1275 uint8_t hci_ver;
1276 uint16_t hci_rev;
1277 uint8_t lmp_ver;
1278 uint16_t manufacturer;
1279 uint16_t lmp_subver;
1280} __attribute__ ((packed)) read_local_version_rp;
1281#define READ_LOCAL_VERSION_RP_SIZE 9
1282
1283#define OCF_READ_LOCAL_COMMANDS 0x0002
1284typedef struct {
1285 uint8_t status;
1286 uint8_t commands[64];
1287} __attribute__ ((packed)) read_local_commands_rp;
1288#define READ_LOCAL_COMMANDS_RP_SIZE 65
1289
1290#define OCF_READ_LOCAL_FEATURES 0x0003
1291typedef struct {
1292 uint8_t status;
1293 uint8_t features[8];
1294} __attribute__ ((packed)) read_local_features_rp;
1295#define READ_LOCAL_FEATURES_RP_SIZE 9
1296
1297#define OCF_READ_LOCAL_EXT_FEATURES 0x0004
1298typedef struct {
1299 uint8_t page_num;
1300} __attribute__ ((packed)) read_local_ext_features_cp;
1301#define READ_LOCAL_EXT_FEATURES_CP_SIZE 1
1302typedef struct {
1303 uint8_t status;
1304 uint8_t page_num;
1305 uint8_t max_page_num;
1306 uint8_t features[8];
1307} __attribute__ ((packed)) read_local_ext_features_rp;
1308#define READ_LOCAL_EXT_FEATURES_RP_SIZE 11
1309
1310#define OCF_READ_BUFFER_SIZE 0x0005
1311typedef struct {
1312 uint8_t status;
1313 uint16_t acl_mtu;
1314 uint8_t sco_mtu;
1315 uint16_t acl_max_pkt;
1316 uint16_t sco_max_pkt;
1317} __attribute__ ((packed)) read_buffer_size_rp;
1318#define READ_BUFFER_SIZE_RP_SIZE 8
1319
1320#define OCF_READ_COUNTRY_CODE 0x0007
1321
1322#define OCF_READ_BD_ADDR 0x0009
1323typedef struct {
1324 uint8_t status;
1325 bdaddr_t bdaddr;
1326} __attribute__ ((packed)) read_bd_addr_rp;
1327#define READ_BD_ADDR_RP_SIZE 7
1328
1329#define OCF_READ_DATA_BLOCK_SIZE 0x000A
1330typedef struct {
1331 uint8_t status;
1332 uint16_t max_acl_len;
1333 uint16_t data_block_len;
1334 uint16_t num_blocks;
1335} __attribute__ ((packed)) read_data_block_size_rp;
1336
1337/* Status params */
1338#define OGF_STATUS_PARAM 0x05
1339
1340#define OCF_READ_FAILED_CONTACT_COUNTER 0x0001
1341typedef struct {
1342 uint8_t status;
1343 uint16_t handle;
1344 uint8_t counter;
1345} __attribute__ ((packed)) read_failed_contact_counter_rp;
1346#define READ_FAILED_CONTACT_COUNTER_RP_SIZE 4
1347
1348#define OCF_RESET_FAILED_CONTACT_COUNTER 0x0002
1349typedef struct {
1350 uint8_t status;
1351 uint16_t handle;
1352} __attribute__ ((packed)) reset_failed_contact_counter_rp;
1353#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 4
1354
1355#define OCF_READ_LINK_QUALITY 0x0003
1356typedef struct {
1357 uint8_t status;
1358 uint16_t handle;
1359 uint8_t link_quality;
1360} __attribute__ ((packed)) read_link_quality_rp;
1361#define READ_LINK_QUALITY_RP_SIZE 4
1362
1363#define OCF_READ_RSSI 0x0005
1364typedef struct {
1365 uint8_t status;
1366 uint16_t handle;
1367 int8_t rssi;
1368} __attribute__ ((packed)) read_rssi_rp;
1369#define READ_RSSI_RP_SIZE 4
1370
1371#define OCF_READ_AFH_MAP 0x0006
1372typedef struct {
1373 uint8_t status;
1374 uint16_t handle;
1375 uint8_t mode;
1376 uint8_t map[10];
1377} __attribute__ ((packed)) read_afh_map_rp;
1378#define READ_AFH_MAP_RP_SIZE 14
1379
1380#define OCF_READ_CLOCK 0x0007
1381typedef struct {
1382 uint16_t handle;
1383 uint8_t which_clock;
1384} __attribute__ ((packed)) read_clock_cp;
1385#define READ_CLOCK_CP_SIZE 3
1386typedef struct {
1387 uint8_t status;
1388 uint16_t handle;
1389 uint32_t clock;
1390 uint16_t accuracy;
1391} __attribute__ ((packed)) read_clock_rp;
1392#define READ_CLOCK_RP_SIZE 9
1393
1394#define OCF_READ_LOCAL_AMP_INFO 0x0009
1395typedef struct {
1396 uint8_t status;
1397 uint8_t amp_status;
1398 uint32_t total_bandwidth;
1399 uint32_t max_guaranteed_bandwidth;
1400 uint32_t min_latency;
1401 uint32_t max_pdu_size;
1402 uint8_t controller_type;
1403 uint16_t pal_caps;
1404 uint16_t max_amp_assoc_length;
1405 uint32_t max_flush_timeout;
1406 uint32_t best_effort_flush_timeout;
1407} __attribute__ ((packed)) read_local_amp_info_rp;
1408#define READ_LOCAL_AMP_INFO_RP_SIZE 31
1409
1410#define OCF_READ_LOCAL_AMP_ASSOC 0x000A
1411typedef struct {
1412 uint8_t handle;
1413 uint16_t length_so_far;
1414 uint16_t assoc_length;
1415} __attribute__ ((packed)) read_local_amp_assoc_cp;
1416#define READ_LOCAL_AMP_ASSOC_CP_SIZE 5
1417typedef struct {
1418 uint8_t status;
1419 uint8_t handle;
1420 uint16_t length;
1421 uint8_t fragment[HCI_MAX_NAME_LENGTH];
1422} __attribute__ ((packed)) read_local_amp_assoc_rp;
1423#define READ_LOCAL_AMP_ASSOC_RP_SIZE 252
1424
1425#define OCF_WRITE_REMOTE_AMP_ASSOC 0x000B
1426typedef struct {
1427 uint8_t handle;
1428 uint16_t length_so_far;
1429 uint16_t remaining_length;
1430 uint8_t fragment[HCI_MAX_NAME_LENGTH];
1431} __attribute__ ((packed)) write_remote_amp_assoc_cp;
1432#define WRITE_REMOTE_AMP_ASSOC_CP_SIZE 253
1433typedef struct {
1434 uint8_t status;
1435 uint8_t handle;
1436} __attribute__ ((packed)) write_remote_amp_assoc_rp;
1437#define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2
1438
1439/* Testing commands */
1440#define OGF_TESTING_CMD 0x3e
1441
1442#define OCF_READ_LOOPBACK_MODE 0x0001
1443
1444#define OCF_WRITE_LOOPBACK_MODE 0x0002
1445
1446#define OCF_ENABLE_DEVICE_UNDER_TEST_MODE 0x0003
1447
1448#define OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004
1449typedef struct {
1450 uint8_t mode;
1451} __attribute__ ((packed)) write_simple_pairing_debug_mode_cp;
1452#define WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE 1
1453typedef struct {
1454 uint8_t status;
1455} __attribute__ ((packed)) write_simple_pairing_debug_mode_rp;
1456#define WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE 1
1457
1458/* LE commands */
1459#define OGF_LE_CTL 0x08
1460
1461#define OCF_LE_SET_EVENT_MASK 0x0001
1462typedef struct {
1463 uint8_t mask[8];
1464} __attribute__ ((packed)) le_set_event_mask_cp;
1465#define LE_SET_EVENT_MASK_CP_SIZE 8
1466
1467#define OCF_LE_READ_BUFFER_SIZE 0x0002
1468typedef struct {
1469 uint8_t status;
1470 uint16_t pkt_len;
1471 uint8_t max_pkt;
1472} __attribute__ ((packed)) le_read_buffer_size_rp;
1473#define LE_READ_BUFFER_SIZE_RP_SIZE 4
1474
1475#define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003
1476typedef struct {
1477 uint8_t status;
1478 uint8_t features[8];
1479} __attribute__ ((packed)) le_read_local_supported_features_rp;
1480#define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9
1481
1482#define OCF_LE_SET_RANDOM_ADDRESS 0x0005
1483typedef struct {
1484 bdaddr_t bdaddr;
1485} __attribute__ ((packed)) le_set_random_address_cp;
1486#define LE_SET_RANDOM_ADDRESS_CP_SIZE 6
1487
1488#define OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006
1489typedef struct {
1490 uint16_t min_interval;
1491 uint16_t max_interval;
1492 uint8_t advtype;
1493 uint8_t own_bdaddr_type;
1494 uint8_t direct_bdaddr_type;
1495 bdaddr_t direct_bdaddr;
1496 uint8_t chan_map;
1497 uint8_t filter;
1498} __attribute__ ((packed)) le_set_advertising_parameters_cp;
1499#define LE_SET_ADVERTISING_PARAMETERS_CP_SIZE 15
1500
1501#define OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007
1502typedef struct {
1503 uint8_t status;
1504 int8_t level;
1505} __attribute__ ((packed)) le_read_advertising_channel_tx_power_rp;
1506#define LE_READ_ADVERTISING_CHANNEL_TX_POWER_RP_SIZE 2
1507
1508#define OCF_LE_SET_ADVERTISING_DATA 0x0008
1509typedef struct {
1510 uint8_t length;
1511 uint8_t data[31];
1512} __attribute__ ((packed)) le_set_advertising_data_cp;
1513#define LE_SET_ADVERTISING_DATA_CP_SIZE 32
1514
1515#define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009
1516typedef struct {
1517 uint8_t length;
1518 uint8_t data[31];
1519} __attribute__ ((packed)) le_set_scan_response_data_cp;
1520#define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32
1521
1522#define OCF_LE_SET_ADVERTISE_ENABLE 0x000A
1523typedef struct {
1524 uint8_t enable;
1525} __attribute__ ((packed)) le_set_advertise_enable_cp;
1526#define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1
1527
1528#define OCF_LE_SET_SCAN_PARAMETERS 0x000B
1529typedef struct {
1530 uint8_t type;
1531 uint16_t interval;
1532 uint16_t window;
1533 uint8_t own_bdaddr_type;
1534 uint8_t filter;
1535} __attribute__ ((packed)) le_set_scan_parameters_cp;
1536#define LE_SET_SCAN_PARAMETERS_CP_SIZE 7
1537
1538#define OCF_LE_SET_SCAN_ENABLE 0x000C
1539typedef struct {
1540 uint8_t enable;
1541 uint8_t filter_dup;
1542} __attribute__ ((packed)) le_set_scan_enable_cp;
1543#define LE_SET_SCAN_ENABLE_CP_SIZE 2
1544
1545#define OCF_LE_CREATE_CONN 0x000D
1546typedef struct {
1547 uint16_t interval;
1548 uint16_t window;
1549 uint8_t initiator_filter;
1550 uint8_t peer_bdaddr_type;
1551 bdaddr_t peer_bdaddr;
1552 uint8_t own_bdaddr_type;
1553 uint16_t min_interval;
1554 uint16_t max_interval;
1555 uint16_t latency;
1556 uint16_t supervision_timeout;
1557 uint16_t min_ce_length;
1558 uint16_t max_ce_length;
1559} __attribute__ ((packed)) le_create_connection_cp;
1560#define LE_CREATE_CONN_CP_SIZE 25
1561
1562#define OCF_LE_CREATE_CONN_CANCEL 0x000E
1563
1564#define OCF_LE_READ_WHITE_LIST_SIZE 0x000F
1565typedef struct {
1566 uint8_t status;
1567 uint8_t size;
1568} __attribute__ ((packed)) le_read_white_list_size_rp;
1569#define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2
1570
1571#define OCF_LE_CLEAR_WHITE_LIST 0x0010
1572
1573#define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
1574typedef struct {
1575 uint8_t bdaddr_type;
1576 bdaddr_t bdaddr;
1577} __attribute__ ((packed)) le_add_device_to_white_list_cp;
1578#define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7
1579
1580#define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012
1581typedef struct {
1582 uint8_t bdaddr_type;
1583 bdaddr_t bdaddr;
1584} __attribute__ ((packed)) le_remove_device_from_white_list_cp;
1585#define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7
1586
1587#define OCF_LE_CONN_UPDATE 0x0013
1588typedef struct {
1589 uint16_t handle;
1590 uint16_t min_interval;
1591 uint16_t max_interval;
1592 uint16_t latency;
1593 uint16_t supervision_timeout;
1594 uint16_t min_ce_length;
1595 uint16_t max_ce_length;
1596} __attribute__ ((packed)) le_connection_update_cp;
1597#define LE_CONN_UPDATE_CP_SIZE 14
1598
1599#define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014
1600typedef struct {
1601 uint8_t map[5];
1602} __attribute__ ((packed)) le_set_host_channel_classification_cp;
1603#define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5
1604
1605#define OCF_LE_READ_CHANNEL_MAP 0x0015
1606typedef struct {
1607 uint16_t handle;
1608} __attribute__ ((packed)) le_read_channel_map_cp;
1609#define LE_READ_CHANNEL_MAP_CP_SIZE 2
1610typedef struct {
1611 uint8_t status;
1612 uint16_t handle;
1613 uint8_t map[5];
1614} __attribute__ ((packed)) le_read_channel_map_rp;
1615#define LE_READ_CHANNEL_MAP_RP_SIZE 8
1616
1617#define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016
1618typedef struct {
1619 uint16_t handle;
1620} __attribute__ ((packed)) le_read_remote_used_features_cp;
1621#define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2
1622
1623#define OCF_LE_ENCRYPT 0x0017
1624typedef struct {
1625 uint8_t key[16];
1626 uint8_t plaintext[16];
1627} __attribute__ ((packed)) le_encrypt_cp;
1628#define LE_ENCRYPT_CP_SIZE 32
1629typedef struct {
1630 uint8_t status;
1631 uint8_t data[16];
1632} __attribute__ ((packed)) le_encrypt_rp;
1633#define LE_ENCRYPT_RP_SIZE 17
1634
1635#define OCF_LE_RAND 0x0018
1636typedef struct {
1637 uint8_t status;
1638 uint64_t random;
1639} __attribute__ ((packed)) le_rand_rp;
1640#define LE_RAND_RP_SIZE 9
1641
1642#define OCF_LE_START_ENCRYPTION 0x0019
1643typedef struct {
1644 uint16_t handle;
1645 uint64_t random;
1646 uint16_t diversifier;
1647 uint8_t key[16];
1648} __attribute__ ((packed)) le_start_encryption_cp;
1649#define LE_START_ENCRYPTION_CP_SIZE 28
1650
1651#define OCF_LE_LTK_REPLY 0x001A
1652typedef struct {
1653 uint16_t handle;
1654 uint8_t key[16];
1655} __attribute__ ((packed)) le_ltk_reply_cp;
1656#define LE_LTK_REPLY_CP_SIZE 18
1657typedef struct {
1658 uint8_t status;
1659 uint16_t handle;
1660} __attribute__ ((packed)) le_ltk_reply_rp;
1661#define LE_LTK_REPLY_RP_SIZE 3
1662
1663#define OCF_LE_LTK_NEG_REPLY 0x001B
1664typedef struct {
1665 uint16_t handle;
1666} __attribute__ ((packed)) le_ltk_neg_reply_cp;
1667#define LE_LTK_NEG_REPLY_CP_SIZE 2
1668typedef struct {
1669 uint8_t status;
1670 uint16_t handle;
1671} __attribute__ ((packed)) le_ltk_neg_reply_rp;
1672#define LE_LTK_NEG_REPLY_RP_SIZE 3
1673
1674#define OCF_LE_READ_SUPPORTED_STATES 0x001C
1675typedef struct {
1676 uint8_t status;
1677 uint64_t states;
1678} __attribute__ ((packed)) le_read_supported_states_rp;
1679#define LE_READ_SUPPORTED_STATES_RP_SIZE 9
1680
1681#define OCF_LE_RECEIVER_TEST 0x001D
1682typedef struct {
1683 uint8_t frequency;
1684} __attribute__ ((packed)) le_receiver_test_cp;
1685#define LE_RECEIVER_TEST_CP_SIZE 1
1686
1687#define OCF_LE_TRANSMITTER_TEST 0x001E
1688typedef struct {
1689 uint8_t frequency;
1690 uint8_t length;
1691 uint8_t payload;
1692} __attribute__ ((packed)) le_transmitter_test_cp;
1693#define LE_TRANSMITTER_TEST_CP_SIZE 3
1694
1695#define OCF_LE_TEST_END 0x001F
1696typedef struct {
1697 uint8_t status;
1698 uint16_t num_pkts;
1699} __attribute__ ((packed)) le_test_end_rp;
1700#define LE_TEST_END_RP_SIZE 3
1701
1702/* Vendor specific commands */
1703#define OGF_VENDOR_CMD 0x3f
1704
1705/* ---- HCI Events ---- */
1706
1707#define EVT_INQUIRY_COMPLETE 0x01
1708
1709#define EVT_INQUIRY_RESULT 0x02
1710typedef struct {
1711 bdaddr_t bdaddr;
1712 uint8_t pscan_rep_mode;
1713 uint8_t pscan_period_mode;
1714 uint8_t pscan_mode;
1715 uint8_t dev_class[3];
1716 uint16_t clock_offset;
1717} __attribute__ ((packed)) inquiry_info;
1718#define INQUIRY_INFO_SIZE 14
1719
1720#define EVT_CONN_COMPLETE 0x03
1721typedef struct {
1722 uint8_t status;
1723 uint16_t handle;
1724 bdaddr_t bdaddr;
1725 uint8_t link_type;
1726 uint8_t encr_mode;
1727} __attribute__ ((packed)) evt_conn_complete;
1728#define EVT_CONN_COMPLETE_SIZE 11
1729
1730#define EVT_CONN_REQUEST 0x04
1731typedef struct {
1732 bdaddr_t bdaddr;
1733 uint8_t dev_class[3];
1734 uint8_t link_type;
1735} __attribute__ ((packed)) evt_conn_request;
1736#define EVT_CONN_REQUEST_SIZE 10
1737
1738#define EVT_DISCONN_COMPLETE 0x05
1739typedef struct {
1740 uint8_t status;
1741 uint16_t handle;
1742 uint8_t reason;
1743} __attribute__ ((packed)) evt_disconn_complete;
1744#define EVT_DISCONN_COMPLETE_SIZE 4
1745
1746#define EVT_AUTH_COMPLETE 0x06
1747typedef struct {
1748 uint8_t status;
1749 uint16_t handle;
1750} __attribute__ ((packed)) evt_auth_complete;
1751#define EVT_AUTH_COMPLETE_SIZE 3
1752
1753#define EVT_REMOTE_NAME_REQ_COMPLETE 0x07
1754typedef struct {
1755 uint8_t status;
1756 bdaddr_t bdaddr;
1757 uint8_t name[HCI_MAX_NAME_LENGTH];
1758} __attribute__ ((packed)) evt_remote_name_req_complete;
1759#define EVT_REMOTE_NAME_REQ_COMPLETE_SIZE 255
1760
1761#define EVT_ENCRYPT_CHANGE 0x08
1762typedef struct {
1763 uint8_t status;
1764 uint16_t handle;
1765 uint8_t encrypt;
1766} __attribute__ ((packed)) evt_encrypt_change;
1767#define EVT_ENCRYPT_CHANGE_SIZE 5
1768
1769#define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
1770typedef struct {
1771 uint8_t status;
1772 uint16_t handle;
1773} __attribute__ ((packed)) evt_change_conn_link_key_complete;
1774#define EVT_CHANGE_CONN_LINK_KEY_COMPLETE_SIZE 3
1775
1776#define EVT_MASTER_LINK_KEY_COMPLETE 0x0A
1777typedef struct {
1778 uint8_t status;
1779 uint16_t handle;
1780 uint8_t key_flag;
1781} __attribute__ ((packed)) evt_master_link_key_complete;
1782#define EVT_MASTER_LINK_KEY_COMPLETE_SIZE 4
1783
1784#define EVT_READ_REMOTE_FEATURES_COMPLETE 0x0B
1785typedef struct {
1786 uint8_t status;
1787 uint16_t handle;
1788 uint8_t features[8];
1789} __attribute__ ((packed)) evt_read_remote_features_complete;
1790#define EVT_READ_REMOTE_FEATURES_COMPLETE_SIZE 11
1791
1792#define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C
1793typedef struct {
1794 uint8_t status;
1795 uint16_t handle;
1796 uint8_t lmp_ver;
1797 uint16_t manufacturer;
1798 uint16_t lmp_subver;
1799} __attribute__ ((packed)) evt_read_remote_version_complete;
1800#define EVT_READ_REMOTE_VERSION_COMPLETE_SIZE 8
1801
1802#define EVT_QOS_SETUP_COMPLETE 0x0D
1803typedef struct {
1804 uint8_t status;
1805 uint16_t handle;
1806 uint8_t flags; /* Reserved */
1807 hci_qos qos;
1808} __attribute__ ((packed)) evt_qos_setup_complete;
1809#define EVT_QOS_SETUP_COMPLETE_SIZE (4 + HCI_QOS_CP_SIZE)
1810
1811#define EVT_CMD_COMPLETE 0x0E
1812typedef struct {
1813 uint8_t ncmd;
1814 uint16_t opcode;
1815} __attribute__ ((packed)) evt_cmd_complete;
1816#define EVT_CMD_COMPLETE_SIZE 3
1817
1818#define EVT_CMD_STATUS 0x0F
1819typedef struct {
1820 uint8_t status;
1821 uint8_t ncmd;
1822 uint16_t opcode;
1823} __attribute__ ((packed)) evt_cmd_status;
1824#define EVT_CMD_STATUS_SIZE 4
1825
1826#define EVT_HARDWARE_ERROR 0x10
1827typedef struct {
1828 uint8_t code;
1829} __attribute__ ((packed)) evt_hardware_error;
1830#define EVT_HARDWARE_ERROR_SIZE 1
1831
1832#define EVT_FLUSH_OCCURRED 0x11
1833typedef struct {
1834 uint16_t handle;
1835} __attribute__ ((packed)) evt_flush_occured;
1836#define EVT_FLUSH_OCCURRED_SIZE 2
1837
1838#define EVT_ROLE_CHANGE 0x12
1839typedef struct {
1840 uint8_t status;
1841 bdaddr_t bdaddr;
1842 uint8_t role;
1843} __attribute__ ((packed)) evt_role_change;
1844#define EVT_ROLE_CHANGE_SIZE 8
1845
1846#define EVT_NUM_COMP_PKTS 0x13
1847typedef struct {
1848 uint8_t num_hndl;
1849 /* variable length part */
1850} __attribute__ ((packed)) evt_num_comp_pkts;
1851#define EVT_NUM_COMP_PKTS_SIZE 1
1852
1853#define EVT_MODE_CHANGE 0x14
1854typedef struct {
1855 uint8_t status;
1856 uint16_t handle;
1857 uint8_t mode;
1858 uint16_t interval;
1859} __attribute__ ((packed)) evt_mode_change;
1860#define EVT_MODE_CHANGE_SIZE 6
1861
1862#define EVT_RETURN_LINK_KEYS 0x15
1863typedef struct {
1864 uint8_t num_keys;
1865 /* variable length part */
1866} __attribute__ ((packed)) evt_return_link_keys;
1867#define EVT_RETURN_LINK_KEYS_SIZE 1
1868
1869#define EVT_PIN_CODE_REQ 0x16
1870typedef struct {
1871 bdaddr_t bdaddr;
1872} __attribute__ ((packed)) evt_pin_code_req;
1873#define EVT_PIN_CODE_REQ_SIZE 6
1874
1875#define EVT_LINK_KEY_REQ 0x17
1876typedef struct {
1877 bdaddr_t bdaddr;
1878} __attribute__ ((packed)) evt_link_key_req;
1879#define EVT_LINK_KEY_REQ_SIZE 6
1880
1881#define EVT_LINK_KEY_NOTIFY 0x18
1882typedef struct {
1883 bdaddr_t bdaddr;
1884 uint8_t link_key[16];
1885 uint8_t key_type;
1886} __attribute__ ((packed)) evt_link_key_notify;
1887#define EVT_LINK_KEY_NOTIFY_SIZE 23
1888
1889#define EVT_LOOPBACK_COMMAND 0x19
1890
1891#define EVT_DATA_BUFFER_OVERFLOW 0x1A
1892typedef struct {
1893 uint8_t link_type;
1894} __attribute__ ((packed)) evt_data_buffer_overflow;
1895#define EVT_DATA_BUFFER_OVERFLOW_SIZE 1
1896
1897#define EVT_MAX_SLOTS_CHANGE 0x1B
1898typedef struct {
1899 uint16_t handle;
1900 uint8_t max_slots;
1901} __attribute__ ((packed)) evt_max_slots_change;
1902#define EVT_MAX_SLOTS_CHANGE_SIZE 3
1903
1904#define EVT_READ_CLOCK_OFFSET_COMPLETE 0x1C
1905typedef struct {
1906 uint8_t status;
1907 uint16_t handle;
1908 uint16_t clock_offset;
1909} __attribute__ ((packed)) evt_read_clock_offset_complete;
1910#define EVT_READ_CLOCK_OFFSET_COMPLETE_SIZE 5
1911
1912#define EVT_CONN_PTYPE_CHANGED 0x1D
1913typedef struct {
1914 uint8_t status;
1915 uint16_t handle;
1916 uint16_t ptype;
1917} __attribute__ ((packed)) evt_conn_ptype_changed;
1918#define EVT_CONN_PTYPE_CHANGED_SIZE 5
1919
1920#define EVT_QOS_VIOLATION 0x1E
1921typedef struct {
1922 uint16_t handle;
1923} __attribute__ ((packed)) evt_qos_violation;
1924#define EVT_QOS_VIOLATION_SIZE 2
1925
1926#define EVT_PSCAN_REP_MODE_CHANGE 0x20
1927typedef struct {
1928 bdaddr_t bdaddr;
1929 uint8_t pscan_rep_mode;
1930} __attribute__ ((packed)) evt_pscan_rep_mode_change;
1931#define EVT_PSCAN_REP_MODE_CHANGE_SIZE 7
1932
1933#define EVT_FLOW_SPEC_COMPLETE 0x21
1934typedef struct {
1935 uint8_t status;
1936 uint16_t handle;
1937 uint8_t flags;
1938 uint8_t direction;
1939 hci_qos qos;
1940} __attribute__ ((packed)) evt_flow_spec_complete;
1941#define EVT_FLOW_SPEC_COMPLETE_SIZE (5 + HCI_QOS_CP_SIZE)
1942
1943#define EVT_INQUIRY_RESULT_WITH_RSSI 0x22
1944typedef struct {
1945 bdaddr_t bdaddr;
1946 uint8_t pscan_rep_mode;
1947 uint8_t pscan_period_mode;
1948 uint8_t dev_class[3];
1949 uint16_t clock_offset;
1950 int8_t rssi;
1951} __attribute__ ((packed)) inquiry_info_with_rssi;
1952#define INQUIRY_INFO_WITH_RSSI_SIZE 14
1953typedef struct {
1954 bdaddr_t bdaddr;
1955 uint8_t pscan_rep_mode;
1956 uint8_t pscan_period_mode;
1957 uint8_t pscan_mode;
1958 uint8_t dev_class[3];
1959 uint16_t clock_offset;
1960 int8_t rssi;
1961} __attribute__ ((packed)) inquiry_info_with_rssi_and_pscan_mode;
1962#define INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE 15
1963
1964#define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE 0x23
1965typedef struct {
1966 uint8_t status;
1967 uint16_t handle;
1968 uint8_t page_num;
1969 uint8_t max_page_num;
1970 uint8_t features[8];
1971} __attribute__ ((packed)) evt_read_remote_ext_features_complete;
1972#define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE_SIZE 13
1973
1974#define EVT_SYNC_CONN_COMPLETE 0x2C
1975typedef struct {
1976 uint8_t status;
1977 uint16_t handle;
1978 bdaddr_t bdaddr;
1979 uint8_t link_type;
1980 uint8_t trans_interval;
1981 uint8_t retrans_window;
1982 uint16_t rx_pkt_len;
1983 uint16_t tx_pkt_len;
1984 uint8_t air_mode;
1985} __attribute__ ((packed)) evt_sync_conn_complete;
1986#define EVT_SYNC_CONN_COMPLETE_SIZE 17
1987
1988#define EVT_SYNC_CONN_CHANGED 0x2D
1989typedef struct {
1990 uint8_t status;
1991 uint16_t handle;
1992 uint8_t trans_interval;
1993 uint8_t retrans_window;
1994 uint16_t rx_pkt_len;
1995 uint16_t tx_pkt_len;
1996} __attribute__ ((packed)) evt_sync_conn_changed;
1997#define EVT_SYNC_CONN_CHANGED_SIZE 9
1998
1999#define EVT_SNIFF_SUBRATING 0x2E
2000typedef struct {
2001 uint8_t status;
2002 uint16_t handle;
2003 uint16_t max_tx_latency;
2004 uint16_t max_rx_latency;
2005 uint16_t min_remote_timeout;
2006 uint16_t min_local_timeout;
2007} __attribute__ ((packed)) evt_sniff_subrating;
2008#define EVT_SNIFF_SUBRATING_SIZE 11
2009
2010#define EVT_EXTENDED_INQUIRY_RESULT 0x2F
2011typedef struct {
2012 bdaddr_t bdaddr;
2013 uint8_t pscan_rep_mode;
2014 uint8_t pscan_period_mode;
2015 uint8_t dev_class[3];
2016 uint16_t clock_offset;
2017 int8_t rssi;
2018 uint8_t data[HCI_MAX_EIR_LENGTH];
2019} __attribute__ ((packed)) extended_inquiry_info;
2020#define EXTENDED_INQUIRY_INFO_SIZE 254
2021
2022#define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
2023typedef struct {
2024 uint8_t status;
2025 uint16_t handle;
2026} __attribute__ ((packed)) evt_encryption_key_refresh_complete;
2027#define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3
2028
2029#define EVT_IO_CAPABILITY_REQUEST 0x31
2030typedef struct {
2031 bdaddr_t bdaddr;
2032} __attribute__ ((packed)) evt_io_capability_request;
2033#define EVT_IO_CAPABILITY_REQUEST_SIZE 6
2034
2035#define EVT_IO_CAPABILITY_RESPONSE 0x32
2036typedef struct {
2037 bdaddr_t bdaddr;
2038 uint8_t capability;
2039 uint8_t oob_data;
2040 uint8_t authentication;
2041} __attribute__ ((packed)) evt_io_capability_response;
2042#define EVT_IO_CAPABILITY_RESPONSE_SIZE 9
2043
2044#define EVT_USER_CONFIRM_REQUEST 0x33
2045typedef struct {
2046 bdaddr_t bdaddr;
2047 uint32_t passkey;
2048} __attribute__ ((packed)) evt_user_confirm_request;
2049#define EVT_USER_CONFIRM_REQUEST_SIZE 10
2050
2051#define EVT_USER_PASSKEY_REQUEST 0x34
2052typedef struct {
2053 bdaddr_t bdaddr;
2054} __attribute__ ((packed)) evt_user_passkey_request;
2055#define EVT_USER_PASSKEY_REQUEST_SIZE 6
2056
2057#define EVT_REMOTE_OOB_DATA_REQUEST 0x35
2058typedef struct {
2059 bdaddr_t bdaddr;
2060} __attribute__ ((packed)) evt_remote_oob_data_request;
2061#define EVT_REMOTE_OOB_DATA_REQUEST_SIZE 6
2062
2063#define EVT_SIMPLE_PAIRING_COMPLETE 0x36
2064typedef struct {
2065 uint8_t status;
2066 bdaddr_t bdaddr;
2067} __attribute__ ((packed)) evt_simple_pairing_complete;
2068#define EVT_SIMPLE_PAIRING_COMPLETE_SIZE 7
2069
2070#define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
2071typedef struct {
2072 uint16_t handle;
2073 uint16_t timeout;
2074} __attribute__ ((packed)) evt_link_supervision_timeout_changed;
2075#define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED_SIZE 4
2076
2077#define EVT_ENHANCED_FLUSH_COMPLETE 0x39
2078typedef struct {
2079 uint16_t handle;
2080} __attribute__ ((packed)) evt_enhanced_flush_complete;
2081#define EVT_ENHANCED_FLUSH_COMPLETE_SIZE 2
2082
2083#define EVT_USER_PASSKEY_NOTIFY 0x3B
2084typedef struct {
2085 bdaddr_t bdaddr;
2086 uint32_t passkey;
2087} __attribute__ ((packed)) evt_user_passkey_notify;
2088#define EVT_USER_PASSKEY_NOTIFY_SIZE 10
2089
2090#define EVT_KEYPRESS_NOTIFY 0x3C
2091typedef struct {
2092 bdaddr_t bdaddr;
2093 uint8_t type;
2094} __attribute__ ((packed)) evt_keypress_notify;
2095#define EVT_KEYPRESS_NOTIFY_SIZE 7
2096
2097#define EVT_REMOTE_HOST_FEATURES_NOTIFY 0x3D
2098typedef struct {
2099 bdaddr_t bdaddr;
2100 uint8_t features[8];
2101} __attribute__ ((packed)) evt_remote_host_features_notify;
2102#define EVT_REMOTE_HOST_FEATURES_NOTIFY_SIZE 14
2103
2104#define EVT_LE_META_EVENT 0x3E
2105typedef struct {
2106 uint8_t subevent;
2107 uint8_t data[0];
2108} __attribute__ ((packed)) evt_le_meta_event;
2109#define EVT_LE_META_EVENT_SIZE 1
2110
2111#define EVT_LE_CONN_COMPLETE 0x01
2112typedef struct {
2113 uint8_t status;
2114 uint16_t handle;
2115 uint8_t role;
2116 uint8_t peer_bdaddr_type;
2117 bdaddr_t peer_bdaddr;
2118 uint16_t interval;
2119 uint16_t latency;
2120 uint16_t supervision_timeout;
2121 uint8_t master_clock_accuracy;
2122} __attribute__ ((packed)) evt_le_connection_complete;
2123#define EVT_LE_CONN_COMPLETE_SIZE 18
2124
2125#define EVT_LE_ADVERTISING_REPORT 0x02
2126typedef struct {
2127 uint8_t evt_type;
2128 uint8_t bdaddr_type;
2129 bdaddr_t bdaddr;
2130 uint8_t length;
2131 uint8_t data[0];
2132} __attribute__ ((packed)) le_advertising_info;
2133#define LE_ADVERTISING_INFO_SIZE 9
2134
2135#define EVT_LE_CONN_UPDATE_COMPLETE 0x03
2136typedef struct {
2137 uint8_t status;
2138 uint16_t handle;
2139 uint16_t interval;
2140 uint16_t latency;
2141 uint16_t supervision_timeout;
2142} __attribute__ ((packed)) evt_le_connection_update_complete;
2143#define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9
2144
2145#define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
2146typedef struct {
2147 uint8_t status;
2148 uint16_t handle;
2149 uint8_t features[8];
2150} __attribute__ ((packed)) evt_le_read_remote_used_features_complete;
2151#define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11
2152
2153#define EVT_LE_LTK_REQUEST 0x05
2154typedef struct {
2155 uint16_t handle;
2156 uint64_t random;
2157 uint16_t diversifier;
2158} __attribute__ ((packed)) evt_le_long_term_key_request;
2159#define EVT_LE_LTK_REQUEST_SIZE 12
2160
2161#define EVT_PHYSICAL_LINK_COMPLETE 0x40
2162typedef struct {
2163 uint8_t status;
2164 uint8_t handle;
2165} __attribute__ ((packed)) evt_physical_link_complete;
2166#define EVT_PHYSICAL_LINK_COMPLETE_SIZE 2
2167
2168#define EVT_CHANNEL_SELECTED 0x41
2169
2170#define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE 0x42
2171typedef struct {
2172 uint8_t status;
2173 uint8_t handle;
2174 uint8_t reason;
2175} __attribute__ ((packed)) evt_disconn_physical_link_complete;
2176#define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE_SIZE 3
2177
2178#define EVT_PHYSICAL_LINK_LOSS_EARLY_WARNING 0x43
2179typedef struct {
2180 uint8_t handle;
2181 uint8_t reason;
2182} __attribute__ ((packed)) evt_physical_link_loss_warning;
2183#define EVT_PHYSICAL_LINK_LOSS_WARNING_SIZE 2
2184
2185#define EVT_PHYSICAL_LINK_RECOVERY 0x44
2186typedef struct {
2187 uint8_t handle;
2188} __attribute__ ((packed)) evt_physical_link_recovery;
2189#define EVT_PHYSICAL_LINK_RECOVERY_SIZE 1
2190
2191#define EVT_LOGICAL_LINK_COMPLETE 0x45
2192typedef struct {
2193 uint8_t status;
2194 uint16_t log_handle;
2195 uint8_t handle;
2196 uint8_t tx_flow_id;
2197} __attribute__ ((packed)) evt_logical_link_complete;
2198#define EVT_LOGICAL_LINK_COMPLETE_SIZE 5
2199
2200#define EVT_DISCONNECT_LOGICAL_LINK_COMPLETE 0x46
2201
2202#define EVT_FLOW_SPEC_MODIFY_COMPLETE 0x47
2203typedef struct {
2204 uint8_t status;
2205 uint16_t handle;
2206} __attribute__ ((packed)) evt_flow_spec_modify_complete;
2207#define EVT_FLOW_SPEC_MODIFY_COMPLETE_SIZE 3
2208
2209#define EVT_NUMBER_COMPLETED_BLOCKS 0x48
2210typedef struct {
2211 uint16_t handle;
2212 uint16_t num_cmplt_pkts;
2213 uint16_t num_cmplt_blks;
2214} __attribute__ ((packed)) cmplt_handle;
2215typedef struct {
2216 uint16_t total_num_blocks;
2217 uint8_t num_handles;
2218 cmplt_handle handles[0];
2219} __attribute__ ((packed)) evt_num_completed_blocks;
2220
2221#define EVT_AMP_STATUS_CHANGE 0x4D
2222typedef struct {
2223 uint8_t status;
2224 uint8_t amp_status;
2225} __attribute__ ((packed)) evt_amp_status_change;
2226#define EVT_AMP_STATUS_CHANGE_SIZE 2
2227
2228#define EVT_TESTING 0xFE
2229
2230#define EVT_VENDOR 0xFF
2231
2232/* Internal events generated by BlueZ stack */
2233#define EVT_STACK_INTERNAL 0xFD
2234typedef struct {
2235 uint16_t type;
2236 uint8_t data[0];
2237} __attribute__ ((packed)) evt_stack_internal;
2238#define EVT_STACK_INTERNAL_SIZE 2
2239
2240#define EVT_SI_DEVICE 0x01
2241typedef struct {
2242 uint16_t event;
2243 uint16_t dev_id;
2244} __attribute__ ((packed)) evt_si_device;
2245#define EVT_SI_DEVICE_SIZE 4
2246
2247/* -------- HCI Packet structures -------- */
2248#define HCI_TYPE_LEN 1
2249
2250typedef struct {
2251 uint16_t opcode; /* OCF & OGF */
2252 uint8_t plen;
2253} __attribute__ ((packed)) hci_command_hdr;
2254#define HCI_COMMAND_HDR_SIZE 3
2255
2256typedef struct {
2257 uint8_t evt;
2258 uint8_t plen;
2259} __attribute__ ((packed)) hci_event_hdr;
2260#define HCI_EVENT_HDR_SIZE 2
2261
2262typedef struct {
2263 uint16_t handle; /* Handle & Flags(PB, BC) */
2264 uint16_t dlen;
2265} __attribute__ ((packed)) hci_acl_hdr;
2266#define HCI_ACL_HDR_SIZE 4
2267
2268typedef struct {
2269 uint16_t handle;
2270 uint8_t dlen;
2271} __attribute__ ((packed)) hci_sco_hdr;
2272#define HCI_SCO_HDR_SIZE 3
2273
2274typedef struct {
2275 uint16_t device;
2276 uint16_t type;
2277 uint16_t plen;
2278} __attribute__ ((packed)) hci_msg_hdr;
2279#define HCI_MSG_HDR_SIZE 6
2280
2281/* Command opcode pack/unpack */
2282#define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10))
2283#define cmd_opcode_ogf(op) (op >> 10)
2284#define cmd_opcode_ocf(op) (op & 0x03ff)
2285
2286/* ACL handle and flags pack/unpack */
2287#define acl_handle_pack(h, f) (uint16_t)((h & 0x0fff)|(f << 12))
2288#define acl_handle(h) (h & 0x0fff)
2289#define acl_flags(h) (h >> 12)
2290
2291#endif /* _NO_HCI_DEFS */
2292
2293/* HCI Socket options */
2294#define HCI_DATA_DIR 1
2295#define HCI_FILTER 2
2296#define HCI_TIME_STAMP 3
2297
2298/* HCI CMSG flags */
2299#define HCI_CMSG_DIR 0x0001
2300#define HCI_CMSG_TSTAMP 0x0002
2301
2302struct sockaddr_hci {
2303 sa_family_t hci_family;
2304 unsigned short hci_dev;
2305 unsigned short hci_channel;
2306};
2307#define HCI_DEV_NONE 0xffff
2308
2309#define HCI_CHANNEL_RAW 0
2310#define HCI_CHANNEL_MONITOR 2
2311#define HCI_CHANNEL_CONTROL 3
2312
2313struct hci_filter {
2314 uint32_t type_mask;
2315 uint32_t event_mask[2];
2316 uint16_t opcode;
2317};
2318
2319#define HCI_FLT_TYPE_BITS 31
2320#define HCI_FLT_EVENT_BITS 63
2321#define HCI_FLT_OGF_BITS 63
2322#define HCI_FLT_OCF_BITS 127
2323
2324/* Ioctl requests structures */
2325struct hci_dev_stats {
2326 uint32_t err_rx;
2327 uint32_t err_tx;
2328 uint32_t cmd_tx;
2329 uint32_t evt_rx;
2330 uint32_t acl_tx;
2331 uint32_t acl_rx;
2332 uint32_t sco_tx;
2333 uint32_t sco_rx;
2334 uint32_t byte_rx;
2335 uint32_t byte_tx;
2336};
2337
2338struct hci_dev_info {
2339 uint16_t dev_id;
2340 char name[8];
2341
2342 bdaddr_t bdaddr;
2343
2344 uint32_t flags;
2345 uint8_t type;
2346
2347 uint8_t features[8];
2348
2349 uint32_t pkt_type;
2350 uint32_t link_policy;
2351 uint32_t link_mode;
2352
2353 uint16_t acl_mtu;
2354 uint16_t acl_pkts;
2355 uint16_t sco_mtu;
2356 uint16_t sco_pkts;
2357
2358 struct hci_dev_stats stat;
2359};
2360
2361struct hci_conn_info {
2362 uint16_t handle;
2363 bdaddr_t bdaddr;
2364 uint8_t type;
2365 uint8_t out;
2366 uint16_t state;
2367 uint32_t link_mode;
2368};
2369
2370struct hci_dev_req {
2371 uint16_t dev_id;
2372 uint32_t dev_opt;
2373};
2374
2375struct hci_dev_list_req {
2376 uint16_t dev_num;
2377 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
2378};
2379
2380struct hci_conn_list_req {
2381 uint16_t dev_id;
2382 uint16_t conn_num;
2383 struct hci_conn_info conn_info[0];
2384};
2385
2386struct hci_conn_info_req {
2387 bdaddr_t bdaddr;
2388 uint8_t type;
2389 struct hci_conn_info conn_info[0];
2390};
2391
2392struct hci_auth_info_req {
2393 bdaddr_t bdaddr;
2394 uint8_t type;
2395};
2396
2397struct hci_inquiry_req {
2398 uint16_t dev_id;
2399 uint16_t flags;
2400 uint8_t lap[3];
2401 uint8_t length;
2402 uint8_t num_rsp;
2403};
2404#define IREQ_CACHE_FLUSH 0x0001
2405
2406#ifdef __cplusplus
2407}
2408#endif
2409
2410#endif /* __HCI_H */