CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/hcitools/lib/bluetooth/hci.h
Views: 3960
1
/*
2
*
3
* BlueZ - Bluetooth protocol stack for Linux
4
*
5
* Copyright (C) 2000-2001 Qualcomm Incorporated
6
* Copyright (C) 2002-2003 Maxim Krasnyansky <[email protected]>
7
* Copyright (C) 2002-2010 Marcel Holtmann <[email protected]>
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
30
extern "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 */
64
enum {
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 */
79
enum {
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
314
typedef 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
321
typedef 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
330
typedef 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
342
typedef 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
353
typedef 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
360
typedef 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
367
typedef 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
373
typedef 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
380
typedef 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
387
typedef 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
396
typedef 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
406
typedef 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
413
typedef 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
419
typedef 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
426
typedef 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
432
typedef 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
438
typedef 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
447
typedef 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
453
typedef 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
459
typedef 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
466
typedef 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
472
typedef 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
480
typedef 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
492
typedef 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
504
typedef 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
511
typedef 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
520
typedef 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
528
typedef 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
537
typedef 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
547
typedef 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
554
typedef 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
typedef struct {
564
uint8_t handle;
565
uint8_t key_length;
566
uint8_t key_type;
567
uint8_t key[32];
568
} __attribute__ ((packed)) accept_physical_link_cp;
569
#define ACCEPT_PHYSICAL_LINK_CP_SIZE 35
570
571
#define OCF_DISCONNECT_PHYSICAL_LINK 0x0037
572
typedef struct {
573
uint8_t handle;
574
uint8_t reason;
575
} __attribute__ ((packed)) disconnect_physical_link_cp;
576
#define DISCONNECT_PHYSICAL_LINK_CP_SIZE 2
577
578
#define OCF_CREATE_LOGICAL_LINK 0x0038
579
typedef struct {
580
uint8_t handle;
581
uint8_t tx_flow[16];
582
uint8_t rx_flow[16];
583
} __attribute__ ((packed)) create_logical_link_cp;
584
#define CREATE_LOGICAL_LINK_CP_SIZE 33
585
586
#define OCF_ACCEPT_LOGICAL_LINK 0x0039
587
588
#define OCF_DISCONNECT_LOGICAL_LINK 0x003A
589
typedef struct {
590
uint16_t handle;
591
} __attribute__ ((packed)) disconnect_logical_link_cp;
592
#define DISCONNECT_LOGICAL_LINK_CP_SIZE 2
593
594
#define OCF_LOGICAL_LINK_CANCEL 0x003B
595
typedef struct {
596
uint8_t handle;
597
uint8_t tx_flow_id;
598
} __attribute__ ((packed)) cancel_logical_link_cp;
599
#define LOGICAL_LINK_CANCEL_CP_SIZE 2
600
typedef struct {
601
uint8_t status;
602
uint8_t handle;
603
uint8_t tx_flow_id;
604
} __attribute__ ((packed)) cancel_logical_link_rp;
605
#define LOGICAL_LINK_CANCEL_RP_SIZE 3
606
607
#define OCF_FLOW_SPEC_MODIFY 0x003C
608
609
/* Link Policy */
610
#define OGF_LINK_POLICY 0x02
611
612
#define OCF_HOLD_MODE 0x0001
613
typedef struct {
614
uint16_t handle;
615
uint16_t max_interval;
616
uint16_t min_interval;
617
} __attribute__ ((packed)) hold_mode_cp;
618
#define HOLD_MODE_CP_SIZE 6
619
620
#define OCF_SNIFF_MODE 0x0003
621
typedef struct {
622
uint16_t handle;
623
uint16_t max_interval;
624
uint16_t min_interval;
625
uint16_t attempt;
626
uint16_t timeout;
627
} __attribute__ ((packed)) sniff_mode_cp;
628
#define SNIFF_MODE_CP_SIZE 10
629
630
#define OCF_EXIT_SNIFF_MODE 0x0004
631
typedef struct {
632
uint16_t handle;
633
} __attribute__ ((packed)) exit_sniff_mode_cp;
634
#define EXIT_SNIFF_MODE_CP_SIZE 2
635
636
#define OCF_PARK_MODE 0x0005
637
typedef struct {
638
uint16_t handle;
639
uint16_t max_interval;
640
uint16_t min_interval;
641
} __attribute__ ((packed)) park_mode_cp;
642
#define PARK_MODE_CP_SIZE 6
643
644
#define OCF_EXIT_PARK_MODE 0x0006
645
typedef struct {
646
uint16_t handle;
647
} __attribute__ ((packed)) exit_park_mode_cp;
648
#define EXIT_PARK_MODE_CP_SIZE 2
649
650
#define OCF_QOS_SETUP 0x0007
651
typedef struct {
652
uint8_t service_type; /* 1 = best effort */
653
uint32_t token_rate; /* Byte per seconds */
654
uint32_t peak_bandwidth; /* Byte per seconds */
655
uint32_t latency; /* Microseconds */
656
uint32_t delay_variation; /* Microseconds */
657
} __attribute__ ((packed)) hci_qos;
658
#define HCI_QOS_CP_SIZE 17
659
typedef struct {
660
uint16_t handle;
661
uint8_t flags; /* Reserved */
662
hci_qos qos;
663
} __attribute__ ((packed)) qos_setup_cp;
664
#define QOS_SETUP_CP_SIZE (3 + HCI_QOS_CP_SIZE)
665
666
#define OCF_ROLE_DISCOVERY 0x0009
667
typedef struct {
668
uint16_t handle;
669
} __attribute__ ((packed)) role_discovery_cp;
670
#define ROLE_DISCOVERY_CP_SIZE 2
671
typedef struct {
672
uint8_t status;
673
uint16_t handle;
674
uint8_t role;
675
} __attribute__ ((packed)) role_discovery_rp;
676
#define ROLE_DISCOVERY_RP_SIZE 4
677
678
#define OCF_SWITCH_ROLE 0x000B
679
typedef struct {
680
bdaddr_t bdaddr;
681
uint8_t role;
682
} __attribute__ ((packed)) switch_role_cp;
683
#define SWITCH_ROLE_CP_SIZE 7
684
685
#define OCF_READ_LINK_POLICY 0x000C
686
typedef struct {
687
uint16_t handle;
688
} __attribute__ ((packed)) read_link_policy_cp;
689
#define READ_LINK_POLICY_CP_SIZE 2
690
typedef struct {
691
uint8_t status;
692
uint16_t handle;
693
uint16_t policy;
694
} __attribute__ ((packed)) read_link_policy_rp;
695
#define READ_LINK_POLICY_RP_SIZE 5
696
697
#define OCF_WRITE_LINK_POLICY 0x000D
698
typedef struct {
699
uint16_t handle;
700
uint16_t policy;
701
} __attribute__ ((packed)) write_link_policy_cp;
702
#define WRITE_LINK_POLICY_CP_SIZE 4
703
typedef struct {
704
uint8_t status;
705
uint16_t handle;
706
} __attribute__ ((packed)) write_link_policy_rp;
707
#define WRITE_LINK_POLICY_RP_SIZE 3
708
709
#define OCF_READ_DEFAULT_LINK_POLICY 0x000E
710
711
#define OCF_WRITE_DEFAULT_LINK_POLICY 0x000F
712
713
#define OCF_FLOW_SPECIFICATION 0x0010
714
715
#define OCF_SNIFF_SUBRATING 0x0011
716
typedef struct {
717
uint16_t handle;
718
uint16_t max_latency;
719
uint16_t min_remote_timeout;
720
uint16_t min_local_timeout;
721
} __attribute__ ((packed)) sniff_subrating_cp;
722
#define SNIFF_SUBRATING_CP_SIZE 8
723
724
/* Host Controller and Baseband */
725
#define OGF_HOST_CTL 0x03
726
727
#define OCF_SET_EVENT_MASK 0x0001
728
typedef struct {
729
uint8_t mask[8];
730
} __attribute__ ((packed)) set_event_mask_cp;
731
#define SET_EVENT_MASK_CP_SIZE 8
732
733
#define OCF_RESET 0x0003
734
735
#define OCF_SET_EVENT_FLT 0x0005
736
typedef struct {
737
uint8_t flt_type;
738
uint8_t cond_type;
739
uint8_t condition[0];
740
} __attribute__ ((packed)) set_event_flt_cp;
741
#define SET_EVENT_FLT_CP_SIZE 2
742
743
/* Filter types */
744
#define FLT_CLEAR_ALL 0x00
745
#define FLT_INQ_RESULT 0x01
746
#define FLT_CONN_SETUP 0x02
747
/* INQ_RESULT Condition types */
748
#define INQ_RESULT_RETURN_ALL 0x00
749
#define INQ_RESULT_RETURN_CLASS 0x01
750
#define INQ_RESULT_RETURN_BDADDR 0x02
751
/* CONN_SETUP Condition types */
752
#define CONN_SETUP_ALLOW_ALL 0x00
753
#define CONN_SETUP_ALLOW_CLASS 0x01
754
#define CONN_SETUP_ALLOW_BDADDR 0x02
755
/* CONN_SETUP Conditions */
756
#define CONN_SETUP_AUTO_OFF 0x01
757
#define CONN_SETUP_AUTO_ON 0x02
758
759
#define OCF_FLUSH 0x0008
760
761
#define OCF_READ_PIN_TYPE 0x0009
762
typedef struct {
763
uint8_t status;
764
uint8_t pin_type;
765
} __attribute__ ((packed)) read_pin_type_rp;
766
#define READ_PIN_TYPE_RP_SIZE 2
767
768
#define OCF_WRITE_PIN_TYPE 0x000A
769
typedef struct {
770
uint8_t pin_type;
771
} __attribute__ ((packed)) write_pin_type_cp;
772
#define WRITE_PIN_TYPE_CP_SIZE 1
773
774
#define OCF_CREATE_NEW_UNIT_KEY 0x000B
775
776
#define OCF_READ_STORED_LINK_KEY 0x000D
777
typedef struct {
778
bdaddr_t bdaddr;
779
uint8_t read_all;
780
} __attribute__ ((packed)) read_stored_link_key_cp;
781
#define READ_STORED_LINK_KEY_CP_SIZE 7
782
typedef struct {
783
uint8_t status;
784
uint16_t max_keys;
785
uint16_t num_keys;
786
} __attribute__ ((packed)) read_stored_link_key_rp;
787
#define READ_STORED_LINK_KEY_RP_SIZE 5
788
789
#define OCF_WRITE_STORED_LINK_KEY 0x0011
790
typedef struct {
791
uint8_t num_keys;
792
/* variable length part */
793
} __attribute__ ((packed)) write_stored_link_key_cp;
794
#define WRITE_STORED_LINK_KEY_CP_SIZE 1
795
typedef struct {
796
uint8_t status;
797
uint8_t num_keys;
798
} __attribute__ ((packed)) write_stored_link_key_rp;
799
#define READ_WRITE_LINK_KEY_RP_SIZE 2
800
801
#define OCF_DELETE_STORED_LINK_KEY 0x0012
802
typedef struct {
803
bdaddr_t bdaddr;
804
uint8_t delete_all;
805
} __attribute__ ((packed)) delete_stored_link_key_cp;
806
#define DELETE_STORED_LINK_KEY_CP_SIZE 7
807
typedef struct {
808
uint8_t status;
809
uint16_t num_keys;
810
} __attribute__ ((packed)) delete_stored_link_key_rp;
811
#define DELETE_STORED_LINK_KEY_RP_SIZE 3
812
813
#define HCI_MAX_NAME_LENGTH 248
814
815
#define OCF_CHANGE_LOCAL_NAME 0x0013
816
typedef struct {
817
uint8_t name[HCI_MAX_NAME_LENGTH];
818
} __attribute__ ((packed)) change_local_name_cp;
819
#define CHANGE_LOCAL_NAME_CP_SIZE 248
820
821
#define OCF_READ_LOCAL_NAME 0x0014
822
typedef struct {
823
uint8_t status;
824
uint8_t name[HCI_MAX_NAME_LENGTH];
825
} __attribute__ ((packed)) read_local_name_rp;
826
#define READ_LOCAL_NAME_RP_SIZE 249
827
828
#define OCF_READ_CONN_ACCEPT_TIMEOUT 0x0015
829
typedef struct {
830
uint8_t status;
831
uint16_t timeout;
832
} __attribute__ ((packed)) read_conn_accept_timeout_rp;
833
#define READ_CONN_ACCEPT_TIMEOUT_RP_SIZE 3
834
835
#define OCF_WRITE_CONN_ACCEPT_TIMEOUT 0x0016
836
typedef struct {
837
uint16_t timeout;
838
} __attribute__ ((packed)) write_conn_accept_timeout_cp;
839
#define WRITE_CONN_ACCEPT_TIMEOUT_CP_SIZE 2
840
841
#define OCF_READ_PAGE_TIMEOUT 0x0017
842
typedef struct {
843
uint8_t status;
844
uint16_t timeout;
845
} __attribute__ ((packed)) read_page_timeout_rp;
846
#define READ_PAGE_TIMEOUT_RP_SIZE 3
847
848
#define OCF_WRITE_PAGE_TIMEOUT 0x0018
849
typedef struct {
850
uint16_t timeout;
851
} __attribute__ ((packed)) write_page_timeout_cp;
852
#define WRITE_PAGE_TIMEOUT_CP_SIZE 2
853
854
#define OCF_READ_SCAN_ENABLE 0x0019
855
typedef struct {
856
uint8_t status;
857
uint8_t enable;
858
} __attribute__ ((packed)) read_scan_enable_rp;
859
#define READ_SCAN_ENABLE_RP_SIZE 2
860
861
#define OCF_WRITE_SCAN_ENABLE 0x001A
862
#define SCAN_DISABLED 0x00
863
#define SCAN_INQUIRY 0x01
864
#define SCAN_PAGE 0x02
865
866
#define OCF_READ_PAGE_ACTIVITY 0x001B
867
typedef struct {
868
uint8_t status;
869
uint16_t interval;
870
uint16_t window;
871
} __attribute__ ((packed)) read_page_activity_rp;
872
#define READ_PAGE_ACTIVITY_RP_SIZE 5
873
874
#define OCF_WRITE_PAGE_ACTIVITY 0x001C
875
typedef struct {
876
uint16_t interval;
877
uint16_t window;
878
} __attribute__ ((packed)) write_page_activity_cp;
879
#define WRITE_PAGE_ACTIVITY_CP_SIZE 4
880
881
#define OCF_READ_INQ_ACTIVITY 0x001D
882
typedef struct {
883
uint8_t status;
884
uint16_t interval;
885
uint16_t window;
886
} __attribute__ ((packed)) read_inq_activity_rp;
887
#define READ_INQ_ACTIVITY_RP_SIZE 5
888
889
#define OCF_WRITE_INQ_ACTIVITY 0x001E
890
typedef struct {
891
uint16_t interval;
892
uint16_t window;
893
} __attribute__ ((packed)) write_inq_activity_cp;
894
#define WRITE_INQ_ACTIVITY_CP_SIZE 4
895
896
#define OCF_READ_AUTH_ENABLE 0x001F
897
898
#define OCF_WRITE_AUTH_ENABLE 0x0020
899
#define AUTH_DISABLED 0x00
900
#define AUTH_ENABLED 0x01
901
902
#define OCF_READ_ENCRYPT_MODE 0x0021
903
904
#define OCF_WRITE_ENCRYPT_MODE 0x0022
905
#define ENCRYPT_DISABLED 0x00
906
#define ENCRYPT_P2P 0x01
907
#define ENCRYPT_BOTH 0x02
908
909
#define OCF_READ_CLASS_OF_DEV 0x0023
910
typedef struct {
911
uint8_t status;
912
uint8_t dev_class[3];
913
} __attribute__ ((packed)) read_class_of_dev_rp;
914
#define READ_CLASS_OF_DEV_RP_SIZE 4
915
916
#define OCF_WRITE_CLASS_OF_DEV 0x0024
917
typedef struct {
918
uint8_t dev_class[3];
919
} __attribute__ ((packed)) write_class_of_dev_cp;
920
#define WRITE_CLASS_OF_DEV_CP_SIZE 3
921
922
#define OCF_READ_VOICE_SETTING 0x0025
923
typedef struct {
924
uint8_t status;
925
uint16_t voice_setting;
926
} __attribute__ ((packed)) read_voice_setting_rp;
927
#define READ_VOICE_SETTING_RP_SIZE 3
928
929
#define OCF_WRITE_VOICE_SETTING 0x0026
930
typedef struct {
931
uint16_t voice_setting;
932
} __attribute__ ((packed)) write_voice_setting_cp;
933
#define WRITE_VOICE_SETTING_CP_SIZE 2
934
935
#define OCF_READ_AUTOMATIC_FLUSH_TIMEOUT 0x0027
936
937
#define OCF_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0028
938
939
#define OCF_READ_NUM_BROADCAST_RETRANS 0x0029
940
941
#define OCF_WRITE_NUM_BROADCAST_RETRANS 0x002A
942
943
#define OCF_READ_HOLD_MODE_ACTIVITY 0x002B
944
945
#define OCF_WRITE_HOLD_MODE_ACTIVITY 0x002C
946
947
#define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D
948
typedef struct {
949
uint16_t handle;
950
uint8_t type;
951
} __attribute__ ((packed)) read_transmit_power_level_cp;
952
#define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3
953
typedef struct {
954
uint8_t status;
955
uint16_t handle;
956
int8_t level;
957
} __attribute__ ((packed)) read_transmit_power_level_rp;
958
#define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4
959
960
#define OCF_READ_SYNC_FLOW_ENABLE 0x002E
961
962
#define OCF_WRITE_SYNC_FLOW_ENABLE 0x002F
963
964
#define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031
965
966
#define OCF_HOST_BUFFER_SIZE 0x0033
967
typedef struct {
968
uint16_t acl_mtu;
969
uint8_t sco_mtu;
970
uint16_t acl_max_pkt;
971
uint16_t sco_max_pkt;
972
} __attribute__ ((packed)) host_buffer_size_cp;
973
#define HOST_BUFFER_SIZE_CP_SIZE 7
974
975
#define OCF_HOST_NUM_COMP_PKTS 0x0035
976
typedef struct {
977
uint8_t num_hndl;
978
/* variable length part */
979
} __attribute__ ((packed)) host_num_comp_pkts_cp;
980
#define HOST_NUM_COMP_PKTS_CP_SIZE 1
981
982
#define OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
983
typedef struct {
984
uint8_t status;
985
uint16_t handle;
986
uint16_t timeout;
987
} __attribute__ ((packed)) read_link_supervision_timeout_rp;
988
#define READ_LINK_SUPERVISION_TIMEOUT_RP_SIZE 5
989
990
#define OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
991
typedef struct {
992
uint16_t handle;
993
uint16_t timeout;
994
} __attribute__ ((packed)) write_link_supervision_timeout_cp;
995
#define WRITE_LINK_SUPERVISION_TIMEOUT_CP_SIZE 4
996
typedef struct {
997
uint8_t status;
998
uint16_t handle;
999
} __attribute__ ((packed)) write_link_supervision_timeout_rp;
1000
#define WRITE_LINK_SUPERVISION_TIMEOUT_RP_SIZE 3
1001
1002
#define OCF_READ_NUM_SUPPORTED_IAC 0x0038
1003
1004
#define MAX_IAC_LAP 0x40
1005
#define OCF_READ_CURRENT_IAC_LAP 0x0039
1006
typedef struct {
1007
uint8_t status;
1008
uint8_t num_current_iac;
1009
uint8_t lap[MAX_IAC_LAP][3];
1010
} __attribute__ ((packed)) read_current_iac_lap_rp;
1011
#define READ_CURRENT_IAC_LAP_RP_SIZE 2+3*MAX_IAC_LAP
1012
1013
#define OCF_WRITE_CURRENT_IAC_LAP 0x003A
1014
typedef struct {
1015
uint8_t num_current_iac;
1016
uint8_t lap[MAX_IAC_LAP][3];
1017
} __attribute__ ((packed)) write_current_iac_lap_cp;
1018
#define WRITE_CURRENT_IAC_LAP_CP_SIZE 1+3*MAX_IAC_LAP
1019
1020
#define OCF_READ_PAGE_SCAN_PERIOD_MODE 0x003B
1021
1022
#define OCF_WRITE_PAGE_SCAN_PERIOD_MODE 0x003C
1023
1024
#define OCF_READ_PAGE_SCAN_MODE 0x003D
1025
1026
#define OCF_WRITE_PAGE_SCAN_MODE 0x003E
1027
1028
#define OCF_SET_AFH_CLASSIFICATION 0x003F
1029
typedef struct {
1030
uint8_t map[10];
1031
} __attribute__ ((packed)) set_afh_classification_cp;
1032
#define SET_AFH_CLASSIFICATION_CP_SIZE 10
1033
typedef struct {
1034
uint8_t status;
1035
} __attribute__ ((packed)) set_afh_classification_rp;
1036
#define SET_AFH_CLASSIFICATION_RP_SIZE 1
1037
1038
#define OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1039
typedef struct {
1040
uint8_t status;
1041
uint8_t type;
1042
} __attribute__ ((packed)) read_inquiry_scan_type_rp;
1043
#define READ_INQUIRY_SCAN_TYPE_RP_SIZE 2
1044
1045
#define OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1046
typedef struct {
1047
uint8_t type;
1048
} __attribute__ ((packed)) write_inquiry_scan_type_cp;
1049
#define WRITE_INQUIRY_SCAN_TYPE_CP_SIZE 1
1050
typedef struct {
1051
uint8_t status;
1052
} __attribute__ ((packed)) write_inquiry_scan_type_rp;
1053
#define WRITE_INQUIRY_SCAN_TYPE_RP_SIZE 1
1054
1055
#define OCF_READ_INQUIRY_MODE 0x0044
1056
typedef struct {
1057
uint8_t status;
1058
uint8_t mode;
1059
} __attribute__ ((packed)) read_inquiry_mode_rp;
1060
#define READ_INQUIRY_MODE_RP_SIZE 2
1061
1062
#define OCF_WRITE_INQUIRY_MODE 0x0045
1063
typedef struct {
1064
uint8_t mode;
1065
} __attribute__ ((packed)) write_inquiry_mode_cp;
1066
#define WRITE_INQUIRY_MODE_CP_SIZE 1
1067
typedef struct {
1068
uint8_t status;
1069
} __attribute__ ((packed)) write_inquiry_mode_rp;
1070
#define WRITE_INQUIRY_MODE_RP_SIZE 1
1071
1072
#define OCF_READ_PAGE_SCAN_TYPE 0x0046
1073
1074
#define OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1075
#define PAGE_SCAN_TYPE_STANDARD 0x00
1076
#define PAGE_SCAN_TYPE_INTERLACED 0x01
1077
1078
#define OCF_READ_AFH_MODE 0x0048
1079
typedef struct {
1080
uint8_t status;
1081
uint8_t mode;
1082
} __attribute__ ((packed)) read_afh_mode_rp;
1083
#define READ_AFH_MODE_RP_SIZE 2
1084
1085
#define OCF_WRITE_AFH_MODE 0x0049
1086
typedef struct {
1087
uint8_t mode;
1088
} __attribute__ ((packed)) write_afh_mode_cp;
1089
#define WRITE_AFH_MODE_CP_SIZE 1
1090
typedef struct {
1091
uint8_t status;
1092
} __attribute__ ((packed)) write_afh_mode_rp;
1093
#define WRITE_AFH_MODE_RP_SIZE 1
1094
1095
#define HCI_MAX_EIR_LENGTH 240
1096
1097
#define OCF_READ_EXT_INQUIRY_RESPONSE 0x0051
1098
typedef struct {
1099
uint8_t status;
1100
uint8_t fec;
1101
uint8_t data[HCI_MAX_EIR_LENGTH];
1102
} __attribute__ ((packed)) read_ext_inquiry_response_rp;
1103
#define READ_EXT_INQUIRY_RESPONSE_RP_SIZE 242
1104
1105
#define OCF_WRITE_EXT_INQUIRY_RESPONSE 0x0052
1106
typedef struct {
1107
uint8_t fec;
1108
uint8_t data[HCI_MAX_EIR_LENGTH];
1109
} __attribute__ ((packed)) write_ext_inquiry_response_cp;
1110
#define WRITE_EXT_INQUIRY_RESPONSE_CP_SIZE 241
1111
typedef struct {
1112
uint8_t status;
1113
} __attribute__ ((packed)) write_ext_inquiry_response_rp;
1114
#define WRITE_EXT_INQUIRY_RESPONSE_RP_SIZE 1
1115
1116
#define OCF_REFRESH_ENCRYPTION_KEY 0x0053
1117
typedef struct {
1118
uint16_t handle;
1119
} __attribute__ ((packed)) refresh_encryption_key_cp;
1120
#define REFRESH_ENCRYPTION_KEY_CP_SIZE 2
1121
typedef struct {
1122
uint8_t status;
1123
} __attribute__ ((packed)) refresh_encryption_key_rp;
1124
#define REFRESH_ENCRYPTION_KEY_RP_SIZE 1
1125
1126
#define OCF_READ_SIMPLE_PAIRING_MODE 0x0055
1127
typedef struct {
1128
uint8_t status;
1129
uint8_t mode;
1130
} __attribute__ ((packed)) read_simple_pairing_mode_rp;
1131
#define READ_SIMPLE_PAIRING_MODE_RP_SIZE 2
1132
1133
#define OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056
1134
typedef struct {
1135
uint8_t mode;
1136
} __attribute__ ((packed)) write_simple_pairing_mode_cp;
1137
#define WRITE_SIMPLE_PAIRING_MODE_CP_SIZE 1
1138
typedef struct {
1139
uint8_t status;
1140
} __attribute__ ((packed)) write_simple_pairing_mode_rp;
1141
#define WRITE_SIMPLE_PAIRING_MODE_RP_SIZE 1
1142
1143
#define OCF_READ_LOCAL_OOB_DATA 0x0057
1144
typedef struct {
1145
uint8_t status;
1146
uint8_t hash[16];
1147
uint8_t randomizer[16];
1148
} __attribute__ ((packed)) read_local_oob_data_rp;
1149
#define READ_LOCAL_OOB_DATA_RP_SIZE 33
1150
1151
#define OCF_READ_INQ_RESPONSE_TX_POWER_LEVEL 0x0058
1152
typedef struct {
1153
uint8_t status;
1154
int8_t level;
1155
} __attribute__ ((packed)) read_inq_response_tx_power_level_rp;
1156
#define READ_INQ_RESPONSE_TX_POWER_LEVEL_RP_SIZE 2
1157
1158
#define OCF_READ_INQUIRY_TRANSMIT_POWER_LEVEL 0x0058
1159
typedef struct {
1160
uint8_t status;
1161
int8_t level;
1162
} __attribute__ ((packed)) read_inquiry_transmit_power_level_rp;
1163
#define READ_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 2
1164
1165
#define OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL 0x0059
1166
typedef struct {
1167
int8_t level;
1168
} __attribute__ ((packed)) write_inquiry_transmit_power_level_cp;
1169
#define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_CP_SIZE 1
1170
typedef struct {
1171
uint8_t status;
1172
} __attribute__ ((packed)) write_inquiry_transmit_power_level_rp;
1173
#define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 1
1174
1175
#define OCF_READ_DEFAULT_ERROR_DATA_REPORTING 0x005A
1176
typedef struct {
1177
uint8_t status;
1178
uint8_t reporting;
1179
} __attribute__ ((packed)) read_default_error_data_reporting_rp;
1180
#define READ_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 2
1181
1182
#define OCF_WRITE_DEFAULT_ERROR_DATA_REPORTING 0x005B
1183
typedef struct {
1184
uint8_t reporting;
1185
} __attribute__ ((packed)) write_default_error_data_reporting_cp;
1186
#define WRITE_DEFAULT_ERROR_DATA_REPORTING_CP_SIZE 1
1187
typedef struct {
1188
uint8_t status;
1189
} __attribute__ ((packed)) write_default_error_data_reporting_rp;
1190
#define WRITE_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 1
1191
1192
#define OCF_ENHANCED_FLUSH 0x005F
1193
typedef struct {
1194
uint16_t handle;
1195
uint8_t type;
1196
} __attribute__ ((packed)) enhanced_flush_cp;
1197
#define ENHANCED_FLUSH_CP_SIZE 3
1198
1199
#define OCF_SEND_KEYPRESS_NOTIFY 0x0060
1200
typedef struct {
1201
bdaddr_t bdaddr;
1202
uint8_t type;
1203
} __attribute__ ((packed)) send_keypress_notify_cp;
1204
#define SEND_KEYPRESS_NOTIFY_CP_SIZE 7
1205
typedef struct {
1206
uint8_t status;
1207
} __attribute__ ((packed)) send_keypress_notify_rp;
1208
#define SEND_KEYPRESS_NOTIFY_RP_SIZE 1
1209
1210
#define OCF_READ_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0061
1211
typedef struct {
1212
uint8_t status;
1213
uint16_t timeout;
1214
} __attribute__ ((packed)) read_log_link_accept_timeout_rp;
1215
#define READ_LOGICAL_LINK_ACCEPT_TIMEOUT_RP_SIZE 3
1216
1217
#define OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0062
1218
typedef struct {
1219
uint16_t timeout;
1220
} __attribute__ ((packed)) write_log_link_accept_timeout_cp;
1221
#define WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CP_SIZE 2
1222
1223
#define OCF_SET_EVENT_MASK_PAGE_2 0x0063
1224
1225
#define OCF_READ_LOCATION_DATA 0x0064
1226
1227
#define OCF_WRITE_LOCATION_DATA 0x0065
1228
1229
#define OCF_READ_FLOW_CONTROL_MODE 0x0066
1230
1231
#define OCF_WRITE_FLOW_CONTROL_MODE 0x0067
1232
1233
#define OCF_READ_ENHANCED_TRANSMIT_POWER_LEVEL 0x0068
1234
typedef struct {
1235
uint8_t status;
1236
uint16_t handle;
1237
int8_t level_gfsk;
1238
int8_t level_dqpsk;
1239
int8_t level_8dpsk;
1240
} __attribute__ ((packed)) read_enhanced_transmit_power_level_rp;
1241
#define READ_ENHANCED_TRANSMIT_POWER_LEVEL_RP_SIZE 6
1242
1243
#define OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT 0x0069
1244
typedef struct {
1245
uint8_t status;
1246
uint32_t timeout;
1247
} __attribute__ ((packed)) read_best_effort_flush_timeout_rp;
1248
#define READ_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 5
1249
1250
#define OCF_WRITE_BEST_EFFORT_FLUSH_TIMEOUT 0x006A
1251
typedef struct {
1252
uint16_t handle;
1253
uint32_t timeout;
1254
} __attribute__ ((packed)) write_best_effort_flush_timeout_cp;
1255
#define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CP_SIZE 6
1256
typedef struct {
1257
uint8_t status;
1258
} __attribute__ ((packed)) write_best_effort_flush_timeout_rp;
1259
#define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 1
1260
1261
#define OCF_READ_LE_HOST_SUPPORTED 0x006C
1262
typedef struct {
1263
uint8_t status;
1264
uint8_t le;
1265
uint8_t simul;
1266
} __attribute__ ((packed)) read_le_host_supported_rp;
1267
#define READ_LE_HOST_SUPPORTED_RP_SIZE 3
1268
1269
#define OCF_WRITE_LE_HOST_SUPPORTED 0x006D
1270
typedef struct {
1271
uint8_t le;
1272
uint8_t simul;
1273
} __attribute__ ((packed)) write_le_host_supported_cp;
1274
#define WRITE_LE_HOST_SUPPORTED_CP_SIZE 2
1275
1276
/* Informational Parameters */
1277
#define OGF_INFO_PARAM 0x04
1278
1279
#define OCF_READ_LOCAL_VERSION 0x0001
1280
typedef struct {
1281
uint8_t status;
1282
uint8_t hci_ver;
1283
uint16_t hci_rev;
1284
uint8_t lmp_ver;
1285
uint16_t manufacturer;
1286
uint16_t lmp_subver;
1287
} __attribute__ ((packed)) read_local_version_rp;
1288
#define READ_LOCAL_VERSION_RP_SIZE 9
1289
1290
#define OCF_READ_LOCAL_COMMANDS 0x0002
1291
typedef struct {
1292
uint8_t status;
1293
uint8_t commands[64];
1294
} __attribute__ ((packed)) read_local_commands_rp;
1295
#define READ_LOCAL_COMMANDS_RP_SIZE 65
1296
1297
#define OCF_READ_LOCAL_FEATURES 0x0003
1298
typedef struct {
1299
uint8_t status;
1300
uint8_t features[8];
1301
} __attribute__ ((packed)) read_local_features_rp;
1302
#define READ_LOCAL_FEATURES_RP_SIZE 9
1303
1304
#define OCF_READ_LOCAL_EXT_FEATURES 0x0004
1305
typedef struct {
1306
uint8_t page_num;
1307
} __attribute__ ((packed)) read_local_ext_features_cp;
1308
#define READ_LOCAL_EXT_FEATURES_CP_SIZE 1
1309
typedef struct {
1310
uint8_t status;
1311
uint8_t page_num;
1312
uint8_t max_page_num;
1313
uint8_t features[8];
1314
} __attribute__ ((packed)) read_local_ext_features_rp;
1315
#define READ_LOCAL_EXT_FEATURES_RP_SIZE 11
1316
1317
#define OCF_READ_BUFFER_SIZE 0x0005
1318
typedef struct {
1319
uint8_t status;
1320
uint16_t acl_mtu;
1321
uint8_t sco_mtu;
1322
uint16_t acl_max_pkt;
1323
uint16_t sco_max_pkt;
1324
} __attribute__ ((packed)) read_buffer_size_rp;
1325
#define READ_BUFFER_SIZE_RP_SIZE 8
1326
1327
#define OCF_READ_COUNTRY_CODE 0x0007
1328
1329
#define OCF_READ_BD_ADDR 0x0009
1330
typedef struct {
1331
uint8_t status;
1332
bdaddr_t bdaddr;
1333
} __attribute__ ((packed)) read_bd_addr_rp;
1334
#define READ_BD_ADDR_RP_SIZE 7
1335
1336
#define OCF_READ_DATA_BLOCK_SIZE 0x000A
1337
typedef struct {
1338
uint8_t status;
1339
uint16_t max_acl_len;
1340
uint16_t data_block_len;
1341
uint16_t num_blocks;
1342
} __attribute__ ((packed)) read_data_block_size_rp;
1343
1344
/* Status params */
1345
#define OGF_STATUS_PARAM 0x05
1346
1347
#define OCF_READ_FAILED_CONTACT_COUNTER 0x0001
1348
typedef struct {
1349
uint8_t status;
1350
uint16_t handle;
1351
uint8_t counter;
1352
} __attribute__ ((packed)) read_failed_contact_counter_rp;
1353
#define READ_FAILED_CONTACT_COUNTER_RP_SIZE 4
1354
1355
#define OCF_RESET_FAILED_CONTACT_COUNTER 0x0002
1356
typedef struct {
1357
uint8_t status;
1358
uint16_t handle;
1359
} __attribute__ ((packed)) reset_failed_contact_counter_rp;
1360
#define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 3
1361
1362
#define OCF_READ_LINK_QUALITY 0x0003
1363
typedef struct {
1364
uint8_t status;
1365
uint16_t handle;
1366
uint8_t link_quality;
1367
} __attribute__ ((packed)) read_link_quality_rp;
1368
#define READ_LINK_QUALITY_RP_SIZE 4
1369
1370
#define OCF_READ_RSSI 0x0005
1371
typedef struct {
1372
uint8_t status;
1373
uint16_t handle;
1374
int8_t rssi;
1375
} __attribute__ ((packed)) read_rssi_rp;
1376
#define READ_RSSI_RP_SIZE 4
1377
1378
#define OCF_READ_AFH_MAP 0x0006
1379
typedef struct {
1380
uint8_t status;
1381
uint16_t handle;
1382
uint8_t mode;
1383
uint8_t map[10];
1384
} __attribute__ ((packed)) read_afh_map_rp;
1385
#define READ_AFH_MAP_RP_SIZE 14
1386
1387
#define OCF_READ_CLOCK 0x0007
1388
typedef struct {
1389
uint16_t handle;
1390
uint8_t which_clock;
1391
} __attribute__ ((packed)) read_clock_cp;
1392
#define READ_CLOCK_CP_SIZE 3
1393
typedef struct {
1394
uint8_t status;
1395
uint16_t handle;
1396
uint32_t clock;
1397
uint16_t accuracy;
1398
} __attribute__ ((packed)) read_clock_rp;
1399
#define READ_CLOCK_RP_SIZE 9
1400
1401
#define OCF_READ_LOCAL_AMP_INFO 0x0009
1402
typedef struct {
1403
uint8_t status;
1404
uint8_t amp_status;
1405
uint32_t total_bandwidth;
1406
uint32_t max_guaranteed_bandwidth;
1407
uint32_t min_latency;
1408
uint32_t max_pdu_size;
1409
uint8_t controller_type;
1410
uint16_t pal_caps;
1411
uint16_t max_amp_assoc_length;
1412
uint32_t max_flush_timeout;
1413
uint32_t best_effort_flush_timeout;
1414
} __attribute__ ((packed)) read_local_amp_info_rp;
1415
#define READ_LOCAL_AMP_INFO_RP_SIZE 31
1416
1417
#define OCF_READ_LOCAL_AMP_ASSOC 0x000A
1418
typedef struct {
1419
uint8_t handle;
1420
uint16_t length_so_far;
1421
uint16_t assoc_length;
1422
} __attribute__ ((packed)) read_local_amp_assoc_cp;
1423
#define READ_LOCAL_AMP_ASSOC_CP_SIZE 5
1424
typedef struct {
1425
uint8_t status;
1426
uint8_t handle;
1427
uint16_t length;
1428
uint8_t fragment[HCI_MAX_NAME_LENGTH];
1429
} __attribute__ ((packed)) read_local_amp_assoc_rp;
1430
#define READ_LOCAL_AMP_ASSOC_RP_SIZE 252
1431
1432
#define OCF_WRITE_REMOTE_AMP_ASSOC 0x000B
1433
typedef struct {
1434
uint8_t handle;
1435
uint16_t length_so_far;
1436
uint16_t remaining_length;
1437
uint8_t fragment[HCI_MAX_NAME_LENGTH];
1438
} __attribute__ ((packed)) write_remote_amp_assoc_cp;
1439
#define WRITE_REMOTE_AMP_ASSOC_CP_SIZE 253
1440
typedef struct {
1441
uint8_t status;
1442
uint8_t handle;
1443
} __attribute__ ((packed)) write_remote_amp_assoc_rp;
1444
#define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2
1445
1446
/* Testing commands */
1447
#define OGF_TESTING_CMD 0x3e
1448
1449
#define OCF_READ_LOOPBACK_MODE 0x0001
1450
1451
#define OCF_WRITE_LOOPBACK_MODE 0x0002
1452
1453
#define OCF_ENABLE_DEVICE_UNDER_TEST_MODE 0x0003
1454
1455
#define OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004
1456
typedef struct {
1457
uint8_t mode;
1458
} __attribute__ ((packed)) write_simple_pairing_debug_mode_cp;
1459
#define WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE 1
1460
typedef struct {
1461
uint8_t status;
1462
} __attribute__ ((packed)) write_simple_pairing_debug_mode_rp;
1463
#define WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE 1
1464
1465
/* LE commands */
1466
#define OGF_LE_CTL 0x08
1467
1468
#define OCF_LE_SET_EVENT_MASK 0x0001
1469
typedef struct {
1470
uint8_t mask[8];
1471
} __attribute__ ((packed)) le_set_event_mask_cp;
1472
#define LE_SET_EVENT_MASK_CP_SIZE 8
1473
1474
#define OCF_LE_READ_BUFFER_SIZE 0x0002
1475
typedef struct {
1476
uint8_t status;
1477
uint16_t pkt_len;
1478
uint8_t max_pkt;
1479
} __attribute__ ((packed)) le_read_buffer_size_rp;
1480
#define LE_READ_BUFFER_SIZE_RP_SIZE 4
1481
1482
#define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003
1483
typedef struct {
1484
uint8_t status;
1485
uint8_t features[8];
1486
} __attribute__ ((packed)) le_read_local_supported_features_rp;
1487
#define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9
1488
1489
#define OCF_LE_SET_RANDOM_ADDRESS 0x0005
1490
typedef struct {
1491
bdaddr_t bdaddr;
1492
} __attribute__ ((packed)) le_set_random_address_cp;
1493
#define LE_SET_RANDOM_ADDRESS_CP_SIZE 6
1494
1495
#define OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006
1496
typedef struct {
1497
uint16_t min_interval;
1498
uint16_t max_interval;
1499
uint8_t advtype;
1500
uint8_t own_bdaddr_type;
1501
uint8_t direct_bdaddr_type;
1502
bdaddr_t direct_bdaddr;
1503
uint8_t chan_map;
1504
uint8_t filter;
1505
} __attribute__ ((packed)) le_set_advertising_parameters_cp;
1506
#define LE_SET_ADVERTISING_PARAMETERS_CP_SIZE 15
1507
1508
#define OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007
1509
typedef struct {
1510
uint8_t status;
1511
int8_t level;
1512
} __attribute__ ((packed)) le_read_advertising_channel_tx_power_rp;
1513
#define LE_READ_ADVERTISING_CHANNEL_TX_POWER_RP_SIZE 2
1514
1515
#define OCF_LE_SET_ADVERTISING_DATA 0x0008
1516
typedef struct {
1517
uint8_t length;
1518
uint8_t data[31];
1519
} __attribute__ ((packed)) le_set_advertising_data_cp;
1520
#define LE_SET_ADVERTISING_DATA_CP_SIZE 32
1521
1522
#define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009
1523
typedef struct {
1524
uint8_t length;
1525
uint8_t data[31];
1526
} __attribute__ ((packed)) le_set_scan_response_data_cp;
1527
#define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32
1528
1529
#define OCF_LE_SET_ADVERTISE_ENABLE 0x000A
1530
typedef struct {
1531
uint8_t enable;
1532
} __attribute__ ((packed)) le_set_advertise_enable_cp;
1533
#define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1
1534
1535
#define OCF_LE_SET_SCAN_PARAMETERS 0x000B
1536
typedef struct {
1537
uint8_t type;
1538
uint16_t interval;
1539
uint16_t window;
1540
uint8_t own_bdaddr_type;
1541
uint8_t filter;
1542
} __attribute__ ((packed)) le_set_scan_parameters_cp;
1543
#define LE_SET_SCAN_PARAMETERS_CP_SIZE 7
1544
1545
#define OCF_LE_SET_SCAN_ENABLE 0x000C
1546
typedef struct {
1547
uint8_t enable;
1548
uint8_t filter_dup;
1549
} __attribute__ ((packed)) le_set_scan_enable_cp;
1550
#define LE_SET_SCAN_ENABLE_CP_SIZE 2
1551
1552
#define OCF_LE_CREATE_CONN 0x000D
1553
typedef struct {
1554
uint16_t interval;
1555
uint16_t window;
1556
uint8_t initiator_filter;
1557
uint8_t peer_bdaddr_type;
1558
bdaddr_t peer_bdaddr;
1559
uint8_t own_bdaddr_type;
1560
uint16_t min_interval;
1561
uint16_t max_interval;
1562
uint16_t latency;
1563
uint16_t supervision_timeout;
1564
uint16_t min_ce_length;
1565
uint16_t max_ce_length;
1566
} __attribute__ ((packed)) le_create_connection_cp;
1567
#define LE_CREATE_CONN_CP_SIZE 25
1568
1569
#define OCF_LE_CREATE_CONN_CANCEL 0x000E
1570
1571
#define OCF_LE_READ_WHITE_LIST_SIZE 0x000F
1572
typedef struct {
1573
uint8_t status;
1574
uint8_t size;
1575
} __attribute__ ((packed)) le_read_white_list_size_rp;
1576
#define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2
1577
1578
#define OCF_LE_CLEAR_WHITE_LIST 0x0010
1579
1580
#define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
1581
typedef struct {
1582
uint8_t bdaddr_type;
1583
bdaddr_t bdaddr;
1584
} __attribute__ ((packed)) le_add_device_to_white_list_cp;
1585
#define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7
1586
1587
#define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012
1588
typedef struct {
1589
uint8_t bdaddr_type;
1590
bdaddr_t bdaddr;
1591
} __attribute__ ((packed)) le_remove_device_from_white_list_cp;
1592
#define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7
1593
1594
#define OCF_LE_CONN_UPDATE 0x0013
1595
typedef struct {
1596
uint16_t handle;
1597
uint16_t min_interval;
1598
uint16_t max_interval;
1599
uint16_t latency;
1600
uint16_t supervision_timeout;
1601
uint16_t min_ce_length;
1602
uint16_t max_ce_length;
1603
} __attribute__ ((packed)) le_connection_update_cp;
1604
#define LE_CONN_UPDATE_CP_SIZE 14
1605
1606
#define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014
1607
typedef struct {
1608
uint8_t map[5];
1609
} __attribute__ ((packed)) le_set_host_channel_classification_cp;
1610
#define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5
1611
1612
#define OCF_LE_READ_CHANNEL_MAP 0x0015
1613
typedef struct {
1614
uint16_t handle;
1615
} __attribute__ ((packed)) le_read_channel_map_cp;
1616
#define LE_READ_CHANNEL_MAP_CP_SIZE 2
1617
typedef struct {
1618
uint8_t status;
1619
uint16_t handle;
1620
uint8_t map[5];
1621
} __attribute__ ((packed)) le_read_channel_map_rp;
1622
#define LE_READ_CHANNEL_MAP_RP_SIZE 8
1623
1624
#define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016
1625
typedef struct {
1626
uint16_t handle;
1627
} __attribute__ ((packed)) le_read_remote_used_features_cp;
1628
#define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2
1629
1630
#define OCF_LE_ENCRYPT 0x0017
1631
typedef struct {
1632
uint8_t key[16];
1633
uint8_t plaintext[16];
1634
} __attribute__ ((packed)) le_encrypt_cp;
1635
#define LE_ENCRYPT_CP_SIZE 32
1636
typedef struct {
1637
uint8_t status;
1638
uint8_t data[16];
1639
} __attribute__ ((packed)) le_encrypt_rp;
1640
#define LE_ENCRYPT_RP_SIZE 17
1641
1642
#define OCF_LE_RAND 0x0018
1643
typedef struct {
1644
uint8_t status;
1645
uint64_t random;
1646
} __attribute__ ((packed)) le_rand_rp;
1647
#define LE_RAND_RP_SIZE 9
1648
1649
#define OCF_LE_START_ENCRYPTION 0x0019
1650
typedef struct {
1651
uint16_t handle;
1652
uint64_t random;
1653
uint16_t diversifier;
1654
uint8_t key[16];
1655
} __attribute__ ((packed)) le_start_encryption_cp;
1656
#define LE_START_ENCRYPTION_CP_SIZE 28
1657
1658
#define OCF_LE_LTK_REPLY 0x001A
1659
typedef struct {
1660
uint16_t handle;
1661
uint8_t key[16];
1662
} __attribute__ ((packed)) le_ltk_reply_cp;
1663
#define LE_LTK_REPLY_CP_SIZE 18
1664
typedef struct {
1665
uint8_t status;
1666
uint16_t handle;
1667
} __attribute__ ((packed)) le_ltk_reply_rp;
1668
#define LE_LTK_REPLY_RP_SIZE 3
1669
1670
#define OCF_LE_LTK_NEG_REPLY 0x001B
1671
typedef struct {
1672
uint16_t handle;
1673
} __attribute__ ((packed)) le_ltk_neg_reply_cp;
1674
#define LE_LTK_NEG_REPLY_CP_SIZE 2
1675
typedef struct {
1676
uint8_t status;
1677
uint16_t handle;
1678
} __attribute__ ((packed)) le_ltk_neg_reply_rp;
1679
#define LE_LTK_NEG_REPLY_RP_SIZE 3
1680
1681
#define OCF_LE_READ_SUPPORTED_STATES 0x001C
1682
typedef struct {
1683
uint8_t status;
1684
uint64_t states;
1685
} __attribute__ ((packed)) le_read_supported_states_rp;
1686
#define LE_READ_SUPPORTED_STATES_RP_SIZE 9
1687
1688
#define OCF_LE_RECEIVER_TEST 0x001D
1689
typedef struct {
1690
uint8_t frequency;
1691
} __attribute__ ((packed)) le_receiver_test_cp;
1692
#define LE_RECEIVER_TEST_CP_SIZE 1
1693
1694
#define OCF_LE_TRANSMITTER_TEST 0x001E
1695
typedef struct {
1696
uint8_t frequency;
1697
uint8_t length;
1698
uint8_t payload;
1699
} __attribute__ ((packed)) le_transmitter_test_cp;
1700
#define LE_TRANSMITTER_TEST_CP_SIZE 3
1701
1702
#define OCF_LE_TEST_END 0x001F
1703
typedef struct {
1704
uint8_t status;
1705
uint16_t num_pkts;
1706
} __attribute__ ((packed)) le_test_end_rp;
1707
#define LE_TEST_END_RP_SIZE 3
1708
1709
/* Vendor specific commands */
1710
#define OGF_VENDOR_CMD 0x3f
1711
1712
/* ---- HCI Events ---- */
1713
1714
#define EVT_INQUIRY_COMPLETE 0x01
1715
1716
#define EVT_INQUIRY_RESULT 0x02
1717
typedef struct {
1718
bdaddr_t bdaddr;
1719
uint8_t pscan_rep_mode;
1720
uint8_t pscan_period_mode;
1721
uint8_t pscan_mode;
1722
uint8_t dev_class[3];
1723
uint16_t clock_offset;
1724
} __attribute__ ((packed)) inquiry_info;
1725
#define INQUIRY_INFO_SIZE 14
1726
1727
#define EVT_CONN_COMPLETE 0x03
1728
typedef struct {
1729
uint8_t status;
1730
uint16_t handle;
1731
bdaddr_t bdaddr;
1732
uint8_t link_type;
1733
uint8_t encr_mode;
1734
} __attribute__ ((packed)) evt_conn_complete;
1735
#define EVT_CONN_COMPLETE_SIZE 11
1736
1737
#define EVT_CONN_REQUEST 0x04
1738
typedef struct {
1739
bdaddr_t bdaddr;
1740
uint8_t dev_class[3];
1741
uint8_t link_type;
1742
} __attribute__ ((packed)) evt_conn_request;
1743
#define EVT_CONN_REQUEST_SIZE 10
1744
1745
#define EVT_DISCONN_COMPLETE 0x05
1746
typedef struct {
1747
uint8_t status;
1748
uint16_t handle;
1749
uint8_t reason;
1750
} __attribute__ ((packed)) evt_disconn_complete;
1751
#define EVT_DISCONN_COMPLETE_SIZE 4
1752
1753
#define EVT_AUTH_COMPLETE 0x06
1754
typedef struct {
1755
uint8_t status;
1756
uint16_t handle;
1757
} __attribute__ ((packed)) evt_auth_complete;
1758
#define EVT_AUTH_COMPLETE_SIZE 3
1759
1760
#define EVT_REMOTE_NAME_REQ_COMPLETE 0x07
1761
typedef struct {
1762
uint8_t status;
1763
bdaddr_t bdaddr;
1764
uint8_t name[HCI_MAX_NAME_LENGTH];
1765
} __attribute__ ((packed)) evt_remote_name_req_complete;
1766
#define EVT_REMOTE_NAME_REQ_COMPLETE_SIZE 255
1767
1768
#define EVT_ENCRYPT_CHANGE 0x08
1769
typedef struct {
1770
uint8_t status;
1771
uint16_t handle;
1772
uint8_t encrypt;
1773
} __attribute__ ((packed)) evt_encrypt_change;
1774
#define EVT_ENCRYPT_CHANGE_SIZE 4
1775
1776
#define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
1777
typedef struct {
1778
uint8_t status;
1779
uint16_t handle;
1780
} __attribute__ ((packed)) evt_change_conn_link_key_complete;
1781
#define EVT_CHANGE_CONN_LINK_KEY_COMPLETE_SIZE 3
1782
1783
#define EVT_MASTER_LINK_KEY_COMPLETE 0x0A
1784
typedef struct {
1785
uint8_t status;
1786
uint16_t handle;
1787
uint8_t key_flag;
1788
} __attribute__ ((packed)) evt_master_link_key_complete;
1789
#define EVT_MASTER_LINK_KEY_COMPLETE_SIZE 4
1790
1791
#define EVT_READ_REMOTE_FEATURES_COMPLETE 0x0B
1792
typedef struct {
1793
uint8_t status;
1794
uint16_t handle;
1795
uint8_t features[8];
1796
} __attribute__ ((packed)) evt_read_remote_features_complete;
1797
#define EVT_READ_REMOTE_FEATURES_COMPLETE_SIZE 11
1798
1799
#define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C
1800
typedef struct {
1801
uint8_t status;
1802
uint16_t handle;
1803
uint8_t lmp_ver;
1804
uint16_t manufacturer;
1805
uint16_t lmp_subver;
1806
} __attribute__ ((packed)) evt_read_remote_version_complete;
1807
#define EVT_READ_REMOTE_VERSION_COMPLETE_SIZE 8
1808
1809
#define EVT_QOS_SETUP_COMPLETE 0x0D
1810
typedef struct {
1811
uint8_t status;
1812
uint16_t handle;
1813
uint8_t flags; /* Reserved */
1814
hci_qos qos;
1815
} __attribute__ ((packed)) evt_qos_setup_complete;
1816
#define EVT_QOS_SETUP_COMPLETE_SIZE (4 + HCI_QOS_CP_SIZE)
1817
1818
#define EVT_CMD_COMPLETE 0x0E
1819
typedef struct {
1820
uint8_t ncmd;
1821
uint16_t opcode;
1822
} __attribute__ ((packed)) evt_cmd_complete;
1823
#define EVT_CMD_COMPLETE_SIZE 3
1824
1825
#define EVT_CMD_STATUS 0x0F
1826
typedef struct {
1827
uint8_t status;
1828
uint8_t ncmd;
1829
uint16_t opcode;
1830
} __attribute__ ((packed)) evt_cmd_status;
1831
#define EVT_CMD_STATUS_SIZE 4
1832
1833
#define EVT_HARDWARE_ERROR 0x10
1834
typedef struct {
1835
uint8_t code;
1836
} __attribute__ ((packed)) evt_hardware_error;
1837
#define EVT_HARDWARE_ERROR_SIZE 1
1838
1839
#define EVT_FLUSH_OCCURRED 0x11
1840
typedef struct {
1841
uint16_t handle;
1842
} __attribute__ ((packed)) evt_flush_occured;
1843
#define EVT_FLUSH_OCCURRED_SIZE 2
1844
1845
#define EVT_ROLE_CHANGE 0x12
1846
typedef struct {
1847
uint8_t status;
1848
bdaddr_t bdaddr;
1849
uint8_t role;
1850
} __attribute__ ((packed)) evt_role_change;
1851
#define EVT_ROLE_CHANGE_SIZE 8
1852
1853
#define EVT_NUM_COMP_PKTS 0x13
1854
typedef struct {
1855
uint8_t num_hndl;
1856
/* variable length part */
1857
} __attribute__ ((packed)) evt_num_comp_pkts;
1858
#define EVT_NUM_COMP_PKTS_SIZE 1
1859
1860
#define EVT_MODE_CHANGE 0x14
1861
typedef struct {
1862
uint8_t status;
1863
uint16_t handle;
1864
uint8_t mode;
1865
uint16_t interval;
1866
} __attribute__ ((packed)) evt_mode_change;
1867
#define EVT_MODE_CHANGE_SIZE 6
1868
1869
#define EVT_RETURN_LINK_KEYS 0x15
1870
typedef struct {
1871
uint8_t num_keys;
1872
/* variable length part */
1873
} __attribute__ ((packed)) evt_return_link_keys;
1874
#define EVT_RETURN_LINK_KEYS_SIZE 1
1875
1876
#define EVT_PIN_CODE_REQ 0x16
1877
typedef struct {
1878
bdaddr_t bdaddr;
1879
} __attribute__ ((packed)) evt_pin_code_req;
1880
#define EVT_PIN_CODE_REQ_SIZE 6
1881
1882
#define EVT_LINK_KEY_REQ 0x17
1883
typedef struct {
1884
bdaddr_t bdaddr;
1885
} __attribute__ ((packed)) evt_link_key_req;
1886
#define EVT_LINK_KEY_REQ_SIZE 6
1887
1888
#define EVT_LINK_KEY_NOTIFY 0x18
1889
typedef struct {
1890
bdaddr_t bdaddr;
1891
uint8_t link_key[16];
1892
uint8_t key_type;
1893
} __attribute__ ((packed)) evt_link_key_notify;
1894
#define EVT_LINK_KEY_NOTIFY_SIZE 23
1895
1896
#define EVT_LOOPBACK_COMMAND 0x19
1897
1898
#define EVT_DATA_BUFFER_OVERFLOW 0x1A
1899
typedef struct {
1900
uint8_t link_type;
1901
} __attribute__ ((packed)) evt_data_buffer_overflow;
1902
#define EVT_DATA_BUFFER_OVERFLOW_SIZE 1
1903
1904
#define EVT_MAX_SLOTS_CHANGE 0x1B
1905
typedef struct {
1906
uint16_t handle;
1907
uint8_t max_slots;
1908
} __attribute__ ((packed)) evt_max_slots_change;
1909
#define EVT_MAX_SLOTS_CHANGE_SIZE 3
1910
1911
#define EVT_READ_CLOCK_OFFSET_COMPLETE 0x1C
1912
typedef struct {
1913
uint8_t status;
1914
uint16_t handle;
1915
uint16_t clock_offset;
1916
} __attribute__ ((packed)) evt_read_clock_offset_complete;
1917
#define EVT_READ_CLOCK_OFFSET_COMPLETE_SIZE 5
1918
1919
#define EVT_CONN_PTYPE_CHANGED 0x1D
1920
typedef struct {
1921
uint8_t status;
1922
uint16_t handle;
1923
uint16_t ptype;
1924
} __attribute__ ((packed)) evt_conn_ptype_changed;
1925
#define EVT_CONN_PTYPE_CHANGED_SIZE 5
1926
1927
#define EVT_QOS_VIOLATION 0x1E
1928
typedef struct {
1929
uint16_t handle;
1930
} __attribute__ ((packed)) evt_qos_violation;
1931
#define EVT_QOS_VIOLATION_SIZE 2
1932
1933
#define EVT_PSCAN_REP_MODE_CHANGE 0x20
1934
typedef struct {
1935
bdaddr_t bdaddr;
1936
uint8_t pscan_rep_mode;
1937
} __attribute__ ((packed)) evt_pscan_rep_mode_change;
1938
#define EVT_PSCAN_REP_MODE_CHANGE_SIZE 7
1939
1940
#define EVT_FLOW_SPEC_COMPLETE 0x21
1941
typedef struct {
1942
uint8_t status;
1943
uint16_t handle;
1944
uint8_t flags;
1945
uint8_t direction;
1946
hci_qos qos;
1947
} __attribute__ ((packed)) evt_flow_spec_complete;
1948
#define EVT_FLOW_SPEC_COMPLETE_SIZE (5 + HCI_QOS_CP_SIZE)
1949
1950
#define EVT_INQUIRY_RESULT_WITH_RSSI 0x22
1951
typedef struct {
1952
bdaddr_t bdaddr;
1953
uint8_t pscan_rep_mode;
1954
uint8_t pscan_period_mode;
1955
uint8_t dev_class[3];
1956
uint16_t clock_offset;
1957
int8_t rssi;
1958
} __attribute__ ((packed)) inquiry_info_with_rssi;
1959
#define INQUIRY_INFO_WITH_RSSI_SIZE 14
1960
typedef struct {
1961
bdaddr_t bdaddr;
1962
uint8_t pscan_rep_mode;
1963
uint8_t pscan_period_mode;
1964
uint8_t pscan_mode;
1965
uint8_t dev_class[3];
1966
uint16_t clock_offset;
1967
int8_t rssi;
1968
} __attribute__ ((packed)) inquiry_info_with_rssi_and_pscan_mode;
1969
#define INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE 15
1970
1971
#define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE 0x23
1972
typedef struct {
1973
uint8_t status;
1974
uint16_t handle;
1975
uint8_t page_num;
1976
uint8_t max_page_num;
1977
uint8_t features[8];
1978
} __attribute__ ((packed)) evt_read_remote_ext_features_complete;
1979
#define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE_SIZE 13
1980
1981
#define EVT_SYNC_CONN_COMPLETE 0x2C
1982
typedef struct {
1983
uint8_t status;
1984
uint16_t handle;
1985
bdaddr_t bdaddr;
1986
uint8_t link_type;
1987
uint8_t trans_interval;
1988
uint8_t retrans_window;
1989
uint16_t rx_pkt_len;
1990
uint16_t tx_pkt_len;
1991
uint8_t air_mode;
1992
} __attribute__ ((packed)) evt_sync_conn_complete;
1993
#define EVT_SYNC_CONN_COMPLETE_SIZE 17
1994
1995
#define EVT_SYNC_CONN_CHANGED 0x2D
1996
typedef struct {
1997
uint8_t status;
1998
uint16_t handle;
1999
uint8_t trans_interval;
2000
uint8_t retrans_window;
2001
uint16_t rx_pkt_len;
2002
uint16_t tx_pkt_len;
2003
} __attribute__ ((packed)) evt_sync_conn_changed;
2004
#define EVT_SYNC_CONN_CHANGED_SIZE 9
2005
2006
#define EVT_SNIFF_SUBRATING 0x2E
2007
typedef struct {
2008
uint8_t status;
2009
uint16_t handle;
2010
uint16_t max_tx_latency;
2011
uint16_t max_rx_latency;
2012
uint16_t min_remote_timeout;
2013
uint16_t min_local_timeout;
2014
} __attribute__ ((packed)) evt_sniff_subrating;
2015
#define EVT_SNIFF_SUBRATING_SIZE 11
2016
2017
#define EVT_EXTENDED_INQUIRY_RESULT 0x2F
2018
typedef struct {
2019
bdaddr_t bdaddr;
2020
uint8_t pscan_rep_mode;
2021
uint8_t pscan_period_mode;
2022
uint8_t dev_class[3];
2023
uint16_t clock_offset;
2024
int8_t rssi;
2025
uint8_t data[HCI_MAX_EIR_LENGTH];
2026
} __attribute__ ((packed)) extended_inquiry_info;
2027
#define EXTENDED_INQUIRY_INFO_SIZE 254
2028
2029
#define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
2030
typedef struct {
2031
uint8_t status;
2032
uint16_t handle;
2033
} __attribute__ ((packed)) evt_encryption_key_refresh_complete;
2034
#define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3
2035
2036
#define EVT_IO_CAPABILITY_REQUEST 0x31
2037
typedef struct {
2038
bdaddr_t bdaddr;
2039
} __attribute__ ((packed)) evt_io_capability_request;
2040
#define EVT_IO_CAPABILITY_REQUEST_SIZE 6
2041
2042
#define EVT_IO_CAPABILITY_RESPONSE 0x32
2043
typedef struct {
2044
bdaddr_t bdaddr;
2045
uint8_t capability;
2046
uint8_t oob_data;
2047
uint8_t authentication;
2048
} __attribute__ ((packed)) evt_io_capability_response;
2049
#define EVT_IO_CAPABILITY_RESPONSE_SIZE 9
2050
2051
#define EVT_USER_CONFIRM_REQUEST 0x33
2052
typedef struct {
2053
bdaddr_t bdaddr;
2054
uint32_t passkey;
2055
} __attribute__ ((packed)) evt_user_confirm_request;
2056
#define EVT_USER_CONFIRM_REQUEST_SIZE 10
2057
2058
#define EVT_USER_PASSKEY_REQUEST 0x34
2059
typedef struct {
2060
bdaddr_t bdaddr;
2061
} __attribute__ ((packed)) evt_user_passkey_request;
2062
#define EVT_USER_PASSKEY_REQUEST_SIZE 6
2063
2064
#define EVT_REMOTE_OOB_DATA_REQUEST 0x35
2065
typedef struct {
2066
bdaddr_t bdaddr;
2067
} __attribute__ ((packed)) evt_remote_oob_data_request;
2068
#define EVT_REMOTE_OOB_DATA_REQUEST_SIZE 6
2069
2070
#define EVT_SIMPLE_PAIRING_COMPLETE 0x36
2071
typedef struct {
2072
uint8_t status;
2073
bdaddr_t bdaddr;
2074
} __attribute__ ((packed)) evt_simple_pairing_complete;
2075
#define EVT_SIMPLE_PAIRING_COMPLETE_SIZE 7
2076
2077
#define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
2078
typedef struct {
2079
uint16_t handle;
2080
uint16_t timeout;
2081
} __attribute__ ((packed)) evt_link_supervision_timeout_changed;
2082
#define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED_SIZE 4
2083
2084
#define EVT_ENHANCED_FLUSH_COMPLETE 0x39
2085
typedef struct {
2086
uint16_t handle;
2087
} __attribute__ ((packed)) evt_enhanced_flush_complete;
2088
#define EVT_ENHANCED_FLUSH_COMPLETE_SIZE 2
2089
2090
#define EVT_USER_PASSKEY_NOTIFY 0x3B
2091
typedef struct {
2092
bdaddr_t bdaddr;
2093
uint32_t passkey;
2094
} __attribute__ ((packed)) evt_user_passkey_notify;
2095
#define EVT_USER_PASSKEY_NOTIFY_SIZE 10
2096
2097
#define EVT_KEYPRESS_NOTIFY 0x3C
2098
typedef struct {
2099
bdaddr_t bdaddr;
2100
uint8_t type;
2101
} __attribute__ ((packed)) evt_keypress_notify;
2102
#define EVT_KEYPRESS_NOTIFY_SIZE 7
2103
2104
#define EVT_REMOTE_HOST_FEATURES_NOTIFY 0x3D
2105
typedef struct {
2106
bdaddr_t bdaddr;
2107
uint8_t features[8];
2108
} __attribute__ ((packed)) evt_remote_host_features_notify;
2109
#define EVT_REMOTE_HOST_FEATURES_NOTIFY_SIZE 14
2110
2111
#define EVT_LE_META_EVENT 0x3E
2112
typedef struct {
2113
uint8_t subevent;
2114
uint8_t data[0];
2115
} __attribute__ ((packed)) evt_le_meta_event;
2116
#define EVT_LE_META_EVENT_SIZE 1
2117
2118
#define EVT_LE_CONN_COMPLETE 0x01
2119
typedef struct {
2120
uint8_t status;
2121
uint16_t handle;
2122
uint8_t role;
2123
uint8_t peer_bdaddr_type;
2124
bdaddr_t peer_bdaddr;
2125
uint16_t interval;
2126
uint16_t latency;
2127
uint16_t supervision_timeout;
2128
uint8_t master_clock_accuracy;
2129
} __attribute__ ((packed)) evt_le_connection_complete;
2130
#define EVT_LE_CONN_COMPLETE_SIZE 18
2131
2132
#define EVT_LE_ADVERTISING_REPORT 0x02
2133
typedef struct {
2134
uint8_t evt_type;
2135
uint8_t bdaddr_type;
2136
bdaddr_t bdaddr;
2137
uint8_t length;
2138
uint8_t data[0];
2139
} __attribute__ ((packed)) le_advertising_info;
2140
#define LE_ADVERTISING_INFO_SIZE 9
2141
2142
#define EVT_LE_CONN_UPDATE_COMPLETE 0x03
2143
typedef struct {
2144
uint8_t status;
2145
uint16_t handle;
2146
uint16_t interval;
2147
uint16_t latency;
2148
uint16_t supervision_timeout;
2149
} __attribute__ ((packed)) evt_le_connection_update_complete;
2150
#define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9
2151
2152
#define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
2153
typedef struct {
2154
uint8_t status;
2155
uint16_t handle;
2156
uint8_t features[8];
2157
} __attribute__ ((packed)) evt_le_read_remote_used_features_complete;
2158
#define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11
2159
2160
#define EVT_LE_LTK_REQUEST 0x05
2161
typedef struct {
2162
uint16_t handle;
2163
uint64_t random;
2164
uint16_t diversifier;
2165
} __attribute__ ((packed)) evt_le_long_term_key_request;
2166
#define EVT_LE_LTK_REQUEST_SIZE 12
2167
2168
#define EVT_PHYSICAL_LINK_COMPLETE 0x40
2169
typedef struct {
2170
uint8_t status;
2171
uint8_t handle;
2172
} __attribute__ ((packed)) evt_physical_link_complete;
2173
#define EVT_PHYSICAL_LINK_COMPLETE_SIZE 2
2174
2175
#define EVT_CHANNEL_SELECTED 0x41
2176
2177
#define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE 0x42
2178
typedef struct {
2179
uint8_t status;
2180
uint8_t handle;
2181
uint8_t reason;
2182
} __attribute__ ((packed)) evt_disconn_physical_link_complete;
2183
#define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE_SIZE 3
2184
2185
#define EVT_PHYSICAL_LINK_LOSS_EARLY_WARNING 0x43
2186
typedef struct {
2187
uint8_t handle;
2188
uint8_t reason;
2189
} __attribute__ ((packed)) evt_physical_link_loss_warning;
2190
#define EVT_PHYSICAL_LINK_LOSS_WARNING_SIZE 2
2191
2192
#define EVT_PHYSICAL_LINK_RECOVERY 0x44
2193
typedef struct {
2194
uint8_t handle;
2195
} __attribute__ ((packed)) evt_physical_link_recovery;
2196
#define EVT_PHYSICAL_LINK_RECOVERY_SIZE 1
2197
2198
#define EVT_LOGICAL_LINK_COMPLETE 0x45
2199
typedef struct {
2200
uint8_t status;
2201
uint16_t log_handle;
2202
uint8_t handle;
2203
uint8_t tx_flow_id;
2204
} __attribute__ ((packed)) evt_logical_link_complete;
2205
#define EVT_LOGICAL_LINK_COMPLETE_SIZE 5
2206
2207
#define EVT_DISCONNECT_LOGICAL_LINK_COMPLETE 0x46
2208
2209
#define EVT_FLOW_SPEC_MODIFY_COMPLETE 0x47
2210
typedef struct {
2211
uint8_t status;
2212
uint16_t handle;
2213
} __attribute__ ((packed)) evt_flow_spec_modify_complete;
2214
#define EVT_FLOW_SPEC_MODIFY_COMPLETE_SIZE 3
2215
2216
#define EVT_NUMBER_COMPLETED_BLOCKS 0x48
2217
typedef struct {
2218
uint16_t handle;
2219
uint16_t num_cmplt_pkts;
2220
uint16_t num_cmplt_blks;
2221
} __attribute__ ((packed)) cmplt_handle;
2222
typedef struct {
2223
uint16_t total_num_blocks;
2224
uint8_t num_handles;
2225
cmplt_handle handles[0];
2226
} __attribute__ ((packed)) evt_num_completed_blocks;
2227
2228
#define EVT_AMP_STATUS_CHANGE 0x4D
2229
typedef struct {
2230
uint8_t status;
2231
uint8_t amp_status;
2232
} __attribute__ ((packed)) evt_amp_status_change;
2233
#define EVT_AMP_STATUS_CHANGE_SIZE 2
2234
2235
#define EVT_TESTING 0xFE
2236
2237
#define EVT_VENDOR 0xFF
2238
2239
/* Internal events generated by BlueZ stack */
2240
#define EVT_STACK_INTERNAL 0xFD
2241
typedef struct {
2242
uint16_t type;
2243
uint8_t data[0];
2244
} __attribute__ ((packed)) evt_stack_internal;
2245
#define EVT_STACK_INTERNAL_SIZE 2
2246
2247
#define EVT_SI_DEVICE 0x01
2248
typedef struct {
2249
uint16_t event;
2250
uint16_t dev_id;
2251
} __attribute__ ((packed)) evt_si_device;
2252
#define EVT_SI_DEVICE_SIZE 4
2253
2254
/* -------- HCI Packet structures -------- */
2255
#define HCI_TYPE_LEN 1
2256
2257
typedef struct {
2258
uint16_t opcode; /* OCF & OGF */
2259
uint8_t plen;
2260
} __attribute__ ((packed)) hci_command_hdr;
2261
#define HCI_COMMAND_HDR_SIZE 3
2262
2263
typedef struct {
2264
uint8_t evt;
2265
uint8_t plen;
2266
} __attribute__ ((packed)) hci_event_hdr;
2267
#define HCI_EVENT_HDR_SIZE 2
2268
2269
typedef struct {
2270
uint16_t handle; /* Handle & Flags(PB, BC) */
2271
uint16_t dlen;
2272
} __attribute__ ((packed)) hci_acl_hdr;
2273
#define HCI_ACL_HDR_SIZE 4
2274
2275
typedef struct {
2276
uint16_t handle;
2277
uint8_t dlen;
2278
} __attribute__ ((packed)) hci_sco_hdr;
2279
#define HCI_SCO_HDR_SIZE 3
2280
2281
typedef struct {
2282
uint16_t device;
2283
uint16_t type;
2284
uint16_t plen;
2285
} __attribute__ ((packed)) hci_msg_hdr;
2286
#define HCI_MSG_HDR_SIZE 6
2287
2288
/* Command opcode pack/unpack */
2289
#define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10))
2290
#define cmd_opcode_ogf(op) (op >> 10)
2291
#define cmd_opcode_ocf(op) (op & 0x03ff)
2292
2293
/* ACL handle and flags pack/unpack */
2294
#define acl_handle_pack(h, f) (uint16_t)((h & 0x0fff)|(f << 12))
2295
#define acl_handle(h) (h & 0x0fff)
2296
#define acl_flags(h) (h >> 12)
2297
2298
#endif /* _NO_HCI_DEFS */
2299
2300
/* HCI Socket options */
2301
#define HCI_DATA_DIR 1
2302
#define HCI_FILTER 2
2303
#define HCI_TIME_STAMP 3
2304
2305
/* HCI CMSG flags */
2306
#define HCI_CMSG_DIR 0x0001
2307
#define HCI_CMSG_TSTAMP 0x0002
2308
2309
struct sockaddr_hci {
2310
sa_family_t hci_family;
2311
unsigned short hci_dev;
2312
unsigned short hci_channel;
2313
};
2314
#define HCI_DEV_NONE 0xffff
2315
2316
#define HCI_CHANNEL_RAW 0
2317
#define HCI_CHANNEL_USER 1
2318
#define HCI_CHANNEL_MONITOR 2
2319
#define HCI_CHANNEL_CONTROL 3
2320
2321
struct hci_filter {
2322
uint32_t type_mask;
2323
uint32_t event_mask[2];
2324
uint16_t opcode;
2325
};
2326
2327
#define HCI_FLT_TYPE_BITS 31
2328
#define HCI_FLT_EVENT_BITS 63
2329
#define HCI_FLT_OGF_BITS 63
2330
#define HCI_FLT_OCF_BITS 127
2331
2332
/* Ioctl requests structures */
2333
struct hci_dev_stats {
2334
uint32_t err_rx;
2335
uint32_t err_tx;
2336
uint32_t cmd_tx;
2337
uint32_t evt_rx;
2338
uint32_t acl_tx;
2339
uint32_t acl_rx;
2340
uint32_t sco_tx;
2341
uint32_t sco_rx;
2342
uint32_t byte_rx;
2343
uint32_t byte_tx;
2344
};
2345
2346
struct hci_dev_info {
2347
uint16_t dev_id;
2348
char name[8];
2349
2350
bdaddr_t bdaddr;
2351
2352
uint32_t flags;
2353
uint8_t type;
2354
2355
uint8_t features[8];
2356
2357
uint32_t pkt_type;
2358
uint32_t link_policy;
2359
uint32_t link_mode;
2360
2361
uint16_t acl_mtu;
2362
uint16_t acl_pkts;
2363
uint16_t sco_mtu;
2364
uint16_t sco_pkts;
2365
2366
struct hci_dev_stats stat;
2367
};
2368
2369
struct hci_conn_info {
2370
uint16_t handle;
2371
bdaddr_t bdaddr;
2372
uint8_t type;
2373
uint8_t out;
2374
uint16_t state;
2375
uint32_t link_mode;
2376
};
2377
2378
struct hci_dev_req {
2379
uint16_t dev_id;
2380
uint32_t dev_opt;
2381
};
2382
2383
struct hci_dev_list_req {
2384
uint16_t dev_num;
2385
struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
2386
};
2387
2388
struct hci_conn_list_req {
2389
uint16_t dev_id;
2390
uint16_t conn_num;
2391
struct hci_conn_info conn_info[0];
2392
};
2393
2394
struct hci_conn_info_req {
2395
bdaddr_t bdaddr;
2396
uint8_t type;
2397
struct hci_conn_info conn_info[0];
2398
};
2399
2400
struct hci_auth_info_req {
2401
bdaddr_t bdaddr;
2402
uint8_t type;
2403
};
2404
2405
struct hci_inquiry_req {
2406
uint16_t dev_id;
2407
uint16_t flags;
2408
uint8_t lap[3];
2409
uint8_t length;
2410
uint8_t num_rsp;
2411
};
2412
#define IREQ_CACHE_FLUSH 0x0001
2413
2414
#ifdef __cplusplus
2415
}
2416
#endif
2417
2418
#endif /* __HCI_H */
2419
2420