1 /* 2 BlueZ - Bluetooth protocol stack for Linux 3 Copyright (C) 2000-2001 Qualcomm Incorporated 4 5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License version 2 as 9 published by the Free Software Foundation; 10 11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 22 SOFTWARE IS DISCLAIMED. 23 */ 24 25 #ifndef __HCI_H 26 #define __HCI_H 27 28 #define HCI_MAX_ACL_SIZE 1024 29 #define HCI_MAX_SCO_SIZE 255 30 #define HCI_MAX_ISO_SIZE 251 31 #define HCI_MAX_EVENT_SIZE 260 32 #define HCI_MAX_FRAME_SIZE (HCI_MAX_ACL_SIZE + 4) 33 34 #define HCI_LINK_KEY_SIZE 16 35 #define HCI_AMP_LINK_KEY_SIZE (2 * HCI_LINK_KEY_SIZE) 36 37 #define HCI_MAX_AMP_ASSOC_SIZE 672 38 39 #define HCI_MAX_CSB_DATA_SIZE 252 40 41 /* HCI dev events */ 42 #define HCI_DEV_REG 1 43 #define HCI_DEV_UNREG 2 44 #define HCI_DEV_UP 3 45 #define HCI_DEV_DOWN 4 46 #define HCI_DEV_SUSPEND 5 47 #define HCI_DEV_RESUME 6 48 #define HCI_DEV_OPEN 7 49 #define HCI_DEV_CLOSE 8 50 #define HCI_DEV_SETUP 9 51 52 /* HCI notify events */ 53 #define HCI_NOTIFY_CONN_ADD 1 54 #define HCI_NOTIFY_CONN_DEL 2 55 #define HCI_NOTIFY_VOICE_SETTING 3 56 #define HCI_NOTIFY_ENABLE_SCO_CVSD 4 57 #define HCI_NOTIFY_ENABLE_SCO_TRANSP 5 58 #define HCI_NOTIFY_DISABLE_SCO 6 59 60 /* HCI bus types */ 61 #define HCI_VIRTUAL 0 62 #define HCI_USB 1 63 #define HCI_PCCARD 2 64 #define HCI_UART 3 65 #define HCI_RS232 4 66 #define HCI_PCI 5 67 #define HCI_SDIO 6 68 #define HCI_SPI 7 69 #define HCI_I2C 8 70 #define HCI_SMD 9 71 72 /* HCI controller types */ 73 #define HCI_PRIMARY 0x00 74 #define HCI_AMP 0x01 75 76 /* First BR/EDR Controller shall have ID = 0 */ 77 #define AMP_ID_BREDR 0x00 78 79 /* AMP controller types */ 80 #define AMP_TYPE_BREDR 0x00 81 #define AMP_TYPE_80211 0x01 82 83 /* AMP controller status */ 84 #define AMP_STATUS_POWERED_DOWN 0x00 85 #define AMP_STATUS_BLUETOOTH_ONLY 0x01 86 #define AMP_STATUS_NO_CAPACITY 0x02 87 #define AMP_STATUS_LOW_CAPACITY 0x03 88 #define AMP_STATUS_MEDIUM_CAPACITY 0x04 89 #define AMP_STATUS_HIGH_CAPACITY 0x05 90 #define AMP_STATUS_FULL_CAPACITY 0x06 91 92 /* HCI device quirks */ 93 enum { 94 /* When this quirk is set, the HCI Reset command is send when 95 * closing the transport instead of when opening it. 96 * 97 * This quirk must be set before hci_register_dev is called. 98 */ 99 HCI_QUIRK_RESET_ON_CLOSE, 100 101 /* When this quirk is set, the device is turned into a raw-only 102 * device and it will stay in unconfigured state. 103 * 104 * This quirk must be set before hci_register_dev is called. 105 */ 106 HCI_QUIRK_RAW_DEVICE, 107 108 /* When this quirk is set, the buffer sizes reported by 109 * HCI Read Buffer Size command are corrected if invalid. 110 * 111 * This quirk must be set before hci_register_dev is called. 112 */ 113 HCI_QUIRK_FIXUP_BUFFER_SIZE, 114 115 /* When this quirk is set, then a controller that does not 116 * indicate support for Inquiry Result with RSSI is assumed to 117 * support it anyway. Some early Bluetooth 1.2 controllers had 118 * wrongly configured local features that will require forcing 119 * them to enable this mode. Getting RSSI information with the 120 * inquiry responses is preferred since it allows for a better 121 * user experience. 122 * 123 * This quirk must be set before hci_register_dev is called. 124 */ 125 HCI_QUIRK_FIXUP_INQUIRY_MODE, 126 127 /* When this quirk is set, then the HCI Read Local Supported 128 * Commands command is not supported. In general Bluetooth 1.2 129 * and later controllers should support this command. However 130 * some controllers indicate Bluetooth 1.2 support, but do 131 * not support this command. 132 * 133 * This quirk must be set before hci_register_dev is called. 134 */ 135 HCI_QUIRK_BROKEN_LOCAL_COMMANDS, 136 137 /* When this quirk is set, then no stored link key handling 138 * is performed. This is mainly due to the fact that the 139 * HCI Delete Stored Link Key command is advertised, but 140 * not supported. 141 * 142 * This quirk must be set before hci_register_dev is called. 143 */ 144 HCI_QUIRK_BROKEN_STORED_LINK_KEY, 145 146 /* When this quirk is set, an external configuration step 147 * is required and will be indicated with the controller 148 * configuration. 149 * 150 * This quirk can be set before hci_register_dev is called or 151 * during the hdev->setup vendor callback. 152 */ 153 HCI_QUIRK_EXTERNAL_CONFIG, 154 155 /* When this quirk is set, the public Bluetooth address 156 * initially reported by HCI Read BD Address command 157 * is considered invalid. Controller configuration is 158 * required before this device can be used. 159 * 160 * This quirk can be set before hci_register_dev is called or 161 * during the hdev->setup vendor callback. 162 */ 163 HCI_QUIRK_INVALID_BDADDR, 164 165 /* When this quirk is set, the public Bluetooth address 166 * initially reported by HCI Read BD Address command 167 * is considered invalid. The public BD Address can be 168 * specified in the fwnode property 'local-bd-address'. 169 * If this property does not exist or is invalid controller 170 * configuration is required before this device can be used. 171 * 172 * This quirk can be set before hci_register_dev is called or 173 * during the hdev->setup vendor callback. 174 */ 175 HCI_QUIRK_USE_BDADDR_PROPERTY, 176 177 /* When this quirk is set, the duplicate filtering during 178 * scanning is based on Bluetooth devices addresses. To allow 179 * RSSI based updates, restart scanning if needed. 180 * 181 * This quirk can be set before hci_register_dev is called or 182 * during the hdev->setup vendor callback. 183 */ 184 HCI_QUIRK_STRICT_DUPLICATE_FILTER, 185 186 /* When this quirk is set, LE scan and BR/EDR inquiry is done 187 * simultaneously, otherwise it's interleaved. 188 * 189 * This quirk can be set before hci_register_dev is called or 190 * during the hdev->setup vendor callback. 191 */ 192 HCI_QUIRK_SIMULTANEOUS_DISCOVERY, 193 194 /* When this quirk is set, the enabling of diagnostic mode is 195 * not persistent over HCI Reset. Every time the controller 196 * is brought up it needs to be reprogrammed. 197 * 198 * This quirk can be set before hci_register_dev is called or 199 * during the hdev->setup vendor callback. 200 */ 201 HCI_QUIRK_NON_PERSISTENT_DIAG, 202 203 /* When this quirk is set, setup() would be run after every 204 * open() and not just after the first open(). 205 * 206 * This quirk can be set before hci_register_dev is called or 207 * during the hdev->setup vendor callback. 208 * 209 */ 210 HCI_QUIRK_NON_PERSISTENT_SETUP, 211 212 /* When this quirk is set, wide band speech is supported by 213 * the driver since no reliable mechanism exist to report 214 * this from the hardware, a driver flag is use to convey 215 * this support 216 * 217 * This quirk must be set before hci_register_dev is called. 218 */ 219 HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, 220 }; 221 222 /* HCI device flags */ 223 enum { 224 HCI_UP, 225 HCI_INIT, 226 HCI_RUNNING, 227 228 HCI_PSCAN, 229 HCI_ISCAN, 230 HCI_AUTH, 231 HCI_ENCRYPT, 232 HCI_INQUIRY, 233 234 HCI_RAW, 235 236 HCI_RESET, 237 }; 238 239 /* HCI socket flags */ 240 enum { 241 HCI_SOCK_TRUSTED, 242 HCI_MGMT_INDEX_EVENTS, 243 HCI_MGMT_UNCONF_INDEX_EVENTS, 244 HCI_MGMT_EXT_INDEX_EVENTS, 245 HCI_MGMT_EXT_INFO_EVENTS, 246 HCI_MGMT_OPTION_EVENTS, 247 HCI_MGMT_SETTING_EVENTS, 248 HCI_MGMT_DEV_CLASS_EVENTS, 249 HCI_MGMT_LOCAL_NAME_EVENTS, 250 HCI_MGMT_OOB_DATA_EVENTS, 251 }; 252 253 /* 254 * BR/EDR and/or LE controller flags: the flags defined here should represent 255 * states from the controller. 256 */ 257 enum { 258 HCI_SETUP, 259 HCI_CONFIG, 260 HCI_AUTO_OFF, 261 HCI_RFKILLED, 262 HCI_MGMT, 263 HCI_BONDABLE, 264 HCI_SERVICE_CACHE, 265 HCI_KEEP_DEBUG_KEYS, 266 HCI_USE_DEBUG_KEYS, 267 HCI_UNREGISTER, 268 HCI_UNCONFIGURED, 269 HCI_USER_CHANNEL, 270 HCI_EXT_CONFIGURED, 271 HCI_LE_ADV, 272 HCI_LE_SCAN, 273 HCI_SSP_ENABLED, 274 HCI_SC_ENABLED, 275 HCI_SC_ONLY, 276 HCI_PRIVACY, 277 HCI_LIMITED_PRIVACY, 278 HCI_RPA_EXPIRED, 279 HCI_RPA_RESOLVING, 280 HCI_HS_ENABLED, 281 HCI_LE_ENABLED, 282 HCI_ADVERTISING, 283 HCI_ADVERTISING_CONNECTABLE, 284 HCI_CONNECTABLE, 285 HCI_DISCOVERABLE, 286 HCI_LIMITED_DISCOVERABLE, 287 HCI_LINK_SECURITY, 288 HCI_PERIODIC_INQ, 289 HCI_FAST_CONNECTABLE, 290 HCI_BREDR_ENABLED, 291 HCI_LE_SCAN_INTERRUPTED, 292 HCI_WIDEBAND_SPEECH_ENABLED, 293 294 HCI_DUT_MODE, 295 HCI_VENDOR_DIAG, 296 HCI_FORCE_BREDR_SMP, 297 HCI_FORCE_STATIC_ADDR, 298 HCI_LL_RPA_RESOLUTION, 299 HCI_CMD_PENDING, 300 301 __HCI_NUM_FLAGS, 302 }; 303 304 /* HCI timeouts */ 305 #define HCI_DISCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 306 #define HCI_PAIRING_TIMEOUT msecs_to_jiffies(60000) /* 60 seconds */ 307 #define HCI_INIT_TIMEOUT msecs_to_jiffies(10000) /* 10 seconds */ 308 #define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 309 #define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 310 #define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 311 #define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ 312 #define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */ 313 #define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000) /* 4 seconds */ 314 315 /* HCI data types */ 316 #define HCI_COMMAND_PKT 0x01 317 #define HCI_ACLDATA_PKT 0x02 318 #define HCI_SCODATA_PKT 0x03 319 #define HCI_EVENT_PKT 0x04 320 #define HCI_ISODATA_PKT 0x05 321 #define HCI_DIAG_PKT 0xf0 322 #define HCI_VENDOR_PKT 0xff 323 324 /* HCI packet types */ 325 #define HCI_DM1 0x0008 326 #define HCI_DM3 0x0400 327 #define HCI_DM5 0x4000 328 #define HCI_DH1 0x0010 329 #define HCI_DH3 0x0800 330 #define HCI_DH5 0x8000 331 332 /* HCI packet types inverted masks */ 333 #define HCI_2DH1 0x0002 334 #define HCI_3DH1 0x0004 335 #define HCI_2DH3 0x0100 336 #define HCI_3DH3 0x0200 337 #define HCI_2DH5 0x1000 338 #define HCI_3DH5 0x2000 339 340 #define HCI_HV1 0x0020 341 #define HCI_HV2 0x0040 342 #define HCI_HV3 0x0080 343 344 #define SCO_PTYPE_MASK (HCI_HV1 | HCI_HV2 | HCI_HV3) 345 #define ACL_PTYPE_MASK (~SCO_PTYPE_MASK) 346 347 /* eSCO packet types */ 348 #define ESCO_HV1 0x0001 349 #define ESCO_HV2 0x0002 350 #define ESCO_HV3 0x0004 351 #define ESCO_EV3 0x0008 352 #define ESCO_EV4 0x0010 353 #define ESCO_EV5 0x0020 354 #define ESCO_2EV3 0x0040 355 #define ESCO_3EV3 0x0080 356 #define ESCO_2EV5 0x0100 357 #define ESCO_3EV5 0x0200 358 359 #define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 360 #define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 361 362 /* ACL flags */ 363 #define ACL_START_NO_FLUSH 0x00 364 #define ACL_CONT 0x01 365 #define ACL_START 0x02 366 #define ACL_COMPLETE 0x03 367 #define ACL_ACTIVE_BCAST 0x04 368 #define ACL_PICO_BCAST 0x08 369 370 /* ISO PB flags */ 371 #define ISO_START 0x00 372 #define ISO_CONT 0x01 373 #define ISO_SINGLE 0x02 374 #define ISO_END 0x03 375 376 /* ISO TS flags */ 377 #define ISO_TS 0x01 378 379 /* Baseband links */ 380 #define SCO_LINK 0x00 381 #define ACL_LINK 0x01 382 #define ESCO_LINK 0x02 383 /* Low Energy links do not have defined link type. Use invented one */ 384 #define LE_LINK 0x80 385 #define AMP_LINK 0x81 386 #define ISO_LINK 0x82 387 #define INVALID_LINK 0xff 388 389 /* LMP features */ 390 #define LMP_3SLOT 0x01 391 #define LMP_5SLOT 0x02 392 #define LMP_ENCRYPT 0x04 393 #define LMP_SOFFSET 0x08 394 #define LMP_TACCURACY 0x10 395 #define LMP_RSWITCH 0x20 396 #define LMP_HOLD 0x40 397 #define LMP_SNIFF 0x80 398 399 #define LMP_PARK 0x01 400 #define LMP_RSSI 0x02 401 #define LMP_QUALITY 0x04 402 #define LMP_SCO 0x08 403 #define LMP_HV2 0x10 404 #define LMP_HV3 0x20 405 #define LMP_ULAW 0x40 406 #define LMP_ALAW 0x80 407 408 #define LMP_CVSD 0x01 409 #define LMP_PSCHEME 0x02 410 #define LMP_PCONTROL 0x04 411 #define LMP_TRANSPARENT 0x08 412 413 #define LMP_EDR_2M 0x02 414 #define LMP_EDR_3M 0x04 415 #define LMP_RSSI_INQ 0x40 416 #define LMP_ESCO 0x80 417 418 #define LMP_EV4 0x01 419 #define LMP_EV5 0x02 420 #define LMP_NO_BREDR 0x20 421 #define LMP_LE 0x40 422 #define LMP_EDR_3SLOT 0x80 423 424 #define LMP_EDR_5SLOT 0x01 425 #define LMP_SNIFF_SUBR 0x02 426 #define LMP_PAUSE_ENC 0x04 427 #define LMP_EDR_ESCO_2M 0x20 428 #define LMP_EDR_ESCO_3M 0x40 429 #define LMP_EDR_3S_ESCO 0x80 430 431 #define LMP_EXT_INQ 0x01 432 #define LMP_SIMUL_LE_BR 0x02 433 #define LMP_SIMPLE_PAIR 0x08 434 #define LMP_NO_FLUSH 0x40 435 436 #define LMP_LSTO 0x01 437 #define LMP_INQ_TX_PWR 0x02 438 #define LMP_EXTFEATURES 0x80 439 440 /* Extended LMP features */ 441 #define LMP_CSB_MASTER 0x01 442 #define LMP_CSB_SLAVE 0x02 443 #define LMP_SYNC_TRAIN 0x04 444 #define LMP_SYNC_SCAN 0x08 445 446 #define LMP_SC 0x01 447 #define LMP_PING 0x02 448 449 /* Host features */ 450 #define LMP_HOST_SSP 0x01 451 #define LMP_HOST_LE 0x02 452 #define LMP_HOST_LE_BREDR 0x04 453 #define LMP_HOST_SC 0x08 454 455 /* LE features */ 456 #define HCI_LE_ENCRYPTION 0x01 457 #define HCI_LE_CONN_PARAM_REQ_PROC 0x02 458 #define HCI_LE_SLAVE_FEATURES 0x08 459 #define HCI_LE_PING 0x10 460 #define HCI_LE_DATA_LEN_EXT 0x20 461 #define HCI_LE_PHY_2M 0x01 462 #define HCI_LE_PHY_CODED 0x08 463 #define HCI_LE_EXT_ADV 0x10 464 #define HCI_LE_EXT_SCAN_POLICY 0x80 465 #define HCI_LE_PHY_2M 0x01 466 #define HCI_LE_PHY_CODED 0x08 467 #define HCI_LE_CHAN_SEL_ALG2 0x40 468 #define HCI_LE_CIS_MASTER 0x10 469 #define HCI_LE_CIS_SLAVE 0x20 470 471 /* Connection modes */ 472 #define HCI_CM_ACTIVE 0x0000 473 #define HCI_CM_HOLD 0x0001 474 #define HCI_CM_SNIFF 0x0002 475 #define HCI_CM_PARK 0x0003 476 477 /* Link policies */ 478 #define HCI_LP_RSWITCH 0x0001 479 #define HCI_LP_HOLD 0x0002 480 #define HCI_LP_SNIFF 0x0004 481 #define HCI_LP_PARK 0x0008 482 483 /* Link modes */ 484 #define HCI_LM_ACCEPT 0x8000 485 #define HCI_LM_MASTER 0x0001 486 #define HCI_LM_AUTH 0x0002 487 #define HCI_LM_ENCRYPT 0x0004 488 #define HCI_LM_TRUSTED 0x0008 489 #define HCI_LM_RELIABLE 0x0010 490 #define HCI_LM_SECURE 0x0020 491 #define HCI_LM_FIPS 0x0040 492 493 /* Authentication types */ 494 #define HCI_AT_NO_BONDING 0x00 495 #define HCI_AT_NO_BONDING_MITM 0x01 496 #define HCI_AT_DEDICATED_BONDING 0x02 497 #define HCI_AT_DEDICATED_BONDING_MITM 0x03 498 #define HCI_AT_GENERAL_BONDING 0x04 499 #define HCI_AT_GENERAL_BONDING_MITM 0x05 500 501 /* I/O capabilities */ 502 #define HCI_IO_DISPLAY_ONLY 0x00 503 #define HCI_IO_DISPLAY_YESNO 0x01 504 #define HCI_IO_KEYBOARD_ONLY 0x02 505 #define HCI_IO_NO_INPUT_OUTPUT 0x03 506 507 /* Link Key types */ 508 #define HCI_LK_COMBINATION 0x00 509 #define HCI_LK_LOCAL_UNIT 0x01 510 #define HCI_LK_REMOTE_UNIT 0x02 511 #define HCI_LK_DEBUG_COMBINATION 0x03 512 #define HCI_LK_UNAUTH_COMBINATION_P192 0x04 513 #define HCI_LK_AUTH_COMBINATION_P192 0x05 514 #define HCI_LK_CHANGED_COMBINATION 0x06 515 #define HCI_LK_UNAUTH_COMBINATION_P256 0x07 516 #define HCI_LK_AUTH_COMBINATION_P256 0x08 517 518 /* ---- HCI Error Codes ---- */ 519 #define HCI_ERROR_UNKNOWN_CONN_ID 0x02 520 #define HCI_ERROR_AUTH_FAILURE 0x05 521 #define HCI_ERROR_PIN_OR_KEY_MISSING 0x06 522 #define HCI_ERROR_MEMORY_EXCEEDED 0x07 523 #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 524 #define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d 525 #define HCI_ERROR_REJ_BAD_ADDR 0x0f 526 #define HCI_ERROR_REMOTE_USER_TERM 0x13 527 #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 528 #define HCI_ERROR_REMOTE_POWER_OFF 0x15 529 #define HCI_ERROR_LOCAL_HOST_TERM 0x16 530 #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 531 #define HCI_ERROR_INVALID_LL_PARAMS 0x1e 532 #define HCI_ERROR_UNSPECIFIED 0x1f 533 #define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c 534 535 /* Flow control modes */ 536 #define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 537 #define HCI_FLOW_CTL_MODE_BLOCK_BASED 0x01 538 539 /* The core spec defines 127 as the "not available" value */ 540 #define HCI_TX_POWER_INVALID 127 541 #define HCI_RSSI_INVALID 127 542 543 #define HCI_ROLE_MASTER 0x00 544 #define HCI_ROLE_SLAVE 0x01 545 546 /* Extended Inquiry Response field types */ 547 #define EIR_FLAGS 0x01 /* flags */ 548 #define EIR_UUID16_SOME 0x02 /* 16-bit UUID, more available */ 549 #define EIR_UUID16_ALL 0x03 /* 16-bit UUID, all listed */ 550 #define EIR_UUID32_SOME 0x04 /* 32-bit UUID, more available */ 551 #define EIR_UUID32_ALL 0x05 /* 32-bit UUID, all listed */ 552 #define EIR_UUID128_SOME 0x06 /* 128-bit UUID, more available */ 553 #define EIR_UUID128_ALL 0x07 /* 128-bit UUID, all listed */ 554 #define EIR_NAME_SHORT 0x08 /* shortened local name */ 555 #define EIR_NAME_COMPLETE 0x09 /* complete local name */ 556 #define EIR_TX_POWER 0x0A /* transmit power level */ 557 #define EIR_CLASS_OF_DEV 0x0D /* Class of Device */ 558 #define EIR_SSP_HASH_C192 0x0E /* Simple Pairing Hash C-192 */ 559 #define EIR_SSP_RAND_R192 0x0F /* Simple Pairing Randomizer R-192 */ 560 #define EIR_DEVICE_ID 0x10 /* device ID */ 561 #define EIR_APPEARANCE 0x19 /* Device appearance */ 562 #define EIR_LE_BDADDR 0x1B /* LE Bluetooth device address */ 563 #define EIR_LE_ROLE 0x1C /* LE role */ 564 #define EIR_SSP_HASH_C256 0x1D /* Simple Pairing Hash C-256 */ 565 #define EIR_SSP_RAND_R256 0x1E /* Simple Pairing Rand R-256 */ 566 #define EIR_LE_SC_CONFIRM 0x22 /* LE SC Confirmation Value */ 567 #define EIR_LE_SC_RANDOM 0x23 /* LE SC Random Value */ 568 569 /* Low Energy Advertising Flags */ 570 #define LE_AD_LIMITED 0x01 /* Limited Discoverable */ 571 #define LE_AD_GENERAL 0x02 /* General Discoverable */ 572 #define LE_AD_NO_BREDR 0x04 /* BR/EDR not supported */ 573 #define LE_AD_SIM_LE_BREDR_CTRL 0x08 /* Simultaneous LE & BR/EDR Controller */ 574 #define LE_AD_SIM_LE_BREDR_HOST 0x10 /* Simultaneous LE & BR/EDR Host */ 575 576 /* ----- HCI Commands ---- */ 577 #define HCI_OP_NOP 0x0000 578 579 #define HCI_OP_INQUIRY 0x0401 580 struct hci_cp_inquiry { 581 __u8 lap[3]; 582 __u8 length; 583 __u8 num_rsp; 584 } __packed; 585 586 #define HCI_OP_INQUIRY_CANCEL 0x0402 587 588 #define HCI_OP_PERIODIC_INQ 0x0403 589 590 #define HCI_OP_EXIT_PERIODIC_INQ 0x0404 591 592 #define HCI_OP_CREATE_CONN 0x0405 593 struct hci_cp_create_conn { 594 bdaddr_t bdaddr; 595 __le16 pkt_type; 596 __u8 pscan_rep_mode; 597 __u8 pscan_mode; 598 __le16 clock_offset; 599 __u8 role_switch; 600 } __packed; 601 602 #define HCI_OP_DISCONNECT 0x0406 603 struct hci_cp_disconnect { 604 __le16 handle; 605 __u8 reason; 606 } __packed; 607 608 #define HCI_OP_ADD_SCO 0x0407 609 struct hci_cp_add_sco { 610 __le16 handle; 611 __le16 pkt_type; 612 } __packed; 613 614 #define HCI_OP_CREATE_CONN_CANCEL 0x0408 615 struct hci_cp_create_conn_cancel { 616 bdaddr_t bdaddr; 617 } __packed; 618 619 #define HCI_OP_ACCEPT_CONN_REQ 0x0409 620 struct hci_cp_accept_conn_req { 621 bdaddr_t bdaddr; 622 __u8 role; 623 } __packed; 624 625 #define HCI_OP_REJECT_CONN_REQ 0x040a 626 struct hci_cp_reject_conn_req { 627 bdaddr_t bdaddr; 628 __u8 reason; 629 } __packed; 630 631 #define HCI_OP_LINK_KEY_REPLY 0x040b 632 struct hci_cp_link_key_reply { 633 bdaddr_t bdaddr; 634 __u8 link_key[HCI_LINK_KEY_SIZE]; 635 } __packed; 636 637 #define HCI_OP_LINK_KEY_NEG_REPLY 0x040c 638 struct hci_cp_link_key_neg_reply { 639 bdaddr_t bdaddr; 640 } __packed; 641 642 #define HCI_OP_PIN_CODE_REPLY 0x040d 643 struct hci_cp_pin_code_reply { 644 bdaddr_t bdaddr; 645 __u8 pin_len; 646 __u8 pin_code[16]; 647 } __packed; 648 struct hci_rp_pin_code_reply { 649 __u8 status; 650 bdaddr_t bdaddr; 651 } __packed; 652 653 #define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 654 struct hci_cp_pin_code_neg_reply { 655 bdaddr_t bdaddr; 656 } __packed; 657 struct hci_rp_pin_code_neg_reply { 658 __u8 status; 659 bdaddr_t bdaddr; 660 } __packed; 661 662 #define HCI_OP_CHANGE_CONN_PTYPE 0x040f 663 struct hci_cp_change_conn_ptype { 664 __le16 handle; 665 __le16 pkt_type; 666 } __packed; 667 668 #define HCI_OP_AUTH_REQUESTED 0x0411 669 struct hci_cp_auth_requested { 670 __le16 handle; 671 } __packed; 672 673 #define HCI_OP_SET_CONN_ENCRYPT 0x0413 674 struct hci_cp_set_conn_encrypt { 675 __le16 handle; 676 __u8 encrypt; 677 } __packed; 678 679 #define HCI_OP_CHANGE_CONN_LINK_KEY 0x0415 680 struct hci_cp_change_conn_link_key { 681 __le16 handle; 682 } __packed; 683 684 #define HCI_OP_REMOTE_NAME_REQ 0x0419 685 struct hci_cp_remote_name_req { 686 bdaddr_t bdaddr; 687 __u8 pscan_rep_mode; 688 __u8 pscan_mode; 689 __le16 clock_offset; 690 } __packed; 691 692 #define HCI_OP_REMOTE_NAME_REQ_CANCEL 0x041a 693 struct hci_cp_remote_name_req_cancel { 694 bdaddr_t bdaddr; 695 } __packed; 696 697 #define HCI_OP_READ_REMOTE_FEATURES 0x041b 698 struct hci_cp_read_remote_features { 699 __le16 handle; 700 } __packed; 701 702 #define HCI_OP_READ_REMOTE_EXT_FEATURES 0x041c 703 struct hci_cp_read_remote_ext_features { 704 __le16 handle; 705 __u8 page; 706 } __packed; 707 708 #define HCI_OP_READ_REMOTE_VERSION 0x041d 709 struct hci_cp_read_remote_version { 710 __le16 handle; 711 } __packed; 712 713 #define HCI_OP_READ_CLOCK_OFFSET 0x041f 714 struct hci_cp_read_clock_offset { 715 __le16 handle; 716 } __packed; 717 718 #define HCI_OP_SETUP_SYNC_CONN 0x0428 719 struct hci_cp_setup_sync_conn { 720 __le16 handle; 721 __le32 tx_bandwidth; 722 __le32 rx_bandwidth; 723 __le16 max_latency; 724 __le16 voice_setting; 725 __u8 retrans_effort; 726 __le16 pkt_type; 727 } __packed; 728 729 #define HCI_OP_ACCEPT_SYNC_CONN_REQ 0x0429 730 struct hci_cp_accept_sync_conn_req { 731 bdaddr_t bdaddr; 732 __le32 tx_bandwidth; 733 __le32 rx_bandwidth; 734 __le16 max_latency; 735 __le16 content_format; 736 __u8 retrans_effort; 737 __le16 pkt_type; 738 } __packed; 739 740 #define HCI_OP_REJECT_SYNC_CONN_REQ 0x042a 741 struct hci_cp_reject_sync_conn_req { 742 bdaddr_t bdaddr; 743 __u8 reason; 744 } __packed; 745 746 #define HCI_OP_IO_CAPABILITY_REPLY 0x042b 747 struct hci_cp_io_capability_reply { 748 bdaddr_t bdaddr; 749 __u8 capability; 750 __u8 oob_data; 751 __u8 authentication; 752 } __packed; 753 754 #define HCI_OP_USER_CONFIRM_REPLY 0x042c 755 struct hci_cp_user_confirm_reply { 756 bdaddr_t bdaddr; 757 } __packed; 758 struct hci_rp_user_confirm_reply { 759 __u8 status; 760 bdaddr_t bdaddr; 761 } __packed; 762 763 #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d 764 765 #define HCI_OP_USER_PASSKEY_REPLY 0x042e 766 struct hci_cp_user_passkey_reply { 767 bdaddr_t bdaddr; 768 __le32 passkey; 769 } __packed; 770 771 #define HCI_OP_USER_PASSKEY_NEG_REPLY 0x042f 772 773 #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 774 struct hci_cp_remote_oob_data_reply { 775 bdaddr_t bdaddr; 776 __u8 hash[16]; 777 __u8 rand[16]; 778 } __packed; 779 780 #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 781 struct hci_cp_remote_oob_data_neg_reply { 782 bdaddr_t bdaddr; 783 } __packed; 784 785 #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 786 struct hci_cp_io_capability_neg_reply { 787 bdaddr_t bdaddr; 788 __u8 reason; 789 } __packed; 790 791 #define HCI_OP_CREATE_PHY_LINK 0x0435 792 struct hci_cp_create_phy_link { 793 __u8 phy_handle; 794 __u8 key_len; 795 __u8 key_type; 796 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 797 } __packed; 798 799 #define HCI_OP_ACCEPT_PHY_LINK 0x0436 800 struct hci_cp_accept_phy_link { 801 __u8 phy_handle; 802 __u8 key_len; 803 __u8 key_type; 804 __u8 key[HCI_AMP_LINK_KEY_SIZE]; 805 } __packed; 806 807 #define HCI_OP_DISCONN_PHY_LINK 0x0437 808 struct hci_cp_disconn_phy_link { 809 __u8 phy_handle; 810 __u8 reason; 811 } __packed; 812 813 struct ext_flow_spec { 814 __u8 id; 815 __u8 stype; 816 __le16 msdu; 817 __le32 sdu_itime; 818 __le32 acc_lat; 819 __le32 flush_to; 820 } __packed; 821 822 #define HCI_OP_CREATE_LOGICAL_LINK 0x0438 823 #define HCI_OP_ACCEPT_LOGICAL_LINK 0x0439 824 struct hci_cp_create_accept_logical_link { 825 __u8 phy_handle; 826 struct ext_flow_spec tx_flow_spec; 827 struct ext_flow_spec rx_flow_spec; 828 } __packed; 829 830 #define HCI_OP_DISCONN_LOGICAL_LINK 0x043a 831 struct hci_cp_disconn_logical_link { 832 __le16 log_handle; 833 } __packed; 834 835 #define HCI_OP_LOGICAL_LINK_CANCEL 0x043b 836 struct hci_cp_logical_link_cancel { 837 __u8 phy_handle; 838 __u8 flow_spec_id; 839 } __packed; 840 841 struct hci_rp_logical_link_cancel { 842 __u8 status; 843 __u8 phy_handle; 844 __u8 flow_spec_id; 845 } __packed; 846 847 #define HCI_OP_SET_CSB 0x0441 848 struct hci_cp_set_csb { 849 __u8 enable; 850 __u8 lt_addr; 851 __u8 lpo_allowed; 852 __le16 packet_type; 853 __le16 interval_min; 854 __le16 interval_max; 855 __le16 csb_sv_tout; 856 } __packed; 857 struct hci_rp_set_csb { 858 __u8 status; 859 __u8 lt_addr; 860 __le16 interval; 861 } __packed; 862 863 #define HCI_OP_START_SYNC_TRAIN 0x0443 864 865 #define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445 866 struct hci_cp_remote_oob_ext_data_reply { 867 bdaddr_t bdaddr; 868 __u8 hash192[16]; 869 __u8 rand192[16]; 870 __u8 hash256[16]; 871 __u8 rand256[16]; 872 } __packed; 873 874 #define HCI_OP_SNIFF_MODE 0x0803 875 struct hci_cp_sniff_mode { 876 __le16 handle; 877 __le16 max_interval; 878 __le16 min_interval; 879 __le16 attempt; 880 __le16 timeout; 881 } __packed; 882 883 #define HCI_OP_EXIT_SNIFF_MODE 0x0804 884 struct hci_cp_exit_sniff_mode { 885 __le16 handle; 886 } __packed; 887 888 #define HCI_OP_ROLE_DISCOVERY 0x0809 889 struct hci_cp_role_discovery { 890 __le16 handle; 891 } __packed; 892 struct hci_rp_role_discovery { 893 __u8 status; 894 __le16 handle; 895 __u8 role; 896 } __packed; 897 898 #define HCI_OP_SWITCH_ROLE 0x080b 899 struct hci_cp_switch_role { 900 bdaddr_t bdaddr; 901 __u8 role; 902 } __packed; 903 904 #define HCI_OP_READ_LINK_POLICY 0x080c 905 struct hci_cp_read_link_policy { 906 __le16 handle; 907 } __packed; 908 struct hci_rp_read_link_policy { 909 __u8 status; 910 __le16 handle; 911 __le16 policy; 912 } __packed; 913 914 #define HCI_OP_WRITE_LINK_POLICY 0x080d 915 struct hci_cp_write_link_policy { 916 __le16 handle; 917 __le16 policy; 918 } __packed; 919 struct hci_rp_write_link_policy { 920 __u8 status; 921 __le16 handle; 922 } __packed; 923 924 #define HCI_OP_READ_DEF_LINK_POLICY 0x080e 925 struct hci_rp_read_def_link_policy { 926 __u8 status; 927 __le16 policy; 928 } __packed; 929 930 #define HCI_OP_WRITE_DEF_LINK_POLICY 0x080f 931 struct hci_cp_write_def_link_policy { 932 __le16 policy; 933 } __packed; 934 935 #define HCI_OP_SNIFF_SUBRATE 0x0811 936 struct hci_cp_sniff_subrate { 937 __le16 handle; 938 __le16 max_latency; 939 __le16 min_remote_timeout; 940 __le16 min_local_timeout; 941 } __packed; 942 943 #define HCI_OP_SET_EVENT_MASK 0x0c01 944 945 #define HCI_OP_RESET 0x0c03 946 947 #define HCI_OP_SET_EVENT_FLT 0x0c05 948 #define HCI_SET_EVENT_FLT_SIZE 9 949 struct hci_cp_set_event_filter { 950 __u8 flt_type; 951 __u8 cond_type; 952 struct { 953 bdaddr_t bdaddr; 954 __u8 auto_accept; 955 } __packed addr_conn_flt; 956 } __packed; 957 958 /* Filter types */ 959 #define HCI_FLT_CLEAR_ALL 0x00 960 #define HCI_FLT_INQ_RESULT 0x01 961 #define HCI_FLT_CONN_SETUP 0x02 962 963 /* CONN_SETUP Condition types */ 964 #define HCI_CONN_SETUP_ALLOW_ALL 0x00 965 #define HCI_CONN_SETUP_ALLOW_CLASS 0x01 966 #define HCI_CONN_SETUP_ALLOW_BDADDR 0x02 967 968 /* CONN_SETUP Conditions */ 969 #define HCI_CONN_SETUP_AUTO_OFF 0x01 970 #define HCI_CONN_SETUP_AUTO_ON 0x02 971 #define HCI_CONN_SETUP_AUTO_ON_WITH_RS 0x03 972 973 #define HCI_OP_READ_STORED_LINK_KEY 0x0c0d 974 struct hci_cp_read_stored_link_key { 975 bdaddr_t bdaddr; 976 __u8 read_all; 977 } __packed; 978 struct hci_rp_read_stored_link_key { 979 __u8 status; 980 __u8 max_keys; 981 __u8 num_keys; 982 } __packed; 983 984 #define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12 985 struct hci_cp_delete_stored_link_key { 986 bdaddr_t bdaddr; 987 __u8 delete_all; 988 } __packed; 989 struct hci_rp_delete_stored_link_key { 990 __u8 status; 991 __u8 num_keys; 992 } __packed; 993 994 #define HCI_MAX_NAME_LENGTH 248 995 996 #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 997 struct hci_cp_write_local_name { 998 __u8 name[HCI_MAX_NAME_LENGTH]; 999 } __packed; 1000 1001 #define HCI_OP_READ_LOCAL_NAME 0x0c14 1002 struct hci_rp_read_local_name { 1003 __u8 status; 1004 __u8 name[HCI_MAX_NAME_LENGTH]; 1005 } __packed; 1006 1007 #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 1008 1009 #define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 1010 1011 #define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 1012 #define SCAN_DISABLED 0x00 1013 #define SCAN_INQUIRY 0x01 1014 #define SCAN_PAGE 0x02 1015 1016 #define HCI_OP_READ_AUTH_ENABLE 0x0c1f 1017 1018 #define HCI_OP_WRITE_AUTH_ENABLE 0x0c20 1019 #define AUTH_DISABLED 0x00 1020 #define AUTH_ENABLED 0x01 1021 1022 #define HCI_OP_READ_ENCRYPT_MODE 0x0c21 1023 1024 #define HCI_OP_WRITE_ENCRYPT_MODE 0x0c22 1025 #define ENCRYPT_DISABLED 0x00 1026 #define ENCRYPT_P2P 0x01 1027 #define ENCRYPT_BOTH 0x02 1028 1029 #define HCI_OP_READ_CLASS_OF_DEV 0x0c23 1030 struct hci_rp_read_class_of_dev { 1031 __u8 status; 1032 __u8 dev_class[3]; 1033 } __packed; 1034 1035 #define HCI_OP_WRITE_CLASS_OF_DEV 0x0c24 1036 struct hci_cp_write_class_of_dev { 1037 __u8 dev_class[3]; 1038 } __packed; 1039 1040 #define HCI_OP_READ_VOICE_SETTING 0x0c25 1041 struct hci_rp_read_voice_setting { 1042 __u8 status; 1043 __le16 voice_setting; 1044 } __packed; 1045 1046 #define HCI_OP_WRITE_VOICE_SETTING 0x0c26 1047 struct hci_cp_write_voice_setting { 1048 __le16 voice_setting; 1049 } __packed; 1050 1051 #define HCI_OP_HOST_BUFFER_SIZE 0x0c33 1052 struct hci_cp_host_buffer_size { 1053 __le16 acl_mtu; 1054 __u8 sco_mtu; 1055 __le16 acl_max_pkt; 1056 __le16 sco_max_pkt; 1057 } __packed; 1058 1059 #define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38 1060 struct hci_rp_read_num_supported_iac { 1061 __u8 status; 1062 __u8 num_iac; 1063 } __packed; 1064 1065 #define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39 1066 1067 #define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a 1068 struct hci_cp_write_current_iac_lap { 1069 __u8 num_iac; 1070 __u8 iac_lap[6]; 1071 } __packed; 1072 1073 #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 1074 1075 #define HCI_MAX_EIR_LENGTH 240 1076 1077 #define HCI_OP_WRITE_EIR 0x0c52 1078 struct hci_cp_write_eir { 1079 __u8 fec; 1080 __u8 data[HCI_MAX_EIR_LENGTH]; 1081 } __packed; 1082 1083 #define HCI_OP_READ_SSP_MODE 0x0c55 1084 struct hci_rp_read_ssp_mode { 1085 __u8 status; 1086 __u8 mode; 1087 } __packed; 1088 1089 #define HCI_OP_WRITE_SSP_MODE 0x0c56 1090 struct hci_cp_write_ssp_mode { 1091 __u8 mode; 1092 } __packed; 1093 1094 #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 1095 struct hci_rp_read_local_oob_data { 1096 __u8 status; 1097 __u8 hash[16]; 1098 __u8 rand[16]; 1099 } __packed; 1100 1101 #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 1102 struct hci_rp_read_inq_rsp_tx_power { 1103 __u8 status; 1104 __s8 tx_power; 1105 } __packed; 1106 1107 #define HCI_OP_READ_DEF_ERR_DATA_REPORTING 0x0c5a 1108 #define ERR_DATA_REPORTING_DISABLED 0x00 1109 #define ERR_DATA_REPORTING_ENABLED 0x01 1110 struct hci_rp_read_def_err_data_reporting { 1111 __u8 status; 1112 __u8 err_data_reporting; 1113 } __packed; 1114 1115 #define HCI_OP_WRITE_DEF_ERR_DATA_REPORTING 0x0c5b 1116 struct hci_cp_write_def_err_data_reporting { 1117 __u8 err_data_reporting; 1118 } __packed; 1119 1120 #define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63 1121 1122 #define HCI_OP_READ_LOCATION_DATA 0x0c64 1123 1124 #define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 1125 struct hci_rp_read_flow_control_mode { 1126 __u8 status; 1127 __u8 mode; 1128 } __packed; 1129 1130 #define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d 1131 struct hci_cp_write_le_host_supported { 1132 __u8 le; 1133 __u8 simul; 1134 } __packed; 1135 1136 #define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74 1137 struct hci_cp_set_reserved_lt_addr { 1138 __u8 lt_addr; 1139 } __packed; 1140 struct hci_rp_set_reserved_lt_addr { 1141 __u8 status; 1142 __u8 lt_addr; 1143 } __packed; 1144 1145 #define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75 1146 struct hci_cp_delete_reserved_lt_addr { 1147 __u8 lt_addr; 1148 } __packed; 1149 struct hci_rp_delete_reserved_lt_addr { 1150 __u8 status; 1151 __u8 lt_addr; 1152 } __packed; 1153 1154 #define HCI_OP_SET_CSB_DATA 0x0c76 1155 struct hci_cp_set_csb_data { 1156 __u8 lt_addr; 1157 __u8 fragment; 1158 __u8 data_length; 1159 __u8 data[HCI_MAX_CSB_DATA_SIZE]; 1160 } __packed; 1161 struct hci_rp_set_csb_data { 1162 __u8 status; 1163 __u8 lt_addr; 1164 } __packed; 1165 1166 #define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77 1167 1168 #define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78 1169 struct hci_cp_write_sync_train_params { 1170 __le16 interval_min; 1171 __le16 interval_max; 1172 __le32 sync_train_tout; 1173 __u8 service_data; 1174 } __packed; 1175 struct hci_rp_write_sync_train_params { 1176 __u8 status; 1177 __le16 sync_train_int; 1178 } __packed; 1179 1180 #define HCI_OP_READ_SC_SUPPORT 0x0c79 1181 struct hci_rp_read_sc_support { 1182 __u8 status; 1183 __u8 support; 1184 } __packed; 1185 1186 #define HCI_OP_WRITE_SC_SUPPORT 0x0c7a 1187 struct hci_cp_write_sc_support { 1188 __u8 support; 1189 } __packed; 1190 1191 #define HCI_OP_READ_AUTH_PAYLOAD_TO 0x0c7b 1192 struct hci_cp_read_auth_payload_to { 1193 __le16 handle; 1194 } __packed; 1195 struct hci_rp_read_auth_payload_to { 1196 __u8 status; 1197 __le16 handle; 1198 __le16 timeout; 1199 } __packed; 1200 1201 #define HCI_OP_WRITE_AUTH_PAYLOAD_TO 0x0c7c 1202 struct hci_cp_write_auth_payload_to { 1203 __le16 handle; 1204 __le16 timeout; 1205 } __packed; 1206 struct hci_rp_write_auth_payload_to { 1207 __u8 status; 1208 __le16 handle; 1209 } __packed; 1210 1211 #define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d 1212 struct hci_rp_read_local_oob_ext_data { 1213 __u8 status; 1214 __u8 hash192[16]; 1215 __u8 rand192[16]; 1216 __u8 hash256[16]; 1217 __u8 rand256[16]; 1218 } __packed; 1219 1220 #define HCI_OP_READ_LOCAL_VERSION 0x1001 1221 struct hci_rp_read_local_version { 1222 __u8 status; 1223 __u8 hci_ver; 1224 __le16 hci_rev; 1225 __u8 lmp_ver; 1226 __le16 manufacturer; 1227 __le16 lmp_subver; 1228 } __packed; 1229 1230 #define HCI_OP_READ_LOCAL_COMMANDS 0x1002 1231 struct hci_rp_read_local_commands { 1232 __u8 status; 1233 __u8 commands[64]; 1234 } __packed; 1235 1236 #define HCI_OP_READ_LOCAL_FEATURES 0x1003 1237 struct hci_rp_read_local_features { 1238 __u8 status; 1239 __u8 features[8]; 1240 } __packed; 1241 1242 #define HCI_OP_READ_LOCAL_EXT_FEATURES 0x1004 1243 struct hci_cp_read_local_ext_features { 1244 __u8 page; 1245 } __packed; 1246 struct hci_rp_read_local_ext_features { 1247 __u8 status; 1248 __u8 page; 1249 __u8 max_page; 1250 __u8 features[8]; 1251 } __packed; 1252 1253 #define HCI_OP_READ_BUFFER_SIZE 0x1005 1254 struct hci_rp_read_buffer_size { 1255 __u8 status; 1256 __le16 acl_mtu; 1257 __u8 sco_mtu; 1258 __le16 acl_max_pkt; 1259 __le16 sco_max_pkt; 1260 } __packed; 1261 1262 #define HCI_OP_READ_BD_ADDR 0x1009 1263 struct hci_rp_read_bd_addr { 1264 __u8 status; 1265 bdaddr_t bdaddr; 1266 } __packed; 1267 1268 #define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a 1269 struct hci_rp_read_data_block_size { 1270 __u8 status; 1271 __le16 max_acl_len; 1272 __le16 block_len; 1273 __le16 num_blocks; 1274 } __packed; 1275 1276 #define HCI_OP_READ_LOCAL_CODECS 0x100b 1277 1278 #define HCI_OP_READ_LOCAL_PAIRING_OPTS 0x100c 1279 struct hci_rp_read_local_pairing_opts { 1280 __u8 status; 1281 __u8 pairing_opts; 1282 __u8 max_key_size; 1283 } __packed; 1284 1285 #define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b 1286 struct hci_rp_read_page_scan_activity { 1287 __u8 status; 1288 __le16 interval; 1289 __le16 window; 1290 } __packed; 1291 1292 #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c 1293 struct hci_cp_write_page_scan_activity { 1294 __le16 interval; 1295 __le16 window; 1296 } __packed; 1297 1298 #define HCI_OP_READ_TX_POWER 0x0c2d 1299 struct hci_cp_read_tx_power { 1300 __le16 handle; 1301 __u8 type; 1302 } __packed; 1303 struct hci_rp_read_tx_power { 1304 __u8 status; 1305 __le16 handle; 1306 __s8 tx_power; 1307 } __packed; 1308 1309 #define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 1310 struct hci_rp_read_page_scan_type { 1311 __u8 status; 1312 __u8 type; 1313 } __packed; 1314 1315 #define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47 1316 #define PAGE_SCAN_TYPE_STANDARD 0x00 1317 #define PAGE_SCAN_TYPE_INTERLACED 0x01 1318 1319 #define HCI_OP_READ_RSSI 0x1405 1320 struct hci_cp_read_rssi { 1321 __le16 handle; 1322 } __packed; 1323 struct hci_rp_read_rssi { 1324 __u8 status; 1325 __le16 handle; 1326 __s8 rssi; 1327 } __packed; 1328 1329 #define HCI_OP_READ_CLOCK 0x1407 1330 struct hci_cp_read_clock { 1331 __le16 handle; 1332 __u8 which; 1333 } __packed; 1334 struct hci_rp_read_clock { 1335 __u8 status; 1336 __le16 handle; 1337 __le32 clock; 1338 __le16 accuracy; 1339 } __packed; 1340 1341 #define HCI_OP_READ_ENC_KEY_SIZE 0x1408 1342 struct hci_cp_read_enc_key_size { 1343 __le16 handle; 1344 } __packed; 1345 struct hci_rp_read_enc_key_size { 1346 __u8 status; 1347 __le16 handle; 1348 __u8 key_size; 1349 } __packed; 1350 1351 #define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1352 struct hci_rp_read_local_amp_info { 1353 __u8 status; 1354 __u8 amp_status; 1355 __le32 total_bw; 1356 __le32 max_bw; 1357 __le32 min_latency; 1358 __le32 max_pdu; 1359 __u8 amp_type; 1360 __le16 pal_cap; 1361 __le16 max_assoc_size; 1362 __le32 max_flush_to; 1363 __le32 be_flush_to; 1364 } __packed; 1365 1366 #define HCI_OP_READ_LOCAL_AMP_ASSOC 0x140a 1367 struct hci_cp_read_local_amp_assoc { 1368 __u8 phy_handle; 1369 __le16 len_so_far; 1370 __le16 max_len; 1371 } __packed; 1372 struct hci_rp_read_local_amp_assoc { 1373 __u8 status; 1374 __u8 phy_handle; 1375 __le16 rem_len; 1376 __u8 frag[]; 1377 } __packed; 1378 1379 #define HCI_OP_WRITE_REMOTE_AMP_ASSOC 0x140b 1380 struct hci_cp_write_remote_amp_assoc { 1381 __u8 phy_handle; 1382 __le16 len_so_far; 1383 __le16 rem_len; 1384 __u8 frag[]; 1385 } __packed; 1386 struct hci_rp_write_remote_amp_assoc { 1387 __u8 status; 1388 __u8 phy_handle; 1389 } __packed; 1390 1391 #define HCI_OP_GET_MWS_TRANSPORT_CONFIG 0x140c 1392 1393 #define HCI_OP_ENABLE_DUT_MODE 0x1803 1394 1395 #define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804 1396 1397 #define HCI_OP_LE_SET_EVENT_MASK 0x2001 1398 struct hci_cp_le_set_event_mask { 1399 __u8 mask[8]; 1400 } __packed; 1401 1402 #define HCI_OP_LE_READ_BUFFER_SIZE 0x2002 1403 struct hci_rp_le_read_buffer_size { 1404 __u8 status; 1405 __le16 le_mtu; 1406 __u8 le_max_pkt; 1407 } __packed; 1408 1409 #define HCI_OP_LE_READ_LOCAL_FEATURES 0x2003 1410 struct hci_rp_le_read_local_features { 1411 __u8 status; 1412 __u8 features[8]; 1413 } __packed; 1414 1415 #define HCI_OP_LE_SET_RANDOM_ADDR 0x2005 1416 1417 #define HCI_OP_LE_SET_ADV_PARAM 0x2006 1418 struct hci_cp_le_set_adv_param { 1419 __le16 min_interval; 1420 __le16 max_interval; 1421 __u8 type; 1422 __u8 own_address_type; 1423 __u8 direct_addr_type; 1424 bdaddr_t direct_addr; 1425 __u8 channel_map; 1426 __u8 filter_policy; 1427 } __packed; 1428 1429 #define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1430 struct hci_rp_le_read_adv_tx_power { 1431 __u8 status; 1432 __s8 tx_power; 1433 } __packed; 1434 1435 #define HCI_MAX_AD_LENGTH 31 1436 1437 #define HCI_OP_LE_SET_ADV_DATA 0x2008 1438 struct hci_cp_le_set_adv_data { 1439 __u8 length; 1440 __u8 data[HCI_MAX_AD_LENGTH]; 1441 } __packed; 1442 1443 #define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009 1444 struct hci_cp_le_set_scan_rsp_data { 1445 __u8 length; 1446 __u8 data[HCI_MAX_AD_LENGTH]; 1447 } __packed; 1448 1449 #define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1450 1451 #define LE_SCAN_PASSIVE 0x00 1452 #define LE_SCAN_ACTIVE 0x01 1453 1454 #define HCI_OP_LE_SET_SCAN_PARAM 0x200b 1455 struct hci_cp_le_set_scan_param { 1456 __u8 type; 1457 __le16 interval; 1458 __le16 window; 1459 __u8 own_address_type; 1460 __u8 filter_policy; 1461 } __packed; 1462 1463 #define LE_SCAN_DISABLE 0x00 1464 #define LE_SCAN_ENABLE 0x01 1465 #define LE_SCAN_FILTER_DUP_DISABLE 0x00 1466 #define LE_SCAN_FILTER_DUP_ENABLE 0x01 1467 1468 #define HCI_OP_LE_SET_SCAN_ENABLE 0x200c 1469 struct hci_cp_le_set_scan_enable { 1470 __u8 enable; 1471 __u8 filter_dup; 1472 } __packed; 1473 1474 #define HCI_LE_USE_PEER_ADDR 0x00 1475 #define HCI_LE_USE_WHITELIST 0x01 1476 1477 #define HCI_OP_LE_CREATE_CONN 0x200d 1478 struct hci_cp_le_create_conn { 1479 __le16 scan_interval; 1480 __le16 scan_window; 1481 __u8 filter_policy; 1482 __u8 peer_addr_type; 1483 bdaddr_t peer_addr; 1484 __u8 own_address_type; 1485 __le16 conn_interval_min; 1486 __le16 conn_interval_max; 1487 __le16 conn_latency; 1488 __le16 supervision_timeout; 1489 __le16 min_ce_len; 1490 __le16 max_ce_len; 1491 } __packed; 1492 1493 #define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e 1494 1495 #define HCI_OP_LE_READ_WHITE_LIST_SIZE 0x200f 1496 struct hci_rp_le_read_white_list_size { 1497 __u8 status; 1498 __u8 size; 1499 } __packed; 1500 1501 #define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010 1502 1503 #define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011 1504 struct hci_cp_le_add_to_white_list { 1505 __u8 bdaddr_type; 1506 bdaddr_t bdaddr; 1507 } __packed; 1508 1509 #define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012 1510 struct hci_cp_le_del_from_white_list { 1511 __u8 bdaddr_type; 1512 bdaddr_t bdaddr; 1513 } __packed; 1514 1515 #define HCI_OP_LE_CONN_UPDATE 0x2013 1516 struct hci_cp_le_conn_update { 1517 __le16 handle; 1518 __le16 conn_interval_min; 1519 __le16 conn_interval_max; 1520 __le16 conn_latency; 1521 __le16 supervision_timeout; 1522 __le16 min_ce_len; 1523 __le16 max_ce_len; 1524 } __packed; 1525 1526 #define HCI_OP_LE_READ_REMOTE_FEATURES 0x2016 1527 struct hci_cp_le_read_remote_features { 1528 __le16 handle; 1529 } __packed; 1530 1531 #define HCI_OP_LE_START_ENC 0x2019 1532 struct hci_cp_le_start_enc { 1533 __le16 handle; 1534 __le64 rand; 1535 __le16 ediv; 1536 __u8 ltk[16]; 1537 } __packed; 1538 1539 #define HCI_OP_LE_LTK_REPLY 0x201a 1540 struct hci_cp_le_ltk_reply { 1541 __le16 handle; 1542 __u8 ltk[16]; 1543 } __packed; 1544 struct hci_rp_le_ltk_reply { 1545 __u8 status; 1546 __le16 handle; 1547 } __packed; 1548 1549 #define HCI_OP_LE_LTK_NEG_REPLY 0x201b 1550 struct hci_cp_le_ltk_neg_reply { 1551 __le16 handle; 1552 } __packed; 1553 struct hci_rp_le_ltk_neg_reply { 1554 __u8 status; 1555 __le16 handle; 1556 } __packed; 1557 1558 #define HCI_OP_LE_READ_SUPPORTED_STATES 0x201c 1559 struct hci_rp_le_read_supported_states { 1560 __u8 status; 1561 __u8 le_states[8]; 1562 } __packed; 1563 1564 #define HCI_OP_LE_CONN_PARAM_REQ_REPLY 0x2020 1565 struct hci_cp_le_conn_param_req_reply { 1566 __le16 handle; 1567 __le16 interval_min; 1568 __le16 interval_max; 1569 __le16 latency; 1570 __le16 timeout; 1571 __le16 min_ce_len; 1572 __le16 max_ce_len; 1573 } __packed; 1574 1575 #define HCI_OP_LE_CONN_PARAM_REQ_NEG_REPLY 0x2021 1576 struct hci_cp_le_conn_param_req_neg_reply { 1577 __le16 handle; 1578 __u8 reason; 1579 } __packed; 1580 1581 #define HCI_OP_LE_SET_DATA_LEN 0x2022 1582 struct hci_cp_le_set_data_len { 1583 __le16 handle; 1584 __le16 tx_len; 1585 __le16 tx_time; 1586 } __packed; 1587 struct hci_rp_le_set_data_len { 1588 __u8 status; 1589 __le16 handle; 1590 } __packed; 1591 1592 #define HCI_OP_LE_READ_DEF_DATA_LEN 0x2023 1593 struct hci_rp_le_read_def_data_len { 1594 __u8 status; 1595 __le16 tx_len; 1596 __le16 tx_time; 1597 } __packed; 1598 1599 #define HCI_OP_LE_WRITE_DEF_DATA_LEN 0x2024 1600 struct hci_cp_le_write_def_data_len { 1601 __le16 tx_len; 1602 __le16 tx_time; 1603 } __packed; 1604 1605 #define HCI_OP_LE_ADD_TO_RESOLV_LIST 0x2027 1606 struct hci_cp_le_add_to_resolv_list { 1607 __u8 bdaddr_type; 1608 bdaddr_t bdaddr; 1609 __u8 peer_irk[16]; 1610 __u8 local_irk[16]; 1611 } __packed; 1612 1613 #define HCI_OP_LE_DEL_FROM_RESOLV_LIST 0x2028 1614 struct hci_cp_le_del_from_resolv_list { 1615 __u8 bdaddr_type; 1616 bdaddr_t bdaddr; 1617 } __packed; 1618 1619 #define HCI_OP_LE_CLEAR_RESOLV_LIST 0x2029 1620 1621 #define HCI_OP_LE_READ_RESOLV_LIST_SIZE 0x202a 1622 struct hci_rp_le_read_resolv_list_size { 1623 __u8 status; 1624 __u8 size; 1625 } __packed; 1626 1627 #define HCI_OP_LE_SET_ADDR_RESOLV_ENABLE 0x202d 1628 1629 #define HCI_OP_LE_READ_MAX_DATA_LEN 0x202f 1630 struct hci_rp_le_read_max_data_len { 1631 __u8 status; 1632 __le16 tx_len; 1633 __le16 tx_time; 1634 __le16 rx_len; 1635 __le16 rx_time; 1636 } __packed; 1637 1638 #define HCI_OP_LE_SET_DEFAULT_PHY 0x2031 1639 struct hci_cp_le_set_default_phy { 1640 __u8 all_phys; 1641 __u8 tx_phys; 1642 __u8 rx_phys; 1643 } __packed; 1644 1645 #define HCI_LE_SET_PHY_1M 0x01 1646 #define HCI_LE_SET_PHY_2M 0x02 1647 #define HCI_LE_SET_PHY_CODED 0x04 1648 1649 #define HCI_OP_LE_SET_EXT_SCAN_PARAMS 0x2041 1650 struct hci_cp_le_set_ext_scan_params { 1651 __u8 own_addr_type; 1652 __u8 filter_policy; 1653 __u8 scanning_phys; 1654 __u8 data[]; 1655 } __packed; 1656 1657 #define LE_SCAN_PHY_1M 0x01 1658 #define LE_SCAN_PHY_2M 0x02 1659 #define LE_SCAN_PHY_CODED 0x04 1660 1661 struct hci_cp_le_scan_phy_params { 1662 __u8 type; 1663 __le16 interval; 1664 __le16 window; 1665 } __packed; 1666 1667 #define HCI_OP_LE_SET_EXT_SCAN_ENABLE 0x2042 1668 struct hci_cp_le_set_ext_scan_enable { 1669 __u8 enable; 1670 __u8 filter_dup; 1671 __le16 duration; 1672 __le16 period; 1673 } __packed; 1674 1675 #define HCI_OP_LE_EXT_CREATE_CONN 0x2043 1676 struct hci_cp_le_ext_create_conn { 1677 __u8 filter_policy; 1678 __u8 own_addr_type; 1679 __u8 peer_addr_type; 1680 bdaddr_t peer_addr; 1681 __u8 phys; 1682 __u8 data[]; 1683 } __packed; 1684 1685 struct hci_cp_le_ext_conn_param { 1686 __le16 scan_interval; 1687 __le16 scan_window; 1688 __le16 conn_interval_min; 1689 __le16 conn_interval_max; 1690 __le16 conn_latency; 1691 __le16 supervision_timeout; 1692 __le16 min_ce_len; 1693 __le16 max_ce_len; 1694 } __packed; 1695 1696 #define HCI_OP_LE_READ_NUM_SUPPORTED_ADV_SETS 0x203b 1697 struct hci_rp_le_read_num_supported_adv_sets { 1698 __u8 status; 1699 __u8 num_of_sets; 1700 } __packed; 1701 1702 #define HCI_OP_LE_SET_EXT_ADV_PARAMS 0x2036 1703 struct hci_cp_le_set_ext_adv_params { 1704 __u8 handle; 1705 __le16 evt_properties; 1706 __u8 min_interval[3]; 1707 __u8 max_interval[3]; 1708 __u8 channel_map; 1709 __u8 own_addr_type; 1710 __u8 peer_addr_type; 1711 bdaddr_t peer_addr; 1712 __u8 filter_policy; 1713 __u8 tx_power; 1714 __u8 primary_phy; 1715 __u8 secondary_max_skip; 1716 __u8 secondary_phy; 1717 __u8 sid; 1718 __u8 notif_enable; 1719 } __packed; 1720 1721 #define HCI_ADV_PHY_1M 0X01 1722 #define HCI_ADV_PHY_2M 0x02 1723 #define HCI_ADV_PHY_CODED 0x03 1724 1725 struct hci_rp_le_set_ext_adv_params { 1726 __u8 status; 1727 __u8 tx_power; 1728 } __packed; 1729 1730 #define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039 1731 struct hci_cp_le_set_ext_adv_enable { 1732 __u8 enable; 1733 __u8 num_of_sets; 1734 __u8 data[]; 1735 } __packed; 1736 1737 struct hci_cp_ext_adv_set { 1738 __u8 handle; 1739 __le16 duration; 1740 __u8 max_events; 1741 } __packed; 1742 1743 #define HCI_OP_LE_SET_EXT_ADV_DATA 0x2037 1744 struct hci_cp_le_set_ext_adv_data { 1745 __u8 handle; 1746 __u8 operation; 1747 __u8 frag_pref; 1748 __u8 length; 1749 __u8 data[HCI_MAX_AD_LENGTH]; 1750 } __packed; 1751 1752 #define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038 1753 struct hci_cp_le_set_ext_scan_rsp_data { 1754 __u8 handle; 1755 __u8 operation; 1756 __u8 frag_pref; 1757 __u8 length; 1758 __u8 data[HCI_MAX_AD_LENGTH]; 1759 } __packed; 1760 1761 #define LE_SET_ADV_DATA_OP_COMPLETE 0x03 1762 1763 #define LE_SET_ADV_DATA_NO_FRAG 0x01 1764 1765 #define HCI_OP_LE_REMOVE_ADV_SET 0x203c 1766 1767 #define HCI_OP_LE_CLEAR_ADV_SETS 0x203d 1768 1769 #define HCI_OP_LE_SET_ADV_SET_RAND_ADDR 0x2035 1770 struct hci_cp_le_set_adv_set_rand_addr { 1771 __u8 handle; 1772 bdaddr_t bdaddr; 1773 } __packed; 1774 1775 #define HCI_OP_LE_READ_BUFFER_SIZE_V2 0x2060 1776 struct hci_rp_le_read_buffer_size_v2 { 1777 __u8 status; 1778 __le16 acl_mtu; 1779 __u8 acl_max_pkt; 1780 __le16 iso_mtu; 1781 __u8 iso_max_pkt; 1782 } __packed; 1783 1784 #define HCI_OP_LE_READ_ISO_TX_SYNC 0x2061 1785 struct hci_cp_le_read_iso_tx_sync { 1786 __le16 handle; 1787 } __packed; 1788 1789 struct hci_rp_le_read_iso_tx_sync { 1790 __u8 status; 1791 __le16 handle; 1792 __le16 seq; 1793 __le32 imestamp; 1794 __u8 offset[3]; 1795 } __packed; 1796 1797 #define HCI_OP_LE_SET_CIG_PARAMS 0x2062 1798 struct hci_cis_params { 1799 __u8 cis_id; 1800 __le16 m_sdu; 1801 __le16 s_sdu; 1802 __u8 m_phy; 1803 __u8 s_phy; 1804 __u8 m_rtn; 1805 __u8 s_rtn; 1806 } __packed; 1807 1808 struct hci_cp_le_set_cig_params { 1809 __u8 cig_id; 1810 __u8 m_interval[3]; 1811 __u8 s_interval[3]; 1812 __u8 sca; 1813 __u8 packing; 1814 __u8 framing; 1815 __le16 m_latency; 1816 __le16 s_latency; 1817 __u8 num_cis; 1818 struct hci_cis_params cis[]; 1819 } __packed; 1820 1821 struct hci_rp_le_set_cig_params { 1822 __u8 status; 1823 __u8 cig_id; 1824 __u8 num_handles; 1825 __le16 handle[]; 1826 } __packed; 1827 1828 #define HCI_OP_LE_CREATE_CIS 0x2064 1829 struct hci_cis { 1830 __le16 cis_handle; 1831 __le16 acl_handle; 1832 } __packed; 1833 1834 struct hci_cp_le_create_cis { 1835 __u8 num_cis; 1836 struct hci_cis cis[]; 1837 } __packed; 1838 1839 #define HCI_OP_LE_REMOVE_CIG 0x2065 1840 struct hci_cp_le_remove_cig { 1841 __u8 cig_id; 1842 } __packed; 1843 1844 #define HCI_OP_LE_ACCEPT_CIS 0x2066 1845 struct hci_cp_le_accept_cis { 1846 __le16 handle; 1847 } __packed; 1848 1849 #define HCI_OP_LE_REJECT_CIS 0x2067 1850 struct hci_cp_le_reject_cis { 1851 __le16 handle; 1852 __u8 reason; 1853 } __packed; 1854 1855 /* ---- HCI Events ---- */ 1856 #define HCI_EV_INQUIRY_COMPLETE 0x01 1857 1858 #define HCI_EV_INQUIRY_RESULT 0x02 1859 struct inquiry_info { 1860 bdaddr_t bdaddr; 1861 __u8 pscan_rep_mode; 1862 __u8 pscan_period_mode; 1863 __u8 pscan_mode; 1864 __u8 dev_class[3]; 1865 __le16 clock_offset; 1866 } __packed; 1867 1868 #define HCI_EV_CONN_COMPLETE 0x03 1869 struct hci_ev_conn_complete { 1870 __u8 status; 1871 __le16 handle; 1872 bdaddr_t bdaddr; 1873 __u8 link_type; 1874 __u8 encr_mode; 1875 } __packed; 1876 1877 #define HCI_EV_CONN_REQUEST 0x04 1878 struct hci_ev_conn_request { 1879 bdaddr_t bdaddr; 1880 __u8 dev_class[3]; 1881 __u8 link_type; 1882 } __packed; 1883 1884 #define HCI_EV_DISCONN_COMPLETE 0x05 1885 struct hci_ev_disconn_complete { 1886 __u8 status; 1887 __le16 handle; 1888 __u8 reason; 1889 } __packed; 1890 1891 #define HCI_EV_AUTH_COMPLETE 0x06 1892 struct hci_ev_auth_complete { 1893 __u8 status; 1894 __le16 handle; 1895 } __packed; 1896 1897 #define HCI_EV_REMOTE_NAME 0x07 1898 struct hci_ev_remote_name { 1899 __u8 status; 1900 bdaddr_t bdaddr; 1901 __u8 name[HCI_MAX_NAME_LENGTH]; 1902 } __packed; 1903 1904 #define HCI_EV_ENCRYPT_CHANGE 0x08 1905 struct hci_ev_encrypt_change { 1906 __u8 status; 1907 __le16 handle; 1908 __u8 encrypt; 1909 } __packed; 1910 1911 #define HCI_EV_CHANGE_LINK_KEY_COMPLETE 0x09 1912 struct hci_ev_change_link_key_complete { 1913 __u8 status; 1914 __le16 handle; 1915 } __packed; 1916 1917 #define HCI_EV_REMOTE_FEATURES 0x0b 1918 struct hci_ev_remote_features { 1919 __u8 status; 1920 __le16 handle; 1921 __u8 features[8]; 1922 } __packed; 1923 1924 #define HCI_EV_REMOTE_VERSION 0x0c 1925 struct hci_ev_remote_version { 1926 __u8 status; 1927 __le16 handle; 1928 __u8 lmp_ver; 1929 __le16 manufacturer; 1930 __le16 lmp_subver; 1931 } __packed; 1932 1933 #define HCI_EV_QOS_SETUP_COMPLETE 0x0d 1934 struct hci_qos { 1935 __u8 service_type; 1936 __u32 token_rate; 1937 __u32 peak_bandwidth; 1938 __u32 latency; 1939 __u32 delay_variation; 1940 } __packed; 1941 struct hci_ev_qos_setup_complete { 1942 __u8 status; 1943 __le16 handle; 1944 struct hci_qos qos; 1945 } __packed; 1946 1947 #define HCI_EV_CMD_COMPLETE 0x0e 1948 struct hci_ev_cmd_complete { 1949 __u8 ncmd; 1950 __le16 opcode; 1951 } __packed; 1952 1953 #define HCI_EV_CMD_STATUS 0x0f 1954 struct hci_ev_cmd_status { 1955 __u8 status; 1956 __u8 ncmd; 1957 __le16 opcode; 1958 } __packed; 1959 1960 #define HCI_EV_HARDWARE_ERROR 0x10 1961 struct hci_ev_hardware_error { 1962 __u8 code; 1963 } __packed; 1964 1965 #define HCI_EV_ROLE_CHANGE 0x12 1966 struct hci_ev_role_change { 1967 __u8 status; 1968 bdaddr_t bdaddr; 1969 __u8 role; 1970 } __packed; 1971 1972 #define HCI_EV_NUM_COMP_PKTS 0x13 1973 struct hci_comp_pkts_info { 1974 __le16 handle; 1975 __le16 count; 1976 } __packed; 1977 1978 struct hci_ev_num_comp_pkts { 1979 __u8 num_hndl; 1980 struct hci_comp_pkts_info handles[]; 1981 } __packed; 1982 1983 #define HCI_EV_MODE_CHANGE 0x14 1984 struct hci_ev_mode_change { 1985 __u8 status; 1986 __le16 handle; 1987 __u8 mode; 1988 __le16 interval; 1989 } __packed; 1990 1991 #define HCI_EV_PIN_CODE_REQ 0x16 1992 struct hci_ev_pin_code_req { 1993 bdaddr_t bdaddr; 1994 } __packed; 1995 1996 #define HCI_EV_LINK_KEY_REQ 0x17 1997 struct hci_ev_link_key_req { 1998 bdaddr_t bdaddr; 1999 } __packed; 2000 2001 #define HCI_EV_LINK_KEY_NOTIFY 0x18 2002 struct hci_ev_link_key_notify { 2003 bdaddr_t bdaddr; 2004 __u8 link_key[HCI_LINK_KEY_SIZE]; 2005 __u8 key_type; 2006 } __packed; 2007 2008 #define HCI_EV_CLOCK_OFFSET 0x1c 2009 struct hci_ev_clock_offset { 2010 __u8 status; 2011 __le16 handle; 2012 __le16 clock_offset; 2013 } __packed; 2014 2015 #define HCI_EV_PKT_TYPE_CHANGE 0x1d 2016 struct hci_ev_pkt_type_change { 2017 __u8 status; 2018 __le16 handle; 2019 __le16 pkt_type; 2020 } __packed; 2021 2022 #define HCI_EV_PSCAN_REP_MODE 0x20 2023 struct hci_ev_pscan_rep_mode { 2024 bdaddr_t bdaddr; 2025 __u8 pscan_rep_mode; 2026 } __packed; 2027 2028 #define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22 2029 struct inquiry_info_with_rssi { 2030 bdaddr_t bdaddr; 2031 __u8 pscan_rep_mode; 2032 __u8 pscan_period_mode; 2033 __u8 dev_class[3]; 2034 __le16 clock_offset; 2035 __s8 rssi; 2036 } __packed; 2037 struct inquiry_info_with_rssi_and_pscan_mode { 2038 bdaddr_t bdaddr; 2039 __u8 pscan_rep_mode; 2040 __u8 pscan_period_mode; 2041 __u8 pscan_mode; 2042 __u8 dev_class[3]; 2043 __le16 clock_offset; 2044 __s8 rssi; 2045 } __packed; 2046 2047 #define HCI_EV_REMOTE_EXT_FEATURES 0x23 2048 struct hci_ev_remote_ext_features { 2049 __u8 status; 2050 __le16 handle; 2051 __u8 page; 2052 __u8 max_page; 2053 __u8 features[8]; 2054 } __packed; 2055 2056 #define HCI_EV_SYNC_CONN_COMPLETE 0x2c 2057 struct hci_ev_sync_conn_complete { 2058 __u8 status; 2059 __le16 handle; 2060 bdaddr_t bdaddr; 2061 __u8 link_type; 2062 __u8 tx_interval; 2063 __u8 retrans_window; 2064 __le16 rx_pkt_len; 2065 __le16 tx_pkt_len; 2066 __u8 air_mode; 2067 } __packed; 2068 2069 #define HCI_EV_SYNC_CONN_CHANGED 0x2d 2070 struct hci_ev_sync_conn_changed { 2071 __u8 status; 2072 __le16 handle; 2073 __u8 tx_interval; 2074 __u8 retrans_window; 2075 __le16 rx_pkt_len; 2076 __le16 tx_pkt_len; 2077 } __packed; 2078 2079 #define HCI_EV_SNIFF_SUBRATE 0x2e 2080 struct hci_ev_sniff_subrate { 2081 __u8 status; 2082 __le16 handle; 2083 __le16 max_tx_latency; 2084 __le16 max_rx_latency; 2085 __le16 max_remote_timeout; 2086 __le16 max_local_timeout; 2087 } __packed; 2088 2089 #define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2f 2090 struct extended_inquiry_info { 2091 bdaddr_t bdaddr; 2092 __u8 pscan_rep_mode; 2093 __u8 pscan_period_mode; 2094 __u8 dev_class[3]; 2095 __le16 clock_offset; 2096 __s8 rssi; 2097 __u8 data[240]; 2098 } __packed; 2099 2100 #define HCI_EV_KEY_REFRESH_COMPLETE 0x30 2101 struct hci_ev_key_refresh_complete { 2102 __u8 status; 2103 __le16 handle; 2104 } __packed; 2105 2106 #define HCI_EV_IO_CAPA_REQUEST 0x31 2107 struct hci_ev_io_capa_request { 2108 bdaddr_t bdaddr; 2109 } __packed; 2110 2111 #define HCI_EV_IO_CAPA_REPLY 0x32 2112 struct hci_ev_io_capa_reply { 2113 bdaddr_t bdaddr; 2114 __u8 capability; 2115 __u8 oob_data; 2116 __u8 authentication; 2117 } __packed; 2118 2119 #define HCI_EV_USER_CONFIRM_REQUEST 0x33 2120 struct hci_ev_user_confirm_req { 2121 bdaddr_t bdaddr; 2122 __le32 passkey; 2123 } __packed; 2124 2125 #define HCI_EV_USER_PASSKEY_REQUEST 0x34 2126 struct hci_ev_user_passkey_req { 2127 bdaddr_t bdaddr; 2128 } __packed; 2129 2130 #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 2131 struct hci_ev_remote_oob_data_request { 2132 bdaddr_t bdaddr; 2133 } __packed; 2134 2135 #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 2136 struct hci_ev_simple_pair_complete { 2137 __u8 status; 2138 bdaddr_t bdaddr; 2139 } __packed; 2140 2141 #define HCI_EV_USER_PASSKEY_NOTIFY 0x3b 2142 struct hci_ev_user_passkey_notify { 2143 bdaddr_t bdaddr; 2144 __le32 passkey; 2145 } __packed; 2146 2147 #define HCI_KEYPRESS_STARTED 0 2148 #define HCI_KEYPRESS_ENTERED 1 2149 #define HCI_KEYPRESS_ERASED 2 2150 #define HCI_KEYPRESS_CLEARED 3 2151 #define HCI_KEYPRESS_COMPLETED 4 2152 2153 #define HCI_EV_KEYPRESS_NOTIFY 0x3c 2154 struct hci_ev_keypress_notify { 2155 bdaddr_t bdaddr; 2156 __u8 type; 2157 } __packed; 2158 2159 #define HCI_EV_REMOTE_HOST_FEATURES 0x3d 2160 struct hci_ev_remote_host_features { 2161 bdaddr_t bdaddr; 2162 __u8 features[8]; 2163 } __packed; 2164 2165 #define HCI_EV_LE_META 0x3e 2166 struct hci_ev_le_meta { 2167 __u8 subevent; 2168 } __packed; 2169 2170 #define HCI_EV_PHY_LINK_COMPLETE 0x40 2171 struct hci_ev_phy_link_complete { 2172 __u8 status; 2173 __u8 phy_handle; 2174 } __packed; 2175 2176 #define HCI_EV_CHANNEL_SELECTED 0x41 2177 struct hci_ev_channel_selected { 2178 __u8 phy_handle; 2179 } __packed; 2180 2181 #define HCI_EV_DISCONN_PHY_LINK_COMPLETE 0x42 2182 struct hci_ev_disconn_phy_link_complete { 2183 __u8 status; 2184 __u8 phy_handle; 2185 __u8 reason; 2186 } __packed; 2187 2188 #define HCI_EV_LOGICAL_LINK_COMPLETE 0x45 2189 struct hci_ev_logical_link_complete { 2190 __u8 status; 2191 __le16 handle; 2192 __u8 phy_handle; 2193 __u8 flow_spec_id; 2194 } __packed; 2195 2196 #define HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE 0x46 2197 struct hci_ev_disconn_logical_link_complete { 2198 __u8 status; 2199 __le16 handle; 2200 __u8 reason; 2201 } __packed; 2202 2203 #define HCI_EV_NUM_COMP_BLOCKS 0x48 2204 struct hci_comp_blocks_info { 2205 __le16 handle; 2206 __le16 pkts; 2207 __le16 blocks; 2208 } __packed; 2209 2210 struct hci_ev_num_comp_blocks { 2211 __le16 num_blocks; 2212 __u8 num_hndl; 2213 struct hci_comp_blocks_info handles[]; 2214 } __packed; 2215 2216 #define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F 2217 struct hci_ev_sync_train_complete { 2218 __u8 status; 2219 } __packed; 2220 2221 #define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54 2222 2223 #define HCI_EV_LE_CONN_COMPLETE 0x01 2224 struct hci_ev_le_conn_complete { 2225 __u8 status; 2226 __le16 handle; 2227 __u8 role; 2228 __u8 bdaddr_type; 2229 bdaddr_t bdaddr; 2230 __le16 interval; 2231 __le16 latency; 2232 __le16 supervision_timeout; 2233 __u8 clk_accurancy; 2234 } __packed; 2235 2236 /* Advertising report event types */ 2237 #define LE_ADV_IND 0x00 2238 #define LE_ADV_DIRECT_IND 0x01 2239 #define LE_ADV_SCAN_IND 0x02 2240 #define LE_ADV_NONCONN_IND 0x03 2241 #define LE_ADV_SCAN_RSP 0x04 2242 #define LE_ADV_INVALID 0x05 2243 2244 /* Legacy event types in extended adv report */ 2245 #define LE_LEGACY_ADV_IND 0x0013 2246 #define LE_LEGACY_ADV_DIRECT_IND 0x0015 2247 #define LE_LEGACY_ADV_SCAN_IND 0x0012 2248 #define LE_LEGACY_NONCONN_IND 0x0010 2249 #define LE_LEGACY_SCAN_RSP_ADV 0x001b 2250 #define LE_LEGACY_SCAN_RSP_ADV_SCAN 0x001a 2251 2252 /* Extended Advertising event types */ 2253 #define LE_EXT_ADV_NON_CONN_IND 0x0000 2254 #define LE_EXT_ADV_CONN_IND 0x0001 2255 #define LE_EXT_ADV_SCAN_IND 0x0002 2256 #define LE_EXT_ADV_DIRECT_IND 0x0004 2257 #define LE_EXT_ADV_SCAN_RSP 0x0008 2258 #define LE_EXT_ADV_LEGACY_PDU 0x0010 2259 2260 #define ADDR_LE_DEV_PUBLIC 0x00 2261 #define ADDR_LE_DEV_RANDOM 0x01 2262 2263 #define HCI_EV_LE_ADVERTISING_REPORT 0x02 2264 struct hci_ev_le_advertising_info { 2265 __u8 evt_type; 2266 __u8 bdaddr_type; 2267 bdaddr_t bdaddr; 2268 __u8 length; 2269 __u8 data[]; 2270 } __packed; 2271 2272 #define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03 2273 struct hci_ev_le_conn_update_complete { 2274 __u8 status; 2275 __le16 handle; 2276 __le16 interval; 2277 __le16 latency; 2278 __le16 supervision_timeout; 2279 } __packed; 2280 2281 #define HCI_EV_LE_REMOTE_FEAT_COMPLETE 0x04 2282 struct hci_ev_le_remote_feat_complete { 2283 __u8 status; 2284 __le16 handle; 2285 __u8 features[8]; 2286 } __packed; 2287 2288 #define HCI_EV_LE_LTK_REQ 0x05 2289 struct hci_ev_le_ltk_req { 2290 __le16 handle; 2291 __le64 rand; 2292 __le16 ediv; 2293 } __packed; 2294 2295 #define HCI_EV_LE_REMOTE_CONN_PARAM_REQ 0x06 2296 struct hci_ev_le_remote_conn_param_req { 2297 __le16 handle; 2298 __le16 interval_min; 2299 __le16 interval_max; 2300 __le16 latency; 2301 __le16 timeout; 2302 } __packed; 2303 2304 #define HCI_EV_LE_DATA_LEN_CHANGE 0x07 2305 struct hci_ev_le_data_len_change { 2306 __le16 handle; 2307 __le16 tx_len; 2308 __le16 tx_time; 2309 __le16 rx_len; 2310 __le16 rx_time; 2311 } __packed; 2312 2313 #define HCI_EV_LE_DIRECT_ADV_REPORT 0x0B 2314 struct hci_ev_le_direct_adv_info { 2315 __u8 evt_type; 2316 __u8 bdaddr_type; 2317 bdaddr_t bdaddr; 2318 __u8 direct_addr_type; 2319 bdaddr_t direct_addr; 2320 __s8 rssi; 2321 } __packed; 2322 2323 #define HCI_EV_LE_PHY_UPDATE_COMPLETE 0x0c 2324 struct hci_ev_le_phy_update_complete { 2325 __u8 status; 2326 __le16 handle; 2327 __u8 tx_phy; 2328 __u8 rx_phy; 2329 } __packed; 2330 2331 #define HCI_EV_LE_EXT_ADV_REPORT 0x0d 2332 struct hci_ev_le_ext_adv_report { 2333 __le16 evt_type; 2334 __u8 bdaddr_type; 2335 bdaddr_t bdaddr; 2336 __u8 primary_phy; 2337 __u8 secondary_phy; 2338 __u8 sid; 2339 __u8 tx_power; 2340 __s8 rssi; 2341 __le16 interval; 2342 __u8 direct_addr_type; 2343 bdaddr_t direct_addr; 2344 __u8 length; 2345 __u8 data[]; 2346 } __packed; 2347 2348 #define HCI_EV_LE_ENHANCED_CONN_COMPLETE 0x0a 2349 struct hci_ev_le_enh_conn_complete { 2350 __u8 status; 2351 __le16 handle; 2352 __u8 role; 2353 __u8 bdaddr_type; 2354 bdaddr_t bdaddr; 2355 bdaddr_t local_rpa; 2356 bdaddr_t peer_rpa; 2357 __le16 interval; 2358 __le16 latency; 2359 __le16 supervision_timeout; 2360 __u8 clk_accurancy; 2361 } __packed; 2362 2363 #define HCI_EV_LE_EXT_ADV_SET_TERM 0x12 2364 struct hci_evt_le_ext_adv_set_term { 2365 __u8 status; 2366 __u8 handle; 2367 __le16 conn_handle; 2368 __u8 num_evts; 2369 } __packed; 2370 2371 #define HCI_EVT_LE_CIS_ESTABLISHED 0x19 2372 struct hci_evt_le_cis_established { 2373 __u8 status; 2374 __le16 handle; 2375 __u8 cig_sync_delay[3]; 2376 __u8 cis_sync_delay[3]; 2377 __u8 m_latency[3]; 2378 __u8 s_latency[3]; 2379 __u8 m_phy; 2380 __u8 s_phy; 2381 __u8 nse; 2382 __u8 m_bn; 2383 __u8 s_bn; 2384 __u8 m_ft; 2385 __u8 s_ft; 2386 __le16 m_mtu; 2387 __le16 s_mtu; 2388 __le16 interval; 2389 } __packed; 2390 2391 #define HCI_EVT_LE_CIS_REQ 0x1a 2392 struct hci_evt_le_cis_req { 2393 __le16 acl_handle; 2394 __le16 cis_handle; 2395 __u8 cig_id; 2396 __u8 cis_id; 2397 } __packed; 2398 2399 #define HCI_EV_VENDOR 0xff 2400 2401 /* Internal events generated by Bluetooth stack */ 2402 #define HCI_EV_STACK_INTERNAL 0xfd 2403 struct hci_ev_stack_internal { 2404 __u16 type; 2405 __u8 data[]; 2406 } __packed; 2407 2408 #define HCI_EV_SI_DEVICE 0x01 2409 struct hci_ev_si_device { 2410 __u16 event; 2411 __u16 dev_id; 2412 } __packed; 2413 2414 #define HCI_EV_SI_SECURITY 0x02 2415 struct hci_ev_si_security { 2416 __u16 event; 2417 __u16 proto; 2418 __u16 subproto; 2419 __u8 incoming; 2420 } __packed; 2421 2422 /* ---- HCI Packet structures ---- */ 2423 #define HCI_COMMAND_HDR_SIZE 3 2424 #define HCI_EVENT_HDR_SIZE 2 2425 #define HCI_ACL_HDR_SIZE 4 2426 #define HCI_SCO_HDR_SIZE 3 2427 #define HCI_ISO_HDR_SIZE 4 2428 2429 struct hci_command_hdr { 2430 __le16 opcode; /* OCF & OGF */ 2431 __u8 plen; 2432 } __packed; 2433 2434 struct hci_event_hdr { 2435 __u8 evt; 2436 __u8 plen; 2437 } __packed; 2438 2439 struct hci_acl_hdr { 2440 __le16 handle; /* Handle & Flags(PB, BC) */ 2441 __le16 dlen; 2442 } __packed; 2443 2444 struct hci_sco_hdr { 2445 __le16 handle; 2446 __u8 dlen; 2447 } __packed; 2448 2449 struct hci_iso_hdr { 2450 __le16 handle; 2451 __le16 dlen; 2452 __u8 data[]; 2453 } __packed; 2454 2455 /* ISO data packet status flags */ 2456 #define HCI_ISO_STATUS_VALID 0x00 2457 #define HCI_ISO_STATUS_INVALID 0x01 2458 #define HCI_ISO_STATUS_NOP 0x02 2459 2460 #define HCI_ISO_DATA_HDR_SIZE 4 2461 struct hci_iso_data_hdr { 2462 __le16 sn; 2463 __le16 slen; 2464 }; 2465 2466 #define HCI_ISO_TS_DATA_HDR_SIZE 8 2467 struct hci_iso_ts_data_hdr { 2468 __le32 ts; 2469 __le16 sn; 2470 __le16 slen; 2471 }; 2472 2473 static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) 2474 { 2475 return (struct hci_event_hdr *) skb->data; 2476 } 2477 2478 static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb) 2479 { 2480 return (struct hci_acl_hdr *) skb->data; 2481 } 2482 2483 static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) 2484 { 2485 return (struct hci_sco_hdr *) skb->data; 2486 } 2487 2488 /* Command opcode pack/unpack */ 2489 #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) 2490 #define hci_opcode_ogf(op) (op >> 10) 2491 #define hci_opcode_ocf(op) (op & 0x03ff) 2492 2493 /* ACL handle and flags pack/unpack */ 2494 #define hci_handle_pack(h, f) ((__u16) ((h & 0x0fff)|(f << 12))) 2495 #define hci_handle(h) (h & 0x0fff) 2496 #define hci_flags(h) (h >> 12) 2497 2498 /* ISO handle and flags pack/unpack */ 2499 #define hci_iso_flags_pb(f) (f & 0x0003) 2500 #define hci_iso_flags_ts(f) ((f >> 2) & 0x0001) 2501 #define hci_iso_flags_pack(pb, ts) ((pb & 0x03) | ((ts & 0x01) << 2)) 2502 2503 /* ISO data length and flags pack/unpack */ 2504 #define hci_iso_data_len_pack(h, f) ((__u16) ((h) | ((f) << 14))) 2505 #define hci_iso_data_len(h) ((h) & 0x3fff) 2506 #define hci_iso_data_flags(h) ((h) >> 14) 2507 2508 #endif /* __HCI_H */ 2509