3 * BlueZ - Bluetooth protocol stack for Linux
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>
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.
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.
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
33 #include <sys/socket.h>
35 #define HCI_MAX_DEV 16
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)
44 #define HCI_DEV_UNREG 2
46 #define HCI_DEV_DOWN 4
47 #define HCI_DEV_SUSPEND 5
48 #define HCI_DEV_RESUME 6
59 #ifdef __TIZEN_PATCH__
63 /* HCI controller types */
64 #define HCI_BREDR 0x00
67 /* HCI device flags */
84 LE_PUBLIC_ADDRESS = 0x00,
85 LE_RANDOM_ADDRESS = 0x01
88 /* HCI ioctl defines */
89 #define HCIDEVUP _IOW('H', 201, int)
90 #define HCIDEVDOWN _IOW('H', 202, int)
91 #define HCIDEVRESET _IOW('H', 203, int)
92 #define HCIDEVRESTAT _IOW('H', 204, int)
94 #define HCIGETDEVLIST _IOR('H', 210, int)
95 #define HCIGETDEVINFO _IOR('H', 211, int)
96 #define HCIGETCONNLIST _IOR('H', 212, int)
97 #define HCIGETCONNINFO _IOR('H', 213, int)
98 #define HCIGETAUTHINFO _IOR('H', 215, int)
100 #define HCISETRAW _IOW('H', 220, int)
101 #define HCISETSCAN _IOW('H', 221, int)
102 #define HCISETAUTH _IOW('H', 222, int)
103 #define HCISETENCRYPT _IOW('H', 223, int)
104 #define HCISETPTYPE _IOW('H', 224, int)
105 #define HCISETLINKPOL _IOW('H', 225, int)
106 #define HCISETLINKMODE _IOW('H', 226, int)
107 #define HCISETACLMTU _IOW('H', 227, int)
108 #define HCISETSCOMTU _IOW('H', 228, int)
110 #define HCIBLOCKADDR _IOW('H', 230, int)
111 #define HCIUNBLOCKADDR _IOW('H', 231, int)
113 #define HCIINQUIRY _IOR('H', 240, int)
115 #ifndef __NO_HCI_DEFS
117 /* HCI Packet types */
118 #define HCI_COMMAND_PKT 0x01
119 #define HCI_ACLDATA_PKT 0x02
120 #define HCI_SCODATA_PKT 0x03
121 #define HCI_EVENT_PKT 0x04
122 #define HCI_VENDOR_PKT 0xff
124 /* HCI Packet types */
125 #define HCI_2DH1 0x0002
126 #define HCI_3DH1 0x0004
127 #define HCI_DM1 0x0008
128 #define HCI_DH1 0x0010
129 #define HCI_2DH3 0x0100
130 #define HCI_3DH3 0x0200
131 #define HCI_DM3 0x0400
132 #define HCI_DH3 0x0800
133 #define HCI_2DH5 0x1000
134 #define HCI_3DH5 0x2000
135 #define HCI_DM5 0x4000
136 #define HCI_DH5 0x8000
138 #define HCI_HV1 0x0020
139 #define HCI_HV2 0x0040
140 #define HCI_HV3 0x0080
142 #define HCI_EV3 0x0008
143 #define HCI_EV4 0x0010
144 #define HCI_EV5 0x0020
145 #define HCI_2EV3 0x0040
146 #define HCI_3EV3 0x0080
147 #define HCI_2EV5 0x0100
148 #define HCI_3EV5 0x0200
150 #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3)
151 #define ACL_PTYPE_MASK (HCI_DM1 | HCI_DH1 | HCI_DM3 | HCI_DH3 | HCI_DM5 | HCI_DH5)
153 /* HCI Error codes */
154 #define HCI_UNKNOWN_COMMAND 0x01
155 #define HCI_NO_CONNECTION 0x02
156 #define HCI_HARDWARE_FAILURE 0x03
157 #define HCI_PAGE_TIMEOUT 0x04
158 #define HCI_AUTHENTICATION_FAILURE 0x05
159 #define HCI_PIN_OR_KEY_MISSING 0x06
160 #define HCI_MEMORY_FULL 0x07
161 #define HCI_CONNECTION_TIMEOUT 0x08
162 #define HCI_MAX_NUMBER_OF_CONNECTIONS 0x09
163 #define HCI_MAX_NUMBER_OF_SCO_CONNECTIONS 0x0a
164 #define HCI_ACL_CONNECTION_EXISTS 0x0b
165 #define HCI_COMMAND_DISALLOWED 0x0c
166 #define HCI_REJECTED_LIMITED_RESOURCES 0x0d
167 #define HCI_REJECTED_SECURITY 0x0e
168 #define HCI_REJECTED_PERSONAL 0x0f
169 #define HCI_HOST_TIMEOUT 0x10
170 #define HCI_UNSUPPORTED_FEATURE 0x11
171 #define HCI_INVALID_PARAMETERS 0x12
172 #define HCI_OE_USER_ENDED_CONNECTION 0x13
173 #define HCI_OE_LOW_RESOURCES 0x14
174 #define HCI_OE_POWER_OFF 0x15
175 #define HCI_CONNECTION_TERMINATED 0x16
176 #define HCI_REPEATED_ATTEMPTS 0x17
177 #define HCI_PAIRING_NOT_ALLOWED 0x18
178 #define HCI_UNKNOWN_LMP_PDU 0x19
179 #define HCI_UNSUPPORTED_REMOTE_FEATURE 0x1a
180 #define HCI_SCO_OFFSET_REJECTED 0x1b
181 #define HCI_SCO_INTERVAL_REJECTED 0x1c
182 #define HCI_AIR_MODE_REJECTED 0x1d
183 #define HCI_INVALID_LMP_PARAMETERS 0x1e
184 #define HCI_UNSPECIFIED_ERROR 0x1f
185 #define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE 0x20
186 #define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
187 #define HCI_LMP_RESPONSE_TIMEOUT 0x22
188 #define HCI_LMP_ERROR_TRANSACTION_COLLISION 0x23
189 #define HCI_LMP_PDU_NOT_ALLOWED 0x24
190 #define HCI_ENCRYPTION_MODE_NOT_ACCEPTED 0x25
191 #define HCI_UNIT_LINK_KEY_USED 0x26
192 #define HCI_QOS_NOT_SUPPORTED 0x27
193 #define HCI_INSTANT_PASSED 0x28
194 #define HCI_PAIRING_NOT_SUPPORTED 0x29
195 #define HCI_TRANSACTION_COLLISION 0x2a
196 #define HCI_QOS_UNACCEPTABLE_PARAMETER 0x2c
197 #define HCI_QOS_REJECTED 0x2d
198 #define HCI_CLASSIFICATION_NOT_SUPPORTED 0x2e
199 #define HCI_INSUFFICIENT_SECURITY 0x2f
200 #define HCI_PARAMETER_OUT_OF_RANGE 0x30
201 #define HCI_ROLE_SWITCH_PENDING 0x32
202 #define HCI_SLOT_VIOLATION 0x34
203 #define HCI_ROLE_SWITCH_FAILED 0x35
204 #define HCI_EIR_TOO_LARGE 0x36
205 #define HCI_SIMPLE_PAIRING_NOT_SUPPORTED 0x37
206 #define HCI_HOST_BUSY_PAIRING 0x38
209 #define ACL_START_NO_FLUSH 0x00
210 #define ACL_CONT 0x01
211 #define ACL_START 0x02
212 #define ACL_ACTIVE_BCAST 0x04
213 #define ACL_PICO_BCAST 0x08
216 #define SCO_LINK 0x00
217 #define ACL_LINK 0x01
218 #define ESCO_LINK 0x02
221 #define LMP_3SLOT 0x01
222 #define LMP_5SLOT 0x02
223 #define LMP_ENCRYPT 0x04
224 #define LMP_SOFFSET 0x08
225 #define LMP_TACCURACY 0x10
226 #define LMP_RSWITCH 0x20
227 #define LMP_HOLD 0x40
228 #define LMP_SNIFF 0x80
230 #define LMP_PARK 0x01
231 #define LMP_RSSI 0x02
232 #define LMP_QUALITY 0x04
236 #define LMP_ULAW 0x40
237 #define LMP_ALAW 0x80
239 #define LMP_CVSD 0x01
240 #define LMP_PSCHEME 0x02
241 #define LMP_PCONTROL 0x04
242 #define LMP_TRSP_SCO 0x08
243 #define LMP_BCAST_ENC 0x80
245 #define LMP_EDR_ACL_2M 0x02
246 #define LMP_EDR_ACL_3M 0x04
247 #define LMP_ENH_ISCAN 0x08
248 #define LMP_ILACE_ISCAN 0x10
249 #define LMP_ILACE_PSCAN 0x20
250 #define LMP_RSSI_INQ 0x40
251 #define LMP_ESCO 0x80
255 #define LMP_AFH_CAP_SLV 0x08
256 #define LMP_AFH_CLS_SLV 0x10
257 #define LMP_NO_BREDR 0x20
259 #define LMP_EDR_3SLOT 0x80
261 #define LMP_EDR_5SLOT 0x01
262 #define LMP_SNIFF_SUBR 0x02
263 #define LMP_PAUSE_ENC 0x04
264 #define LMP_AFH_CAP_MST 0x08
265 #define LMP_AFH_CLS_MST 0x10
266 #define LMP_EDR_ESCO_2M 0x20
267 #define LMP_EDR_ESCO_3M 0x40
268 #define LMP_EDR_3S_ESCO 0x80
270 #define LMP_EXT_INQ 0x01
271 #define LMP_LE_BREDR 0x02
272 #define LMP_SIMPLE_PAIR 0x08
273 #define LMP_ENCAPS_PDU 0x10
274 #define LMP_ERR_DAT_REP 0x20
275 #define LMP_NFLUSH_PKTS 0x40
277 #define LMP_LSTO 0x01
278 #define LMP_INQ_TX_PWR 0x02
280 #define LMP_EXT_FEAT 0x80
282 /* Extended LMP features */
283 #define LMP_HOST_SSP 0x01
284 #define LMP_HOST_LE 0x02
285 #define LMP_HOST_LE_BREDR 0x04
288 #define HCI_LP_RSWITCH 0x0001
289 #define HCI_LP_HOLD 0x0002
290 #define HCI_LP_SNIFF 0x0004
291 #define HCI_LP_PARK 0x0008
294 #define HCI_LM_ACCEPT 0x8000
295 #define HCI_LM_MASTER 0x0001
296 #define HCI_LM_AUTH 0x0002
297 #define HCI_LM_ENCRYPT 0x0004
298 #define HCI_LM_TRUSTED 0x0008
299 #define HCI_LM_RELIABLE 0x0010
300 #define HCI_LM_SECURE 0x0020
303 #define HCI_LK_COMBINATION 0x00
304 #define HCI_LK_LOCAL_UNIT 0x01
305 #define HCI_LK_REMOTE_UNIT 0x02
306 #define HCI_LK_DEBUG_COMBINATION 0x03
307 #define HCI_LK_UNAUTH_COMBINATION 0x04
308 #define HCI_LK_AUTH_COMBINATION 0x05
309 #define HCI_LK_CHANGED_COMBINATION 0x06
310 #define HCI_LK_INVALID 0xFF
312 /* ----- HCI Commands ----- */
315 #define OGF_LINK_CTL 0x01
317 #define OCF_INQUIRY 0x0001
320 uint8_t length; /* 1.28s units */
322 } __attribute__ ((packed)) inquiry_cp;
323 #define INQUIRY_CP_SIZE 5
328 } __attribute__ ((packed)) status_bdaddr_rp;
329 #define STATUS_BDADDR_RP_SIZE 7
331 #define OCF_INQUIRY_CANCEL 0x0002
333 #define OCF_PERIODIC_INQUIRY 0x0003
335 uint16_t max_period; /* 1.28s units */
336 uint16_t min_period; /* 1.28s units */
338 uint8_t length; /* 1.28s units */
340 } __attribute__ ((packed)) periodic_inquiry_cp;
341 #define PERIODIC_INQUIRY_CP_SIZE 9
343 #define OCF_EXIT_PERIODIC_INQUIRY 0x0004
345 #define OCF_CREATE_CONN 0x0005
349 uint8_t pscan_rep_mode;
351 uint16_t clock_offset;
353 } __attribute__ ((packed)) create_conn_cp;
354 #define CREATE_CONN_CP_SIZE 13
356 #define OCF_DISCONNECT 0x0006
360 } __attribute__ ((packed)) disconnect_cp;
361 #define DISCONNECT_CP_SIZE 3
363 #define OCF_ADD_SCO 0x0007
367 } __attribute__ ((packed)) add_sco_cp;
368 #define ADD_SCO_CP_SIZE 4
370 #define OCF_CREATE_CONN_CANCEL 0x0008
373 } __attribute__ ((packed)) create_conn_cancel_cp;
374 #define CREATE_CONN_CANCEL_CP_SIZE 6
376 #define OCF_ACCEPT_CONN_REQ 0x0009
380 } __attribute__ ((packed)) accept_conn_req_cp;
381 #define ACCEPT_CONN_REQ_CP_SIZE 7
383 #define OCF_REJECT_CONN_REQ 0x000A
387 } __attribute__ ((packed)) reject_conn_req_cp;
388 #define REJECT_CONN_REQ_CP_SIZE 7
390 #define OCF_LINK_KEY_REPLY 0x000B
393 uint8_t link_key[16];
394 } __attribute__ ((packed)) link_key_reply_cp;
395 #define LINK_KEY_REPLY_CP_SIZE 22
397 #define OCF_LINK_KEY_NEG_REPLY 0x000C
399 #define OCF_PIN_CODE_REPLY 0x000D
403 uint8_t pin_code[16];
404 } __attribute__ ((packed)) pin_code_reply_cp;
405 #define PIN_CODE_REPLY_CP_SIZE 23
407 #define OCF_PIN_CODE_NEG_REPLY 0x000E
409 #define OCF_SET_CONN_PTYPE 0x000F
413 } __attribute__ ((packed)) set_conn_ptype_cp;
414 #define SET_CONN_PTYPE_CP_SIZE 4
416 #define OCF_AUTH_REQUESTED 0x0011
419 } __attribute__ ((packed)) auth_requested_cp;
420 #define AUTH_REQUESTED_CP_SIZE 2
422 #define OCF_SET_CONN_ENCRYPT 0x0013
426 } __attribute__ ((packed)) set_conn_encrypt_cp;
427 #define SET_CONN_ENCRYPT_CP_SIZE 3
429 #define OCF_CHANGE_CONN_LINK_KEY 0x0015
432 } __attribute__ ((packed)) change_conn_link_key_cp;
433 #define CHANGE_CONN_LINK_KEY_CP_SIZE 2
435 #define OCF_MASTER_LINK_KEY 0x0017
438 } __attribute__ ((packed)) master_link_key_cp;
439 #define MASTER_LINK_KEY_CP_SIZE 1
441 #define OCF_REMOTE_NAME_REQ 0x0019
444 uint8_t pscan_rep_mode;
446 uint16_t clock_offset;
447 } __attribute__ ((packed)) remote_name_req_cp;
448 #define REMOTE_NAME_REQ_CP_SIZE 10
450 #define OCF_REMOTE_NAME_REQ_CANCEL 0x001A
453 } __attribute__ ((packed)) remote_name_req_cancel_cp;
454 #define REMOTE_NAME_REQ_CANCEL_CP_SIZE 6
456 #define OCF_READ_REMOTE_FEATURES 0x001B
459 } __attribute__ ((packed)) read_remote_features_cp;
460 #define READ_REMOTE_FEATURES_CP_SIZE 2
462 #define OCF_READ_REMOTE_EXT_FEATURES 0x001C
466 } __attribute__ ((packed)) read_remote_ext_features_cp;
467 #define READ_REMOTE_EXT_FEATURES_CP_SIZE 3
469 #define OCF_READ_REMOTE_VERSION 0x001D
472 } __attribute__ ((packed)) read_remote_version_cp;
473 #define READ_REMOTE_VERSION_CP_SIZE 2
475 #define OCF_READ_CLOCK_OFFSET 0x001F
478 } __attribute__ ((packed)) read_clock_offset_cp;
479 #define READ_CLOCK_OFFSET_CP_SIZE 2
481 #define OCF_READ_LMP_HANDLE 0x0020
483 #define OCF_SETUP_SYNC_CONN 0x0028
486 uint32_t tx_bandwith;
487 uint32_t rx_bandwith;
488 uint16_t max_latency;
489 uint16_t voice_setting;
490 uint8_t retrans_effort;
492 } __attribute__ ((packed)) setup_sync_conn_cp;
493 #define SETUP_SYNC_CONN_CP_SIZE 17
495 #define OCF_ACCEPT_SYNC_CONN_REQ 0x0029
498 uint32_t tx_bandwith;
499 uint32_t rx_bandwith;
500 uint16_t max_latency;
501 uint16_t voice_setting;
502 uint8_t retrans_effort;
504 } __attribute__ ((packed)) accept_sync_conn_req_cp;
505 #define ACCEPT_SYNC_CONN_REQ_CP_SIZE 21
507 #define OCF_REJECT_SYNC_CONN_REQ 0x002A
511 } __attribute__ ((packed)) reject_sync_conn_req_cp;
512 #define REJECT_SYNC_CONN_REQ_CP_SIZE 7
514 #define OCF_IO_CAPABILITY_REPLY 0x002B
519 uint8_t authentication;
520 } __attribute__ ((packed)) io_capability_reply_cp;
521 #define IO_CAPABILITY_REPLY_CP_SIZE 9
523 #define OCF_USER_CONFIRM_REPLY 0x002C
526 } __attribute__ ((packed)) user_confirm_reply_cp;
527 #define USER_CONFIRM_REPLY_CP_SIZE 6
529 #define OCF_USER_CONFIRM_NEG_REPLY 0x002D
531 #define OCF_USER_PASSKEY_REPLY 0x002E
535 } __attribute__ ((packed)) user_passkey_reply_cp;
536 #define USER_PASSKEY_REPLY_CP_SIZE 10
538 #define OCF_USER_PASSKEY_NEG_REPLY 0x002F
540 #define OCF_REMOTE_OOB_DATA_REPLY 0x0030
544 uint8_t randomizer[16];
545 } __attribute__ ((packed)) remote_oob_data_reply_cp;
546 #define REMOTE_OOB_DATA_REPLY_CP_SIZE 38
548 #define OCF_REMOTE_OOB_DATA_NEG_REPLY 0x0033
550 #define OCF_IO_CAPABILITY_NEG_REPLY 0x0034
554 } __attribute__ ((packed)) io_capability_neg_reply_cp;
555 #define IO_CAPABILITY_NEG_REPLY_CP_SIZE 7
557 #define OCF_CREATE_PHYSICAL_LINK 0x0035
563 } __attribute__ ((packed)) create_physical_link_cp;
564 #define CREATE_PHYSICAL_LINK_CP_SIZE 35
566 #define OCF_ACCEPT_PHYSICAL_LINK 0x0036
572 } __attribute__ ((packed)) accept_physical_link_cp;
573 #define ACCEPT_PHYSICAL_LINK_CP_SIZE 35
575 #define OCF_DISCONNECT_PHYSICAL_LINK 0x0037
579 } __attribute__ ((packed)) disconnect_physical_link_cp;
580 #define DISCONNECT_PHYSICAL_LINK_CP_SIZE 2
582 #define OCF_CREATE_LOGICAL_LINK 0x0038
587 } __attribute__ ((packed)) create_logical_link_cp;
588 #define CREATE_LOGICAL_LINK_CP_SIZE 33
590 #define OCF_ACCEPT_LOGICAL_LINK 0x0039
592 #define OCF_DISCONNECT_LOGICAL_LINK 0x003A
595 } __attribute__ ((packed)) disconnect_logical_link_cp;
596 #define DISCONNECT_LOGICAL_LINK_CP_SIZE 2
598 #define OCF_LOGICAL_LINK_CANCEL 0x003B
602 } __attribute__ ((packed)) cancel_logical_link_cp;
603 #define LOGICAL_LINK_CANCEL_CP_SIZE 2
608 } __attribute__ ((packed)) cancel_logical_link_rp;
609 #define LOGICAL_LINK_CANCEL_RP_SIZE 3
611 #define OCF_FLOW_SPEC_MODIFY 0x003C
614 #define OGF_LINK_POLICY 0x02
616 #define OCF_HOLD_MODE 0x0001
619 uint16_t max_interval;
620 uint16_t min_interval;
621 } __attribute__ ((packed)) hold_mode_cp;
622 #define HOLD_MODE_CP_SIZE 6
624 #define OCF_SNIFF_MODE 0x0003
627 uint16_t max_interval;
628 uint16_t min_interval;
631 } __attribute__ ((packed)) sniff_mode_cp;
632 #define SNIFF_MODE_CP_SIZE 10
634 #define OCF_EXIT_SNIFF_MODE 0x0004
637 } __attribute__ ((packed)) exit_sniff_mode_cp;
638 #define EXIT_SNIFF_MODE_CP_SIZE 2
640 #define OCF_PARK_MODE 0x0005
643 uint16_t max_interval;
644 uint16_t min_interval;
645 } __attribute__ ((packed)) park_mode_cp;
646 #define PARK_MODE_CP_SIZE 6
648 #define OCF_EXIT_PARK_MODE 0x0006
651 } __attribute__ ((packed)) exit_park_mode_cp;
652 #define EXIT_PARK_MODE_CP_SIZE 2
654 #define OCF_QOS_SETUP 0x0007
656 uint8_t service_type; /* 1 = best effort */
657 uint32_t token_rate; /* Byte per seconds */
658 uint32_t peak_bandwidth; /* Byte per seconds */
659 uint32_t latency; /* Microseconds */
660 uint32_t delay_variation; /* Microseconds */
661 } __attribute__ ((packed)) hci_qos;
662 #define HCI_QOS_CP_SIZE 17
665 uint8_t flags; /* Reserved */
667 } __attribute__ ((packed)) qos_setup_cp;
668 #define QOS_SETUP_CP_SIZE (3 + HCI_QOS_CP_SIZE)
670 #define OCF_ROLE_DISCOVERY 0x0009
673 } __attribute__ ((packed)) role_discovery_cp;
674 #define ROLE_DISCOVERY_CP_SIZE 2
679 } __attribute__ ((packed)) role_discovery_rp;
680 #define ROLE_DISCOVERY_RP_SIZE 4
682 #define OCF_SWITCH_ROLE 0x000B
686 } __attribute__ ((packed)) switch_role_cp;
687 #define SWITCH_ROLE_CP_SIZE 7
689 #define OCF_READ_LINK_POLICY 0x000C
692 } __attribute__ ((packed)) read_link_policy_cp;
693 #define READ_LINK_POLICY_CP_SIZE 2
698 } __attribute__ ((packed)) read_link_policy_rp;
699 #define READ_LINK_POLICY_RP_SIZE 5
701 #define OCF_WRITE_LINK_POLICY 0x000D
705 } __attribute__ ((packed)) write_link_policy_cp;
706 #define WRITE_LINK_POLICY_CP_SIZE 4
710 } __attribute__ ((packed)) write_link_policy_rp;
711 #define WRITE_LINK_POLICY_RP_SIZE 3
713 #define OCF_READ_DEFAULT_LINK_POLICY 0x000E
715 #define OCF_WRITE_DEFAULT_LINK_POLICY 0x000F
717 #define OCF_FLOW_SPECIFICATION 0x0010
719 #define OCF_SNIFF_SUBRATING 0x0011
722 uint16_t max_latency;
723 uint16_t min_remote_timeout;
724 uint16_t min_local_timeout;
725 } __attribute__ ((packed)) sniff_subrating_cp;
726 #define SNIFF_SUBRATING_CP_SIZE 8
728 /* Host Controller and Baseband */
729 #define OGF_HOST_CTL 0x03
731 #define OCF_SET_EVENT_MASK 0x0001
734 } __attribute__ ((packed)) set_event_mask_cp;
735 #define SET_EVENT_MASK_CP_SIZE 8
737 #define OCF_RESET 0x0003
739 #define OCF_SET_EVENT_FLT 0x0005
743 uint8_t condition[0];
744 } __attribute__ ((packed)) set_event_flt_cp;
745 #define SET_EVENT_FLT_CP_SIZE 2
748 #define FLT_CLEAR_ALL 0x00
749 #define FLT_INQ_RESULT 0x01
750 #define FLT_CONN_SETUP 0x02
751 /* INQ_RESULT Condition types */
752 #define INQ_RESULT_RETURN_ALL 0x00
753 #define INQ_RESULT_RETURN_CLASS 0x01
754 #define INQ_RESULT_RETURN_BDADDR 0x02
755 /* CONN_SETUP Condition types */
756 #define CONN_SETUP_ALLOW_ALL 0x00
757 #define CONN_SETUP_ALLOW_CLASS 0x01
758 #define CONN_SETUP_ALLOW_BDADDR 0x02
759 /* CONN_SETUP Conditions */
760 #define CONN_SETUP_AUTO_OFF 0x01
761 #define CONN_SETUP_AUTO_ON 0x02
763 #define OCF_FLUSH 0x0008
765 #define OCF_READ_PIN_TYPE 0x0009
769 } __attribute__ ((packed)) read_pin_type_rp;
770 #define READ_PIN_TYPE_RP_SIZE 2
772 #define OCF_WRITE_PIN_TYPE 0x000A
775 } __attribute__ ((packed)) write_pin_type_cp;
776 #define WRITE_PIN_TYPE_CP_SIZE 1
778 #define OCF_CREATE_NEW_UNIT_KEY 0x000B
780 #define OCF_READ_STORED_LINK_KEY 0x000D
784 } __attribute__ ((packed)) read_stored_link_key_cp;
785 #define READ_STORED_LINK_KEY_CP_SIZE 7
790 } __attribute__ ((packed)) read_stored_link_key_rp;
791 #define READ_STORED_LINK_KEY_RP_SIZE 5
793 #define OCF_WRITE_STORED_LINK_KEY 0x0011
796 /* variable length part */
797 } __attribute__ ((packed)) write_stored_link_key_cp;
798 #define WRITE_STORED_LINK_KEY_CP_SIZE 1
802 } __attribute__ ((packed)) write_stored_link_key_rp;
803 #define READ_WRITE_LINK_KEY_RP_SIZE 2
805 #define OCF_DELETE_STORED_LINK_KEY 0x0012
809 } __attribute__ ((packed)) delete_stored_link_key_cp;
810 #define DELETE_STORED_LINK_KEY_CP_SIZE 7
814 } __attribute__ ((packed)) delete_stored_link_key_rp;
815 #define DELETE_STORED_LINK_KEY_RP_SIZE 3
817 #define HCI_MAX_NAME_LENGTH 248
819 #define OCF_CHANGE_LOCAL_NAME 0x0013
821 uint8_t name[HCI_MAX_NAME_LENGTH];
822 } __attribute__ ((packed)) change_local_name_cp;
823 #define CHANGE_LOCAL_NAME_CP_SIZE 248
825 #define OCF_READ_LOCAL_NAME 0x0014
828 uint8_t name[HCI_MAX_NAME_LENGTH];
829 } __attribute__ ((packed)) read_local_name_rp;
830 #define READ_LOCAL_NAME_RP_SIZE 249
832 #define OCF_READ_CONN_ACCEPT_TIMEOUT 0x0015
836 } __attribute__ ((packed)) read_conn_accept_timeout_rp;
837 #define READ_CONN_ACCEPT_TIMEOUT_RP_SIZE 3
839 #define OCF_WRITE_CONN_ACCEPT_TIMEOUT 0x0016
842 } __attribute__ ((packed)) write_conn_accept_timeout_cp;
843 #define WRITE_CONN_ACCEPT_TIMEOUT_CP_SIZE 2
845 #define OCF_READ_PAGE_TIMEOUT 0x0017
849 } __attribute__ ((packed)) read_page_timeout_rp;
850 #define READ_PAGE_TIMEOUT_RP_SIZE 3
852 #define OCF_WRITE_PAGE_TIMEOUT 0x0018
855 } __attribute__ ((packed)) write_page_timeout_cp;
856 #define WRITE_PAGE_TIMEOUT_CP_SIZE 2
858 #define OCF_READ_SCAN_ENABLE 0x0019
862 } __attribute__ ((packed)) read_scan_enable_rp;
863 #define READ_SCAN_ENABLE_RP_SIZE 2
865 #define OCF_WRITE_SCAN_ENABLE 0x001A
866 #define SCAN_DISABLED 0x00
867 #define SCAN_INQUIRY 0x01
868 #define SCAN_PAGE 0x02
870 #define OCF_READ_PAGE_ACTIVITY 0x001B
875 } __attribute__ ((packed)) read_page_activity_rp;
876 #define READ_PAGE_ACTIVITY_RP_SIZE 5
878 #define OCF_WRITE_PAGE_ACTIVITY 0x001C
882 } __attribute__ ((packed)) write_page_activity_cp;
883 #define WRITE_PAGE_ACTIVITY_CP_SIZE 4
885 #define OCF_READ_INQ_ACTIVITY 0x001D
890 } __attribute__ ((packed)) read_inq_activity_rp;
891 #define READ_INQ_ACTIVITY_RP_SIZE 5
893 #define OCF_WRITE_INQ_ACTIVITY 0x001E
897 } __attribute__ ((packed)) write_inq_activity_cp;
898 #define WRITE_INQ_ACTIVITY_CP_SIZE 4
900 #define OCF_READ_AUTH_ENABLE 0x001F
902 #define OCF_WRITE_AUTH_ENABLE 0x0020
903 #define AUTH_DISABLED 0x00
904 #define AUTH_ENABLED 0x01
906 #define OCF_READ_ENCRYPT_MODE 0x0021
908 #define OCF_WRITE_ENCRYPT_MODE 0x0022
909 #define ENCRYPT_DISABLED 0x00
910 #define ENCRYPT_P2P 0x01
911 #define ENCRYPT_BOTH 0x02
913 #define OCF_READ_CLASS_OF_DEV 0x0023
916 uint8_t dev_class[3];
917 } __attribute__ ((packed)) read_class_of_dev_rp;
918 #define READ_CLASS_OF_DEV_RP_SIZE 4
920 #define OCF_WRITE_CLASS_OF_DEV 0x0024
922 uint8_t dev_class[3];
923 } __attribute__ ((packed)) write_class_of_dev_cp;
924 #define WRITE_CLASS_OF_DEV_CP_SIZE 3
926 #define OCF_READ_VOICE_SETTING 0x0025
929 uint16_t voice_setting;
930 } __attribute__ ((packed)) read_voice_setting_rp;
931 #define READ_VOICE_SETTING_RP_SIZE 3
933 #define OCF_WRITE_VOICE_SETTING 0x0026
935 uint16_t voice_setting;
936 } __attribute__ ((packed)) write_voice_setting_cp;
937 #define WRITE_VOICE_SETTING_CP_SIZE 2
939 #define OCF_READ_AUTOMATIC_FLUSH_TIMEOUT 0x0027
941 #define OCF_WRITE_AUTOMATIC_FLUSH_TIMEOUT 0x0028
943 #define OCF_READ_NUM_BROADCAST_RETRANS 0x0029
945 #define OCF_WRITE_NUM_BROADCAST_RETRANS 0x002A
947 #define OCF_READ_HOLD_MODE_ACTIVITY 0x002B
949 #define OCF_WRITE_HOLD_MODE_ACTIVITY 0x002C
951 #define OCF_READ_TRANSMIT_POWER_LEVEL 0x002D
955 } __attribute__ ((packed)) read_transmit_power_level_cp;
956 #define READ_TRANSMIT_POWER_LEVEL_CP_SIZE 3
961 } __attribute__ ((packed)) read_transmit_power_level_rp;
962 #define READ_TRANSMIT_POWER_LEVEL_RP_SIZE 4
964 #define OCF_READ_SYNC_FLOW_ENABLE 0x002E
966 #define OCF_WRITE_SYNC_FLOW_ENABLE 0x002F
968 #define OCF_SET_CONTROLLER_TO_HOST_FC 0x0031
970 #define OCF_HOST_BUFFER_SIZE 0x0033
974 uint16_t acl_max_pkt;
975 uint16_t sco_max_pkt;
976 } __attribute__ ((packed)) host_buffer_size_cp;
977 #define HOST_BUFFER_SIZE_CP_SIZE 7
979 #define OCF_HOST_NUM_COMP_PKTS 0x0035
982 /* variable length part */
983 } __attribute__ ((packed)) host_num_comp_pkts_cp;
984 #define HOST_NUM_COMP_PKTS_CP_SIZE 1
986 #define OCF_READ_LINK_SUPERVISION_TIMEOUT 0x0036
991 } __attribute__ ((packed)) read_link_supervision_timeout_rp;
992 #define READ_LINK_SUPERVISION_TIMEOUT_RP_SIZE 5
994 #define OCF_WRITE_LINK_SUPERVISION_TIMEOUT 0x0037
998 } __attribute__ ((packed)) write_link_supervision_timeout_cp;
999 #define WRITE_LINK_SUPERVISION_TIMEOUT_CP_SIZE 4
1003 } __attribute__ ((packed)) write_link_supervision_timeout_rp;
1004 #define WRITE_LINK_SUPERVISION_TIMEOUT_RP_SIZE 3
1006 #define OCF_READ_NUM_SUPPORTED_IAC 0x0038
1008 #define MAX_IAC_LAP 0x40
1009 #define OCF_READ_CURRENT_IAC_LAP 0x0039
1012 uint8_t num_current_iac;
1013 uint8_t lap[MAX_IAC_LAP][3];
1014 } __attribute__ ((packed)) read_current_iac_lap_rp;
1015 #define READ_CURRENT_IAC_LAP_RP_SIZE 2+3*MAX_IAC_LAP
1017 #define OCF_WRITE_CURRENT_IAC_LAP 0x003A
1019 uint8_t num_current_iac;
1020 uint8_t lap[MAX_IAC_LAP][3];
1021 } __attribute__ ((packed)) write_current_iac_lap_cp;
1022 #define WRITE_CURRENT_IAC_LAP_CP_SIZE 1+3*MAX_IAC_LAP
1024 #define OCF_READ_PAGE_SCAN_PERIOD_MODE 0x003B
1026 #define OCF_WRITE_PAGE_SCAN_PERIOD_MODE 0x003C
1028 #define OCF_READ_PAGE_SCAN_MODE 0x003D
1030 #define OCF_WRITE_PAGE_SCAN_MODE 0x003E
1032 #define OCF_SET_AFH_CLASSIFICATION 0x003F
1035 } __attribute__ ((packed)) set_afh_classification_cp;
1036 #define SET_AFH_CLASSIFICATION_CP_SIZE 10
1039 } __attribute__ ((packed)) set_afh_classification_rp;
1040 #define SET_AFH_CLASSIFICATION_RP_SIZE 1
1042 #define OCF_READ_INQUIRY_SCAN_TYPE 0x0042
1046 } __attribute__ ((packed)) read_inquiry_scan_type_rp;
1047 #define READ_INQUIRY_SCAN_TYPE_RP_SIZE 2
1049 #define OCF_WRITE_INQUIRY_SCAN_TYPE 0x0043
1052 } __attribute__ ((packed)) write_inquiry_scan_type_cp;
1053 #define WRITE_INQUIRY_SCAN_TYPE_CP_SIZE 1
1056 } __attribute__ ((packed)) write_inquiry_scan_type_rp;
1057 #define WRITE_INQUIRY_SCAN_TYPE_RP_SIZE 1
1059 #define OCF_READ_INQUIRY_MODE 0x0044
1063 } __attribute__ ((packed)) read_inquiry_mode_rp;
1064 #define READ_INQUIRY_MODE_RP_SIZE 2
1066 #define OCF_WRITE_INQUIRY_MODE 0x0045
1069 } __attribute__ ((packed)) write_inquiry_mode_cp;
1070 #define WRITE_INQUIRY_MODE_CP_SIZE 1
1073 } __attribute__ ((packed)) write_inquiry_mode_rp;
1074 #define WRITE_INQUIRY_MODE_RP_SIZE 1
1076 #define OCF_READ_PAGE_SCAN_TYPE 0x0046
1078 #define OCF_WRITE_PAGE_SCAN_TYPE 0x0047
1079 #define PAGE_SCAN_TYPE_STANDARD 0x00
1080 #define PAGE_SCAN_TYPE_INTERLACED 0x01
1082 #define OCF_READ_AFH_MODE 0x0048
1086 } __attribute__ ((packed)) read_afh_mode_rp;
1087 #define READ_AFH_MODE_RP_SIZE 2
1089 #define OCF_WRITE_AFH_MODE 0x0049
1092 } __attribute__ ((packed)) write_afh_mode_cp;
1093 #define WRITE_AFH_MODE_CP_SIZE 1
1096 } __attribute__ ((packed)) write_afh_mode_rp;
1097 #define WRITE_AFH_MODE_RP_SIZE 1
1099 #define HCI_MAX_EIR_LENGTH 240
1101 #define OCF_READ_EXT_INQUIRY_RESPONSE 0x0051
1105 uint8_t data[HCI_MAX_EIR_LENGTH];
1106 } __attribute__ ((packed)) read_ext_inquiry_response_rp;
1107 #define READ_EXT_INQUIRY_RESPONSE_RP_SIZE 242
1109 #define OCF_WRITE_EXT_INQUIRY_RESPONSE 0x0052
1112 uint8_t data[HCI_MAX_EIR_LENGTH];
1113 } __attribute__ ((packed)) write_ext_inquiry_response_cp;
1114 #define WRITE_EXT_INQUIRY_RESPONSE_CP_SIZE 241
1117 } __attribute__ ((packed)) write_ext_inquiry_response_rp;
1118 #define WRITE_EXT_INQUIRY_RESPONSE_RP_SIZE 1
1120 #define OCF_REFRESH_ENCRYPTION_KEY 0x0053
1123 } __attribute__ ((packed)) refresh_encryption_key_cp;
1124 #define REFRESH_ENCRYPTION_KEY_CP_SIZE 2
1127 } __attribute__ ((packed)) refresh_encryption_key_rp;
1128 #define REFRESH_ENCRYPTION_KEY_RP_SIZE 1
1130 #define OCF_READ_SIMPLE_PAIRING_MODE 0x0055
1134 } __attribute__ ((packed)) read_simple_pairing_mode_rp;
1135 #define READ_SIMPLE_PAIRING_MODE_RP_SIZE 2
1137 #define OCF_WRITE_SIMPLE_PAIRING_MODE 0x0056
1140 } __attribute__ ((packed)) write_simple_pairing_mode_cp;
1141 #define WRITE_SIMPLE_PAIRING_MODE_CP_SIZE 1
1144 } __attribute__ ((packed)) write_simple_pairing_mode_rp;
1145 #define WRITE_SIMPLE_PAIRING_MODE_RP_SIZE 1
1147 #define OCF_READ_LOCAL_OOB_DATA 0x0057
1151 uint8_t randomizer[16];
1152 } __attribute__ ((packed)) read_local_oob_data_rp;
1153 #define READ_LOCAL_OOB_DATA_RP_SIZE 33
1155 #define OCF_READ_INQ_RESPONSE_TX_POWER_LEVEL 0x0058
1159 } __attribute__ ((packed)) read_inq_response_tx_power_level_rp;
1160 #define READ_INQ_RESPONSE_TX_POWER_LEVEL_RP_SIZE 2
1162 #define OCF_READ_INQUIRY_TRANSMIT_POWER_LEVEL 0x0058
1166 } __attribute__ ((packed)) read_inquiry_transmit_power_level_rp;
1167 #define READ_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 2
1169 #define OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL 0x0059
1172 } __attribute__ ((packed)) write_inquiry_transmit_power_level_cp;
1173 #define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_CP_SIZE 1
1176 } __attribute__ ((packed)) write_inquiry_transmit_power_level_rp;
1177 #define WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE 1
1179 #define OCF_READ_DEFAULT_ERROR_DATA_REPORTING 0x005A
1183 } __attribute__ ((packed)) read_default_error_data_reporting_rp;
1184 #define READ_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 2
1186 #define OCF_WRITE_DEFAULT_ERROR_DATA_REPORTING 0x005B
1189 } __attribute__ ((packed)) write_default_error_data_reporting_cp;
1190 #define WRITE_DEFAULT_ERROR_DATA_REPORTING_CP_SIZE 1
1193 } __attribute__ ((packed)) write_default_error_data_reporting_rp;
1194 #define WRITE_DEFAULT_ERROR_DATA_REPORTING_RP_SIZE 1
1196 #define OCF_ENHANCED_FLUSH 0x005F
1200 } __attribute__ ((packed)) enhanced_flush_cp;
1201 #define ENHANCED_FLUSH_CP_SIZE 3
1203 #define OCF_SEND_KEYPRESS_NOTIFY 0x0060
1207 } __attribute__ ((packed)) send_keypress_notify_cp;
1208 #define SEND_KEYPRESS_NOTIFY_CP_SIZE 7
1211 } __attribute__ ((packed)) send_keypress_notify_rp;
1212 #define SEND_KEYPRESS_NOTIFY_RP_SIZE 1
1214 #define OCF_READ_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0061
1218 } __attribute__ ((packed)) read_log_link_accept_timeout_rp;
1219 #define READ_LOGICAL_LINK_ACCEPT_TIMEOUT_RP_SIZE 3
1221 #define OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT 0x0062
1224 } __attribute__ ((packed)) write_log_link_accept_timeout_cp;
1225 #define WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT_CP_SIZE 2
1227 #define OCF_SET_EVENT_MASK_PAGE_2 0x0063
1229 #define OCF_READ_LOCATION_DATA 0x0064
1231 #define OCF_WRITE_LOCATION_DATA 0x0065
1233 #define OCF_READ_FLOW_CONTROL_MODE 0x0066
1235 #define OCF_WRITE_FLOW_CONTROL_MODE 0x0067
1237 #define OCF_READ_ENHANCED_TRANSMIT_POWER_LEVEL 0x0068
1244 } __attribute__ ((packed)) read_enhanced_transmit_power_level_rp;
1245 #define READ_ENHANCED_TRANSMIT_POWER_LEVEL_RP_SIZE 6
1247 #define OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT 0x0069
1251 } __attribute__ ((packed)) read_best_effort_flush_timeout_rp;
1252 #define READ_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 5
1254 #define OCF_WRITE_BEST_EFFORT_FLUSH_TIMEOUT 0x006A
1258 } __attribute__ ((packed)) write_best_effort_flush_timeout_cp;
1259 #define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_CP_SIZE 6
1262 } __attribute__ ((packed)) write_best_effort_flush_timeout_rp;
1263 #define WRITE_BEST_EFFORT_FLUSH_TIMEOUT_RP_SIZE 1
1265 #define OCF_READ_LE_HOST_SUPPORTED 0x006C
1270 } __attribute__ ((packed)) read_le_host_supported_rp;
1271 #define READ_LE_HOST_SUPPORTED_RP_SIZE 3
1273 #define OCF_WRITE_LE_HOST_SUPPORTED 0x006D
1277 } __attribute__ ((packed)) write_le_host_supported_cp;
1278 #define WRITE_LE_HOST_SUPPORTED_CP_SIZE 2
1280 /* Informational Parameters */
1281 #define OGF_INFO_PARAM 0x04
1283 #define OCF_READ_LOCAL_VERSION 0x0001
1289 uint16_t manufacturer;
1290 uint16_t lmp_subver;
1291 } __attribute__ ((packed)) read_local_version_rp;
1292 #define READ_LOCAL_VERSION_RP_SIZE 9
1294 #define OCF_READ_LOCAL_COMMANDS 0x0002
1297 uint8_t commands[64];
1298 } __attribute__ ((packed)) read_local_commands_rp;
1299 #define READ_LOCAL_COMMANDS_RP_SIZE 65
1301 #define OCF_READ_LOCAL_FEATURES 0x0003
1304 uint8_t features[8];
1305 } __attribute__ ((packed)) read_local_features_rp;
1306 #define READ_LOCAL_FEATURES_RP_SIZE 9
1308 #define OCF_READ_LOCAL_EXT_FEATURES 0x0004
1311 } __attribute__ ((packed)) read_local_ext_features_cp;
1312 #define READ_LOCAL_EXT_FEATURES_CP_SIZE 1
1316 uint8_t max_page_num;
1317 uint8_t features[8];
1318 } __attribute__ ((packed)) read_local_ext_features_rp;
1319 #define READ_LOCAL_EXT_FEATURES_RP_SIZE 11
1321 #define OCF_READ_BUFFER_SIZE 0x0005
1326 uint16_t acl_max_pkt;
1327 uint16_t sco_max_pkt;
1328 } __attribute__ ((packed)) read_buffer_size_rp;
1329 #define READ_BUFFER_SIZE_RP_SIZE 8
1331 #define OCF_READ_COUNTRY_CODE 0x0007
1333 #define OCF_READ_BD_ADDR 0x0009
1337 } __attribute__ ((packed)) read_bd_addr_rp;
1338 #define READ_BD_ADDR_RP_SIZE 7
1340 #define OCF_READ_DATA_BLOCK_SIZE 0x000A
1343 uint16_t max_acl_len;
1344 uint16_t data_block_len;
1345 uint16_t num_blocks;
1346 } __attribute__ ((packed)) read_data_block_size_rp;
1349 #define OGF_STATUS_PARAM 0x05
1351 #define OCF_READ_FAILED_CONTACT_COUNTER 0x0001
1356 } __attribute__ ((packed)) read_failed_contact_counter_rp;
1357 #define READ_FAILED_CONTACT_COUNTER_RP_SIZE 4
1359 #define OCF_RESET_FAILED_CONTACT_COUNTER 0x0002
1363 } __attribute__ ((packed)) reset_failed_contact_counter_rp;
1364 #define RESET_FAILED_CONTACT_COUNTER_RP_SIZE 3
1366 #define OCF_READ_LINK_QUALITY 0x0003
1370 uint8_t link_quality;
1371 } __attribute__ ((packed)) read_link_quality_rp;
1372 #define READ_LINK_QUALITY_RP_SIZE 4
1374 #define OCF_READ_RSSI 0x0005
1379 } __attribute__ ((packed)) read_rssi_rp;
1380 #define READ_RSSI_RP_SIZE 4
1382 #define OCF_READ_AFH_MAP 0x0006
1388 } __attribute__ ((packed)) read_afh_map_rp;
1389 #define READ_AFH_MAP_RP_SIZE 14
1391 #define OCF_READ_CLOCK 0x0007
1394 uint8_t which_clock;
1395 } __attribute__ ((packed)) read_clock_cp;
1396 #define READ_CLOCK_CP_SIZE 3
1402 } __attribute__ ((packed)) read_clock_rp;
1403 #define READ_CLOCK_RP_SIZE 9
1405 #define OCF_READ_LOCAL_AMP_INFO 0x0009
1409 uint32_t total_bandwidth;
1410 uint32_t max_guaranteed_bandwidth;
1411 uint32_t min_latency;
1412 uint32_t max_pdu_size;
1413 uint8_t controller_type;
1415 uint16_t max_amp_assoc_length;
1416 uint32_t max_flush_timeout;
1417 uint32_t best_effort_flush_timeout;
1418 } __attribute__ ((packed)) read_local_amp_info_rp;
1419 #define READ_LOCAL_AMP_INFO_RP_SIZE 31
1421 #define OCF_READ_LOCAL_AMP_ASSOC 0x000A
1424 uint16_t length_so_far;
1425 uint16_t assoc_length;
1426 } __attribute__ ((packed)) read_local_amp_assoc_cp;
1427 #define READ_LOCAL_AMP_ASSOC_CP_SIZE 5
1432 uint8_t fragment[HCI_MAX_NAME_LENGTH];
1433 } __attribute__ ((packed)) read_local_amp_assoc_rp;
1434 #define READ_LOCAL_AMP_ASSOC_RP_SIZE 252
1436 #define OCF_WRITE_REMOTE_AMP_ASSOC 0x000B
1439 uint16_t length_so_far;
1440 uint16_t remaining_length;
1441 uint8_t fragment[HCI_MAX_NAME_LENGTH];
1442 } __attribute__ ((packed)) write_remote_amp_assoc_cp;
1443 #define WRITE_REMOTE_AMP_ASSOC_CP_SIZE 253
1447 } __attribute__ ((packed)) write_remote_amp_assoc_rp;
1448 #define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2
1450 /* Testing commands */
1451 #define OGF_TESTING_CMD 0x3e
1453 #define OCF_READ_LOOPBACK_MODE 0x0001
1455 #define OCF_WRITE_LOOPBACK_MODE 0x0002
1457 #define OCF_ENABLE_DEVICE_UNDER_TEST_MODE 0x0003
1459 #define OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE 0x0004
1462 } __attribute__ ((packed)) write_simple_pairing_debug_mode_cp;
1463 #define WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE 1
1466 } __attribute__ ((packed)) write_simple_pairing_debug_mode_rp;
1467 #define WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE 1
1470 #define OGF_LE_CTL 0x08
1472 #define OCF_LE_SET_EVENT_MASK 0x0001
1475 } __attribute__ ((packed)) le_set_event_mask_cp;
1476 #define LE_SET_EVENT_MASK_CP_SIZE 8
1478 #define OCF_LE_READ_BUFFER_SIZE 0x0002
1483 } __attribute__ ((packed)) le_read_buffer_size_rp;
1484 #define LE_READ_BUFFER_SIZE_RP_SIZE 4
1486 #define OCF_LE_READ_LOCAL_SUPPORTED_FEATURES 0x0003
1489 uint8_t features[8];
1490 } __attribute__ ((packed)) le_read_local_supported_features_rp;
1491 #define LE_READ_LOCAL_SUPPORTED_FEATURES_RP_SIZE 9
1493 #define OCF_LE_SET_RANDOM_ADDRESS 0x0005
1496 } __attribute__ ((packed)) le_set_random_address_cp;
1497 #define LE_SET_RANDOM_ADDRESS_CP_SIZE 6
1499 #define OCF_LE_SET_ADVERTISING_PARAMETERS 0x0006
1501 uint16_t min_interval;
1502 uint16_t max_interval;
1504 uint8_t own_bdaddr_type;
1505 uint8_t direct_bdaddr_type;
1506 bdaddr_t direct_bdaddr;
1509 } __attribute__ ((packed)) le_set_advertising_parameters_cp;
1510 #define LE_SET_ADVERTISING_PARAMETERS_CP_SIZE 15
1512 #define OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER 0x0007
1516 } __attribute__ ((packed)) le_read_advertising_channel_tx_power_rp;
1517 #define LE_READ_ADVERTISING_CHANNEL_TX_POWER_RP_SIZE 2
1519 #define OCF_LE_SET_ADVERTISING_DATA 0x0008
1523 } __attribute__ ((packed)) le_set_advertising_data_cp;
1524 #define LE_SET_ADVERTISING_DATA_CP_SIZE 32
1526 #define OCF_LE_SET_SCAN_RESPONSE_DATA 0x0009
1530 } __attribute__ ((packed)) le_set_scan_response_data_cp;
1531 #define LE_SET_SCAN_RESPONSE_DATA_CP_SIZE 32
1533 #define OCF_LE_SET_ADVERTISE_ENABLE 0x000A
1536 } __attribute__ ((packed)) le_set_advertise_enable_cp;
1537 #define LE_SET_ADVERTISE_ENABLE_CP_SIZE 1
1539 #define OCF_LE_SET_SCAN_PARAMETERS 0x000B
1544 uint8_t own_bdaddr_type;
1546 } __attribute__ ((packed)) le_set_scan_parameters_cp;
1547 #define LE_SET_SCAN_PARAMETERS_CP_SIZE 7
1549 #define OCF_LE_SET_SCAN_ENABLE 0x000C
1553 } __attribute__ ((packed)) le_set_scan_enable_cp;
1554 #define LE_SET_SCAN_ENABLE_CP_SIZE 2
1556 #define OCF_LE_CREATE_CONN 0x000D
1560 uint8_t initiator_filter;
1561 uint8_t peer_bdaddr_type;
1562 bdaddr_t peer_bdaddr;
1563 uint8_t own_bdaddr_type;
1564 uint16_t min_interval;
1565 uint16_t max_interval;
1567 uint16_t supervision_timeout;
1568 uint16_t min_ce_length;
1569 uint16_t max_ce_length;
1570 } __attribute__ ((packed)) le_create_connection_cp;
1571 #define LE_CREATE_CONN_CP_SIZE 25
1573 #define OCF_LE_CREATE_CONN_CANCEL 0x000E
1575 #define OCF_LE_READ_WHITE_LIST_SIZE 0x000F
1579 } __attribute__ ((packed)) le_read_white_list_size_rp;
1580 #define LE_READ_WHITE_LIST_SIZE_RP_SIZE 2
1582 #define OCF_LE_CLEAR_WHITE_LIST 0x0010
1584 #define OCF_LE_ADD_DEVICE_TO_WHITE_LIST 0x0011
1586 uint8_t bdaddr_type;
1588 } __attribute__ ((packed)) le_add_device_to_white_list_cp;
1589 #define LE_ADD_DEVICE_TO_WHITE_LIST_CP_SIZE 7
1591 #define OCF_LE_REMOVE_DEVICE_FROM_WHITE_LIST 0x0012
1593 uint8_t bdaddr_type;
1595 } __attribute__ ((packed)) le_remove_device_from_white_list_cp;
1596 #define LE_REMOVE_DEVICE_FROM_WHITE_LIST_CP_SIZE 7
1598 #define OCF_LE_CONN_UPDATE 0x0013
1601 uint16_t min_interval;
1602 uint16_t max_interval;
1604 uint16_t supervision_timeout;
1605 uint16_t min_ce_length;
1606 uint16_t max_ce_length;
1607 } __attribute__ ((packed)) le_connection_update_cp;
1608 #define LE_CONN_UPDATE_CP_SIZE 14
1610 #define OCF_LE_SET_HOST_CHANNEL_CLASSIFICATION 0x0014
1613 } __attribute__ ((packed)) le_set_host_channel_classification_cp;
1614 #define LE_SET_HOST_CHANNEL_CLASSIFICATION_CP_SIZE 5
1616 #define OCF_LE_READ_CHANNEL_MAP 0x0015
1619 } __attribute__ ((packed)) le_read_channel_map_cp;
1620 #define LE_READ_CHANNEL_MAP_CP_SIZE 2
1625 } __attribute__ ((packed)) le_read_channel_map_rp;
1626 #define LE_READ_CHANNEL_MAP_RP_SIZE 8
1628 #define OCF_LE_READ_REMOTE_USED_FEATURES 0x0016
1631 } __attribute__ ((packed)) le_read_remote_used_features_cp;
1632 #define LE_READ_REMOTE_USED_FEATURES_CP_SIZE 2
1634 #define OCF_LE_ENCRYPT 0x0017
1637 uint8_t plaintext[16];
1638 } __attribute__ ((packed)) le_encrypt_cp;
1639 #define LE_ENCRYPT_CP_SIZE 32
1643 } __attribute__ ((packed)) le_encrypt_rp;
1644 #define LE_ENCRYPT_RP_SIZE 17
1646 #define OCF_LE_RAND 0x0018
1650 } __attribute__ ((packed)) le_rand_rp;
1651 #define LE_RAND_RP_SIZE 9
1653 #define OCF_LE_START_ENCRYPTION 0x0019
1657 uint16_t diversifier;
1659 } __attribute__ ((packed)) le_start_encryption_cp;
1660 #define LE_START_ENCRYPTION_CP_SIZE 28
1662 #define OCF_LE_LTK_REPLY 0x001A
1666 } __attribute__ ((packed)) le_ltk_reply_cp;
1667 #define LE_LTK_REPLY_CP_SIZE 18
1671 } __attribute__ ((packed)) le_ltk_reply_rp;
1672 #define LE_LTK_REPLY_RP_SIZE 3
1674 #define OCF_LE_LTK_NEG_REPLY 0x001B
1677 } __attribute__ ((packed)) le_ltk_neg_reply_cp;
1678 #define LE_LTK_NEG_REPLY_CP_SIZE 2
1682 } __attribute__ ((packed)) le_ltk_neg_reply_rp;
1683 #define LE_LTK_NEG_REPLY_RP_SIZE 3
1685 #define OCF_LE_READ_SUPPORTED_STATES 0x001C
1689 } __attribute__ ((packed)) le_read_supported_states_rp;
1690 #define LE_READ_SUPPORTED_STATES_RP_SIZE 9
1692 #define OCF_LE_RECEIVER_TEST 0x001D
1695 } __attribute__ ((packed)) le_receiver_test_cp;
1696 #define LE_RECEIVER_TEST_CP_SIZE 1
1698 #define OCF_LE_TRANSMITTER_TEST 0x001E
1703 } __attribute__ ((packed)) le_transmitter_test_cp;
1704 #define LE_TRANSMITTER_TEST_CP_SIZE 3
1706 #define OCF_LE_TEST_END 0x001F
1710 } __attribute__ ((packed)) le_test_end_rp;
1711 #define LE_TEST_END_RP_SIZE 3
1713 #define OCF_LE_ADD_DEVICE_TO_RESOLV_LIST 0x0027
1715 uint8_t bdaddr_type;
1717 uint8_t peer_irk[16];
1718 uint8_t local_irk[16];
1719 } __attribute__ ((packed)) le_add_device_to_resolv_list_cp;
1720 #define LE_ADD_DEVICE_TO_RESOLV_LIST_CP_SIZE 39
1722 #define OCF_LE_REMOVE_DEVICE_FROM_RESOLV_LIST 0x0028
1724 uint8_t bdaddr_type;
1726 } __attribute__ ((packed)) le_remove_device_from_resolv_list_cp;
1727 #define LE_REMOVE_DEVICE_FROM_RESOLV_LIST_CP_SIZE 7
1729 #define OCF_LE_CLEAR_RESOLV_LIST 0x0029
1731 #define OCF_LE_READ_RESOLV_LIST_SIZE 0x002A
1735 } __attribute__ ((packed)) le_read_resolv_list_size_rp;
1736 #define LE_READ_RESOLV_LIST_SIZE_RP_SIZE 2
1738 #define OCF_LE_SET_ADDRESS_RESOLUTION_ENABLE 0x002D
1741 } __attribute__ ((packed)) le_set_address_resolution_enable_cp;
1742 #define LE_SET_ADDRESS_RESOLUTION_ENABLE_CP_SIZE 1
1744 /* Vendor specific commands */
1745 #define OGF_VENDOR_CMD 0x3f
1747 #ifdef __TIZEN_PATCH__
1748 #ifdef __BROADCOM_QOS_PATCH__
1749 #define BRCM_QOS_PRIORITY_NORMAL 0x00
1750 #define BRCM_QOS_PRIORITY_HIGH 0xFF
1751 #define BROADCOM_QOS_CMD 0xFC57 /* Only for bcm4329/bcm4330/bcm4334 chipsets */
1755 } __attribute__ ((__packed__)) broadcom_qos_cp;
1756 #define BROADCOM_QOS_CP_SIZE 3
1757 #endif /* __BROADCOM_QOS_PATCH__ */
1758 #endif /* __TIZEN_PATCH__ */
1760 /* ---- HCI Events ---- */
1762 #define EVT_INQUIRY_COMPLETE 0x01
1764 #define EVT_INQUIRY_RESULT 0x02
1767 uint8_t pscan_rep_mode;
1768 uint8_t pscan_period_mode;
1770 uint8_t dev_class[3];
1771 uint16_t clock_offset;
1772 } __attribute__ ((packed)) inquiry_info;
1773 #define INQUIRY_INFO_SIZE 14
1775 #define EVT_CONN_COMPLETE 0x03
1782 } __attribute__ ((packed)) evt_conn_complete;
1783 #define EVT_CONN_COMPLETE_SIZE 11
1785 #define EVT_CONN_REQUEST 0x04
1788 uint8_t dev_class[3];
1790 } __attribute__ ((packed)) evt_conn_request;
1791 #define EVT_CONN_REQUEST_SIZE 10
1793 #define EVT_DISCONN_COMPLETE 0x05
1798 } __attribute__ ((packed)) evt_disconn_complete;
1799 #define EVT_DISCONN_COMPLETE_SIZE 4
1801 #define EVT_AUTH_COMPLETE 0x06
1805 } __attribute__ ((packed)) evt_auth_complete;
1806 #define EVT_AUTH_COMPLETE_SIZE 3
1808 #define EVT_REMOTE_NAME_REQ_COMPLETE 0x07
1812 uint8_t name[HCI_MAX_NAME_LENGTH];
1813 } __attribute__ ((packed)) evt_remote_name_req_complete;
1814 #define EVT_REMOTE_NAME_REQ_COMPLETE_SIZE 255
1816 #define EVT_ENCRYPT_CHANGE 0x08
1821 } __attribute__ ((packed)) evt_encrypt_change;
1822 #define EVT_ENCRYPT_CHANGE_SIZE 4
1824 #define EVT_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
1828 } __attribute__ ((packed)) evt_change_conn_link_key_complete;
1829 #define EVT_CHANGE_CONN_LINK_KEY_COMPLETE_SIZE 3
1831 #define EVT_MASTER_LINK_KEY_COMPLETE 0x0A
1836 } __attribute__ ((packed)) evt_master_link_key_complete;
1837 #define EVT_MASTER_LINK_KEY_COMPLETE_SIZE 4
1839 #define EVT_READ_REMOTE_FEATURES_COMPLETE 0x0B
1843 uint8_t features[8];
1844 } __attribute__ ((packed)) evt_read_remote_features_complete;
1845 #define EVT_READ_REMOTE_FEATURES_COMPLETE_SIZE 11
1847 #define EVT_READ_REMOTE_VERSION_COMPLETE 0x0C
1852 uint16_t manufacturer;
1853 uint16_t lmp_subver;
1854 } __attribute__ ((packed)) evt_read_remote_version_complete;
1855 #define EVT_READ_REMOTE_VERSION_COMPLETE_SIZE 8
1857 #define EVT_QOS_SETUP_COMPLETE 0x0D
1861 uint8_t flags; /* Reserved */
1863 } __attribute__ ((packed)) evt_qos_setup_complete;
1864 #define EVT_QOS_SETUP_COMPLETE_SIZE (4 + HCI_QOS_CP_SIZE)
1866 #define EVT_CMD_COMPLETE 0x0E
1870 } __attribute__ ((packed)) evt_cmd_complete;
1871 #define EVT_CMD_COMPLETE_SIZE 3
1873 #define EVT_CMD_STATUS 0x0F
1878 } __attribute__ ((packed)) evt_cmd_status;
1879 #define EVT_CMD_STATUS_SIZE 4
1881 #define EVT_HARDWARE_ERROR 0x10
1884 } __attribute__ ((packed)) evt_hardware_error;
1885 #define EVT_HARDWARE_ERROR_SIZE 1
1887 #define EVT_FLUSH_OCCURRED 0x11
1890 } __attribute__ ((packed)) evt_flush_occured;
1891 #define EVT_FLUSH_OCCURRED_SIZE 2
1893 #define EVT_ROLE_CHANGE 0x12
1898 } __attribute__ ((packed)) evt_role_change;
1899 #define EVT_ROLE_CHANGE_SIZE 8
1901 #define EVT_NUM_COMP_PKTS 0x13
1904 /* variable length part */
1905 } __attribute__ ((packed)) evt_num_comp_pkts;
1906 #define EVT_NUM_COMP_PKTS_SIZE 1
1908 #define EVT_MODE_CHANGE 0x14
1914 } __attribute__ ((packed)) evt_mode_change;
1915 #define EVT_MODE_CHANGE_SIZE 6
1917 #define EVT_RETURN_LINK_KEYS 0x15
1920 /* variable length part */
1921 } __attribute__ ((packed)) evt_return_link_keys;
1922 #define EVT_RETURN_LINK_KEYS_SIZE 1
1924 #define EVT_PIN_CODE_REQ 0x16
1927 } __attribute__ ((packed)) evt_pin_code_req;
1928 #define EVT_PIN_CODE_REQ_SIZE 6
1930 #define EVT_LINK_KEY_REQ 0x17
1933 } __attribute__ ((packed)) evt_link_key_req;
1934 #define EVT_LINK_KEY_REQ_SIZE 6
1936 #define EVT_LINK_KEY_NOTIFY 0x18
1939 uint8_t link_key[16];
1941 } __attribute__ ((packed)) evt_link_key_notify;
1942 #define EVT_LINK_KEY_NOTIFY_SIZE 23
1944 #define EVT_LOOPBACK_COMMAND 0x19
1946 #define EVT_DATA_BUFFER_OVERFLOW 0x1A
1949 } __attribute__ ((packed)) evt_data_buffer_overflow;
1950 #define EVT_DATA_BUFFER_OVERFLOW_SIZE 1
1952 #define EVT_MAX_SLOTS_CHANGE 0x1B
1956 } __attribute__ ((packed)) evt_max_slots_change;
1957 #define EVT_MAX_SLOTS_CHANGE_SIZE 3
1959 #define EVT_READ_CLOCK_OFFSET_COMPLETE 0x1C
1963 uint16_t clock_offset;
1964 } __attribute__ ((packed)) evt_read_clock_offset_complete;
1965 #define EVT_READ_CLOCK_OFFSET_COMPLETE_SIZE 5
1967 #define EVT_CONN_PTYPE_CHANGED 0x1D
1972 } __attribute__ ((packed)) evt_conn_ptype_changed;
1973 #define EVT_CONN_PTYPE_CHANGED_SIZE 5
1975 #define EVT_QOS_VIOLATION 0x1E
1978 } __attribute__ ((packed)) evt_qos_violation;
1979 #define EVT_QOS_VIOLATION_SIZE 2
1981 #define EVT_PSCAN_REP_MODE_CHANGE 0x20
1984 uint8_t pscan_rep_mode;
1985 } __attribute__ ((packed)) evt_pscan_rep_mode_change;
1986 #define EVT_PSCAN_REP_MODE_CHANGE_SIZE 7
1988 #define EVT_FLOW_SPEC_COMPLETE 0x21
1995 } __attribute__ ((packed)) evt_flow_spec_complete;
1996 #define EVT_FLOW_SPEC_COMPLETE_SIZE (5 + HCI_QOS_CP_SIZE)
1998 #define EVT_INQUIRY_RESULT_WITH_RSSI 0x22
2001 uint8_t pscan_rep_mode;
2002 uint8_t pscan_period_mode;
2003 uint8_t dev_class[3];
2004 uint16_t clock_offset;
2006 } __attribute__ ((packed)) inquiry_info_with_rssi;
2007 #define INQUIRY_INFO_WITH_RSSI_SIZE 14
2010 uint8_t pscan_rep_mode;
2011 uint8_t pscan_period_mode;
2013 uint8_t dev_class[3];
2014 uint16_t clock_offset;
2016 } __attribute__ ((packed)) inquiry_info_with_rssi_and_pscan_mode;
2017 #define INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE 15
2019 #define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE 0x23
2024 uint8_t max_page_num;
2025 uint8_t features[8];
2026 } __attribute__ ((packed)) evt_read_remote_ext_features_complete;
2027 #define EVT_READ_REMOTE_EXT_FEATURES_COMPLETE_SIZE 13
2029 #define EVT_SYNC_CONN_COMPLETE 0x2C
2035 uint8_t trans_interval;
2036 uint8_t retrans_window;
2037 uint16_t rx_pkt_len;
2038 uint16_t tx_pkt_len;
2040 } __attribute__ ((packed)) evt_sync_conn_complete;
2041 #define EVT_SYNC_CONN_COMPLETE_SIZE 17
2043 #define EVT_SYNC_CONN_CHANGED 0x2D
2047 uint8_t trans_interval;
2048 uint8_t retrans_window;
2049 uint16_t rx_pkt_len;
2050 uint16_t tx_pkt_len;
2051 } __attribute__ ((packed)) evt_sync_conn_changed;
2052 #define EVT_SYNC_CONN_CHANGED_SIZE 9
2054 #define EVT_SNIFF_SUBRATING 0x2E
2058 uint16_t max_tx_latency;
2059 uint16_t max_rx_latency;
2060 uint16_t min_remote_timeout;
2061 uint16_t min_local_timeout;
2062 } __attribute__ ((packed)) evt_sniff_subrating;
2063 #define EVT_SNIFF_SUBRATING_SIZE 11
2065 #define EVT_EXTENDED_INQUIRY_RESULT 0x2F
2068 uint8_t pscan_rep_mode;
2069 uint8_t pscan_period_mode;
2070 uint8_t dev_class[3];
2071 uint16_t clock_offset;
2073 uint8_t data[HCI_MAX_EIR_LENGTH];
2074 } __attribute__ ((packed)) extended_inquiry_info;
2075 #define EXTENDED_INQUIRY_INFO_SIZE 254
2077 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE 0x30
2081 } __attribute__ ((packed)) evt_encryption_key_refresh_complete;
2082 #define EVT_ENCRYPTION_KEY_REFRESH_COMPLETE_SIZE 3
2084 #define EVT_IO_CAPABILITY_REQUEST 0x31
2087 } __attribute__ ((packed)) evt_io_capability_request;
2088 #define EVT_IO_CAPABILITY_REQUEST_SIZE 6
2090 #define EVT_IO_CAPABILITY_RESPONSE 0x32
2095 uint8_t authentication;
2096 } __attribute__ ((packed)) evt_io_capability_response;
2097 #define EVT_IO_CAPABILITY_RESPONSE_SIZE 9
2099 #define EVT_USER_CONFIRM_REQUEST 0x33
2103 } __attribute__ ((packed)) evt_user_confirm_request;
2104 #define EVT_USER_CONFIRM_REQUEST_SIZE 10
2106 #define EVT_USER_PASSKEY_REQUEST 0x34
2109 } __attribute__ ((packed)) evt_user_passkey_request;
2110 #define EVT_USER_PASSKEY_REQUEST_SIZE 6
2112 #define EVT_REMOTE_OOB_DATA_REQUEST 0x35
2115 } __attribute__ ((packed)) evt_remote_oob_data_request;
2116 #define EVT_REMOTE_OOB_DATA_REQUEST_SIZE 6
2118 #define EVT_SIMPLE_PAIRING_COMPLETE 0x36
2122 } __attribute__ ((packed)) evt_simple_pairing_complete;
2123 #define EVT_SIMPLE_PAIRING_COMPLETE_SIZE 7
2125 #define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38
2129 } __attribute__ ((packed)) evt_link_supervision_timeout_changed;
2130 #define EVT_LINK_SUPERVISION_TIMEOUT_CHANGED_SIZE 4
2132 #define EVT_ENHANCED_FLUSH_COMPLETE 0x39
2135 } __attribute__ ((packed)) evt_enhanced_flush_complete;
2136 #define EVT_ENHANCED_FLUSH_COMPLETE_SIZE 2
2138 #define EVT_USER_PASSKEY_NOTIFY 0x3B
2142 } __attribute__ ((packed)) evt_user_passkey_notify;
2143 #define EVT_USER_PASSKEY_NOTIFY_SIZE 10
2145 #define EVT_KEYPRESS_NOTIFY 0x3C
2149 } __attribute__ ((packed)) evt_keypress_notify;
2150 #define EVT_KEYPRESS_NOTIFY_SIZE 7
2152 #define EVT_REMOTE_HOST_FEATURES_NOTIFY 0x3D
2155 uint8_t features[8];
2156 } __attribute__ ((packed)) evt_remote_host_features_notify;
2157 #define EVT_REMOTE_HOST_FEATURES_NOTIFY_SIZE 14
2159 #define EVT_LE_META_EVENT 0x3E
2163 } __attribute__ ((packed)) evt_le_meta_event;
2164 #define EVT_LE_META_EVENT_SIZE 1
2166 #define EVT_LE_CONN_COMPLETE 0x01
2171 uint8_t peer_bdaddr_type;
2172 bdaddr_t peer_bdaddr;
2175 uint16_t supervision_timeout;
2176 uint8_t master_clock_accuracy;
2177 } __attribute__ ((packed)) evt_le_connection_complete;
2178 #define EVT_LE_CONN_COMPLETE_SIZE 18
2180 #define EVT_LE_ADVERTISING_REPORT 0x02
2183 uint8_t bdaddr_type;
2187 } __attribute__ ((packed)) le_advertising_info;
2188 #define LE_ADVERTISING_INFO_SIZE 9
2190 #define EVT_LE_CONN_UPDATE_COMPLETE 0x03
2196 uint16_t supervision_timeout;
2197 } __attribute__ ((packed)) evt_le_connection_update_complete;
2198 #define EVT_LE_CONN_UPDATE_COMPLETE_SIZE 9
2200 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
2204 uint8_t features[8];
2205 } __attribute__ ((packed)) evt_le_read_remote_used_features_complete;
2206 #define EVT_LE_READ_REMOTE_USED_FEATURES_COMPLETE_SIZE 11
2208 #define EVT_LE_LTK_REQUEST 0x05
2212 uint16_t diversifier;
2213 } __attribute__ ((packed)) evt_le_long_term_key_request;
2214 #define EVT_LE_LTK_REQUEST_SIZE 12
2216 #define EVT_PHYSICAL_LINK_COMPLETE 0x40
2220 } __attribute__ ((packed)) evt_physical_link_complete;
2221 #define EVT_PHYSICAL_LINK_COMPLETE_SIZE 2
2223 #define EVT_CHANNEL_SELECTED 0x41
2225 #define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE 0x42
2230 } __attribute__ ((packed)) evt_disconn_physical_link_complete;
2231 #define EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE_SIZE 3
2233 #define EVT_PHYSICAL_LINK_LOSS_EARLY_WARNING 0x43
2237 } __attribute__ ((packed)) evt_physical_link_loss_warning;
2238 #define EVT_PHYSICAL_LINK_LOSS_WARNING_SIZE 2
2240 #define EVT_PHYSICAL_LINK_RECOVERY 0x44
2243 } __attribute__ ((packed)) evt_physical_link_recovery;
2244 #define EVT_PHYSICAL_LINK_RECOVERY_SIZE 1
2246 #define EVT_LOGICAL_LINK_COMPLETE 0x45
2249 uint16_t log_handle;
2252 } __attribute__ ((packed)) evt_logical_link_complete;
2253 #define EVT_LOGICAL_LINK_COMPLETE_SIZE 5
2255 #define EVT_DISCONNECT_LOGICAL_LINK_COMPLETE 0x46
2257 #define EVT_FLOW_SPEC_MODIFY_COMPLETE 0x47
2261 } __attribute__ ((packed)) evt_flow_spec_modify_complete;
2262 #define EVT_FLOW_SPEC_MODIFY_COMPLETE_SIZE 3
2264 #define EVT_NUMBER_COMPLETED_BLOCKS 0x48
2267 uint16_t num_cmplt_pkts;
2268 uint16_t num_cmplt_blks;
2269 } __attribute__ ((packed)) cmplt_handle;
2271 uint16_t total_num_blocks;
2272 uint8_t num_handles;
2273 cmplt_handle handles[0];
2274 } __attribute__ ((packed)) evt_num_completed_blocks;
2276 #define EVT_AMP_STATUS_CHANGE 0x4D
2280 } __attribute__ ((packed)) evt_amp_status_change;
2281 #define EVT_AMP_STATUS_CHANGE_SIZE 2
2283 #define EVT_TESTING 0xFE
2285 #define EVT_VENDOR 0xFF
2287 /* Internal events generated by BlueZ stack */
2288 #define EVT_STACK_INTERNAL 0xFD
2292 } __attribute__ ((packed)) evt_stack_internal;
2293 #define EVT_STACK_INTERNAL_SIZE 2
2295 #define EVT_SI_DEVICE 0x01
2299 } __attribute__ ((packed)) evt_si_device;
2300 #define EVT_SI_DEVICE_SIZE 4
2302 /* -------- HCI Packet structures -------- */
2303 #define HCI_TYPE_LEN 1
2306 uint16_t opcode; /* OCF & OGF */
2308 } __attribute__ ((packed)) hci_command_hdr;
2309 #define HCI_COMMAND_HDR_SIZE 3
2314 } __attribute__ ((packed)) hci_event_hdr;
2315 #define HCI_EVENT_HDR_SIZE 2
2318 uint16_t handle; /* Handle & Flags(PB, BC) */
2320 } __attribute__ ((packed)) hci_acl_hdr;
2321 #define HCI_ACL_HDR_SIZE 4
2326 } __attribute__ ((packed)) hci_sco_hdr;
2327 #define HCI_SCO_HDR_SIZE 3
2333 } __attribute__ ((packed)) hci_msg_hdr;
2334 #define HCI_MSG_HDR_SIZE 6
2336 /* Command opcode pack/unpack */
2337 #define cmd_opcode_pack(ogf, ocf) (uint16_t)((ocf & 0x03ff)|(ogf << 10))
2338 #define cmd_opcode_ogf(op) (op >> 10)
2339 #define cmd_opcode_ocf(op) (op & 0x03ff)
2341 /* ACL handle and flags pack/unpack */
2342 #define acl_handle_pack(h, f) (uint16_t)((h & 0x0fff)|(f << 12))
2343 #define acl_handle(h) (h & 0x0fff)
2344 #define acl_flags(h) (h >> 12)
2346 #endif /* _NO_HCI_DEFS */
2348 /* HCI Socket options */
2349 #define HCI_DATA_DIR 1
2350 #define HCI_FILTER 2
2351 #define HCI_TIME_STAMP 3
2353 /* HCI CMSG flags */
2354 #define HCI_CMSG_DIR 0x0001
2355 #define HCI_CMSG_TSTAMP 0x0002
2357 struct sockaddr_hci {
2358 sa_family_t hci_family;
2359 unsigned short hci_dev;
2360 unsigned short hci_channel;
2362 #define HCI_DEV_NONE 0xffff
2364 #define HCI_CHANNEL_RAW 0
2365 #define HCI_CHANNEL_USER 1
2366 #define HCI_CHANNEL_MONITOR 2
2367 #define HCI_CHANNEL_CONTROL 3
2371 uint32_t event_mask[2];
2375 #define HCI_FLT_TYPE_BITS 31
2376 #define HCI_FLT_EVENT_BITS 63
2377 #define HCI_FLT_OGF_BITS 63
2378 #define HCI_FLT_OCF_BITS 127
2380 /* Ioctl requests structures */
2381 struct hci_dev_stats {
2394 struct hci_dev_info {
2403 uint8_t features[8];
2406 uint32_t link_policy;
2414 struct hci_dev_stats stat;
2417 struct hci_conn_info {
2426 struct hci_dev_req {
2431 struct hci_dev_list_req {
2433 struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
2436 struct hci_conn_list_req {
2439 struct hci_conn_info conn_info[0];
2442 struct hci_conn_info_req {
2445 struct hci_conn_info conn_info[0];
2448 struct hci_auth_info_req {
2453 struct hci_inquiry_req {
2460 #define IREQ_CACHE_FLUSH 0x0001
2466 #endif /* __HCI_H */